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

Here is the code so far, and the encoder lib.
 

Attachments

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!
 

Attachments

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()"
 

Attachments

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.
 

Attachments

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.
 

Attachments

Last edited:
Top