A tiny Si5351 VFO
The Si5351 is a cheap I2C clock generator that makes a surprisingly usable VFO for a homebrew receiver. Here is the minimal sketch I keep coming back to.
Setting a frequency
#include <si5351.h>
Si5351 si5351;
void setup() {
// 25 MHz reference, 0 pF load correction.
si5351.init(SI5351_CRYSTAL_LOAD_0PF, 0, 0);
// 7.030 MHz, in centi-hertz (so 703000000).
si5351.set_freq(703000000ULL, SI5351_CLK0);
si5351.drive_strength(SI5351_CLK0, SI5351_DRIVE_8MA);
}
void loop() {
// Tune with a rotary encoder here.
}
Reading the encoder
A quick table of the step sizes I use when tuning:
| Band | Step (Hz) | Notes |
|---|---|---|
| 80 m | 10 | SSB nets |
| 40 m | 10 | busy, fine steps help |
| 20 m | 50 | fast band-scanning |
And the detent handler, kept deliberately dumb:
def on_detent(direction, step_hz, freq_hz):
"""Return the new frequency after one encoder detent."""
freq_hz += direction * step_hz # direction is +1 or -1
return max(1_800_000, min(freq_hz, 30_000_000))
That is enough to get a stable signal you can zero-beat against WWV. The rest is filtering and a decent enclosure, which is a story for another page.