Generic Crystal Replacement Test VFO

VK3ZYZ

Moderator
Staff member
A trouble I had was the ESP8266 repeatedly resetting.
It turns out I was using pin numbers wrong..
For example, digitalWrite(7,OUTPUT); would crash the board.
The fix, digitalWrite(D7,OUTPUT);
The "D" was missing!

I finally have the encoder working, sort off, but there is still lots to do.
This is a handy place to back up my code ;)
Photo on 7-5-2025 at 10.41 pm.jpg

EDIT: use the code from post #12.
Earlier code removed.
 
Last edited:

VK3ZYZ

Moderator
Staff member
I can now set the parameters for the required radio. But there is some problems with the code as it times out and resets the ESP8266 when in the editing mode.
When I get it going, maybe someone with good programming skills can look at it and fix the code!

EDIT: use the code from post #12.
Earlier code removed.
 
Last edited:

VK3YNV

Administrator
Staff member
I had a quick look, and I guess the encoder interrupt code is somewhere else.
In any event be wary of reading encoder position from outside the interrupt routine, you can get weird timing rollover errors.
 

VK3ZYZ

Moderator
Staff member
It looks like the reset crash is fixed.
At the end of each loop, I added a delay so the ESP8266 has something to do.
Code:
          while (digitalRead(Up_SWITCH)== LOW)
          { delay(10);} // wait for key up
        }
        delay(1);
    }
Oh, Ray, I renamed the "EXIT()" to "BackToMainLoop()"



EDIT: use the code from post #12.
Earlier code removed.
 
Last edited:

VK3ZYZ

Moderator
Staff member
EDIT: I have made it battery operated and removed the connectors.
So here is the real circuit.
1746950529298.png

It works :)
(the o/p coupling caps are now 100nF, not 100pF)
 
Last edited:

VK3ZYZ

Moderator
Staff member
On this first one, I think I will add a charger and 18650 battery to make it portable.
There is a first try of a lid for a Jaycar BH6011 box on the 3D printer.

1746875937550.png

EDIT:
I have printed the first version but decided to change it to this one, And now it is printing (3 hours).
 
Last edited:

VK3ZYZ

Moderator
Staff member
TestVFO_Proto.JPG
The prototype wiring was just birds nest.

Then the 3D printed front was (finally) done!
Mounting the Si5351 board.
TestVFO_RF_Wiring.JPG

Then the rest of it...
TestVFO__Insides.JPG

And the finished unit running on the 18650 cell.
TestVFO_Front.JPG


I have yet to add the external "PTT" line but the encoder button also works as the PTT.
And I need to update the circuit as it now has a USB Micro charging port and a single 18650 for power.

EDIT: I have added a 2 pin connector on the front for TRX input. Not shown on this photo.


EDIT: use the code from post #12.
Earlier code removed.
 
Last edited:

VK3ZYZ

Moderator
Staff member
I have found the encoder routine in use is very flakey so I'm trying to write one that works reliably.
FIXED :)
After playing around with lots of stuff that did not work, it turned out to be very simple.

Code:
attachInterrupt(digitalPinToInterrupt(ENCODER_A), EncoderISR, RISING);  //call encoderISR() every low->high changes


void ICACHE_RAM_ATTR EncoderISR()
{ noInterrupts();
  if (digitalRead(ENCODER_B)==HIGH)
  { counter++;}
  else
  {counter--;}
  interrupts();                     //enable interrupts
}
Also here is my 3D print.

EDIT: use code from post #21 now.
 

Attachments

Last edited:

VK3ZYZ

Moderator
Staff member
I've updated the 3D print too.
Added labels and moved the PTT connector away from the push button.
1752227831298.png



It is printing at the moment, 0.2mm layers.
Edit your gcode file.
Between the second and third layers, the pause code (see file below) is inserted prompting for WHITE filament, then after layer4, again to return to BLACK.
If I have it right, this should give white writing on the black background.
Note, the layers start at LAYER:0, not LAYER:1.

You will need 2 x buttons also.
 

Attachments

Last edited:

VK3ZYZ

Moderator
Staff member
TestVFOFront.jpg

It did not print as well as I had hoped. Using a 0.6mm nozzle instead of the 0.4mm one could be part of the problem.
I can see a couple of places where the black has lifted.
 

VK3ZYZ

Moderator
Staff member
I have ordered 10 PCBs and will 3D print a front to suit.
If they both fit together first time, it will be a bit of a miracle!
 

VK3ZYZ

Moderator
Staff member
I have added all the bands from 160M to 70cm now.
There is still lots off room for improvement.
EDIT: Removed the sketch file. See the next post.
 
Last edited:

VK3ZYZ

Moderator
Staff member
I had the Si5351 stop working and it took me ages to figure out it seems to be a library problem.
1752721424792.png

Fixed by including the si5351.cpp and si5351.h files in the sketch directory.

I am using the Si5351 boards modded with the TCXO replacing the crystal so the calibration factor is not needed.
The frequencies are pretty good now. For example, the default start up RX required 22.550000 Mhz reads between 22.550000 and 22.549999 Mhz.
I'm quite happy with that.
It is a bit fiddly but well worth the mod.


EDIT: Changed the number size to "long long" as it was limiting the top frequencies with just "long".

Code:
unsigned long long RXgenfrequency  = 146000000; // synthesizer default settings on start up.
unsigned long long TXgenfrequency  = 146000000;
I will have to update all the other synths too!

EDIT: use code from post #21 now.
 
Last edited:

VK3ZYZ

Moderator
Staff member
Josh helped me look at the outputs and there was a bit of a problem. Terrible wave shape!
Here on my setup, with the 50R termination directly at the scope, it was not so bad, and I have used a short lead to the scope.

Default drive level!
Un-terminated... 2.2V P-P
Photo on 17-7-2025 at 3.53 pm.jpg

50R termination.. 1.3V P-P
Photo on 17-7-2025 at 3.54 pm.jpg


Adding the settings for 8mA drive..
Code:
  // Initialize the Si5351
  clockgen.init(SI5351_CRYSTAL_LOAD_8PF, 0, 0);

// use the correct correction factor is the Si5351 board uses a crystal, not a TCXO.
// clockgen.set_correction(cal_factor, SI5351_PLL_INPUT_XO); // <<<<<<<this is found from Si5351 calibrator code.

  clockgen.drive_strength(SI5351_CLK0,SI5351_DRIVE_8MA);
  clockgen.drive_strength(SI5351_CLK1,SI5351_DRIVE_8MA);
  clockgen.drive_strength(SI5351_CLK2,SI5351_DRIVE_8MA);
Un-terminated... 4.4V P-P
Photo on 17-7-2025 at 3.56 pm #2.jpg

50R termination... 2.78V P-P
Photo on 17-7-2025 at 3.56 pm.jpg

Significant extra levels.
I just noted, the scope thinks it has a /10 probe so the scope levels shown read 10 times larger that they are.
 
Last edited:

VK3ZYZ

Moderator
Staff member
It looks like there is a pulsing of the generated signals. That could be the frequency being repeatedly set when it should only be when it changes. This is something more I will have to look at, but it does give a "modulation" to the signal that makes it easier to hear. Maybe I should call it a feature???
If anyone wants to help with the code, PLEASE feel free!
 
Last edited:
Top