Yet another Arduino Nano and si5351 Digital VFO/BFO

The second weekend in January 2017 afforded time to build something I’ve been wanting to build for several years, my first DDS VFO. I’ve built a kit DDS VFO with pre-soldered surface mount parts and burned-in firmware, but this was to be a scratch build with Arduino Nano, Arduino/C code with modifications, and a Silicon Labs si5351 on a breakout board. I used the wiring map and script from Tom AK2B. It is modified from one by SQ9NJE and uses Jason NT7S si5351 library. The script is elegantly simple, supporting a single push-button to cycle frequency increments, and dealing with encoder interrupts, contact debouncing, refreshing the LCD display, IF offset and VFO/BFO outputs. At the code level Jason’s si5351 library hides the gutsy device interfacing, giving you just a handful of common-sense functions to call… for example, set_frequency() takes as its argument the frequency in centi-hertz (1/100th of a hertz) and the ‘clock 0/1/2’ flag. It couldn’t be simpler. The Adafruit board contains the si5351 and a 25MHz clock (from local IoT supplier Core Electronics).  I chose Veroboard as the substrate for the controller proper, and it proved suitable. Here’s a video demonstration of the VFO’s features.

Tom’s script didn’t compile first time, as Jason’s library had changed since Tom posted his script. Jason had removed one param from the init() and set_frequency() methods to simplify things. In Tom’s script I removed the arguments (which were ‘0’ anyway) and it worked. This was a remarkably simple build experience!  For what you get, it has to be one of the biggest homebrew return on investments ever!  The key to it is the si5351… three clocks, 1-160MHz, all software controlled, in a tiny 10 pin MSOP package, and all for a few dollars.

One thing’s for sure, it will be hard going back to quartz.

Having jumped into my first Arduino project all sorts of possibilities are appearing. I searched for all of the breakout boards in the Core Electronics site, which links across to the Adafruit site for product information and tutorials, wiring diagrams, library guides and a lot more.

With the remarkable range of breakouts, all sorts of things are possible, including environment (SWR, power and temperature) monitoring for linears, audio and digital signal processing (including SDR with the higher power Teensy and others), sequencing, switching, wifi, bluetooth and packet data links, and every kind of control capability.

Next I plan on checking out the OLED and TFT screens for more sophisticated graphics and status displays. Some of the (admittedly tiny) OLED displays draw an average 25mA, and there are new low power  microcontrollers as well.  I suspect that the long standing issue QRP portable ops have had with ‘hungry DDSs’ may be history.

Mods for txcvr control

Once you have control of the VFO and BFO in software, controlling other things in a transceiver like band, memories or multiple VFOs, IF filter switching is all just a matter of a few more lines of code.  I came up with the following additional controls:

  • Step cycle (10, 100, 1k, 10kHz steps)
  • VFO cycle (A, B or C)
  • Band up/down (LF, MW, 160, 80, 60, 40, 30, 20, 17, 15, 12, 10)
  • Mode cycle (SSB, AM, CW)
  • Rx/Mute status (Rx, Tx)

Controlling mode and band switching relays

If you decide to implement control of mode and band switching in your homebrew radio’s Arduino controller, a mechanism is needed to pass binary or BCD values representing the active mode and band selections through to the individual control lines that energise the relays for each. The traditional way of doing this is to get the controller to output a BCD 3 or 4-bit nibble on its pins, and use a CMOS/TTL 1-of-8 (74LS138) or 1-of 16 (74LS154) decoder, with an inverting transistor relay driver stage which does the actual switching.  You can buy the CMOS version of the venerable 74LS154 1-of-16 IC in surface mount on an Arduino style break-out board to minimise space.

A more contemporary way of achieving the same thing is to use a 1-of-16 decoder driven by I2C. Something like this break-out expander. Or this IO expander.  This is preferable because you don’t need to tie up lots of your Nano pins to synthesise a BCD nibble, instead, you pass the selected value to the expander/decoder device via I2C. I’ve not decided how to do this yet.

Supporting lots of pushbuttons

I came up with the need for pushbuttons to control the following features of a multiband radio:

  1.  freq step (100Hx, 1kHz, 10kHz)
  2. VFO cycle (VFO A, VFO B, VFO C)
  3. band up (40, 30, 20 etc)
  4. band down (20, 30, 40 etc)
  5. mode cycle (SSB, CW, AM)
  6. mute (RX, TX).

The Hitachi LCD display does not support serial I2C. That means 4 Arduino digital outputs are necessary to convert 4 bit data values to the display, plus 2 control lines. That does not leave enough digital and analogue pins for all the pushbuttons or  output lines.

A common way around this (without going to the added complexity of IO expander break-outs) is to multiplex a number of pushbuttons switching on a resistive voltage divider, on a single analog input. The script reads the pin and interprets a voltage range for each button. Here’s a circuit and tutorial. I built a little rack of 6 momentary on switches (on a receiver front panel I prefer pushing down on a spring loaded switch over pushing in on a pushbutton). The values I got were quite predictable and narrow in range, it is possible that the 1% carbon resistors I used might be helping here. In the mapping script I used wide ranges to allow for future drift or contact resistance.

si5351 clock filtering

The three si5351 clock outputs are square waves. There is some discussion on the internet about the harmonic content of the waveform at various frequencies and need to filter harmonics. The answer is, it depends on what you are doing with the VFO signal. In the dual conversion multiband receiver I have in mind, all 3 mixers are SBL-1s. I asked the Yahoo QRP-TECH crowd what they thought of the need to low-pass filter a square wave when used to drive an SBL-1 Double Balanced Mixer. There wasn’t any consensus, but two themes emerged:

  • square waves are rich in harmonics and these should be cleaned up, and
  • a DBM is a switching device in which the diodes saturate when driven with correct oscillator signal level, so squareness of the waveform doesn’t matter much.

I decided that low pass filtering was desirable, and plan to add a 5 element Chebychev LPF and a broad-band 2N3904 amplifier stage for each of the three clocks.

Plan for use of the Nano’s I/Os

Here’s a plan for how the Nano’s IO pins might be used. It assumes old-fashioned TTL band and mode decoding and switching.

D0 – NC
D1 – NC
D2 – rotary encoder up
D3 – rotary encoder down
D4 – // mode output (lsb) (TBC)
D5 – LCD Register Select
D6 – LCD Enable/Clock
D7 – LCD D4
D8 – LCD D5
D9 – LCD D6
D10 – LCD D7
D11 – // mode output (msb) (TBC)
D12 – // band output (lsb) (TBC)
D13 – // (internal LED) –
A0 – // Multiplexed buttons — VFO cycle, Step cycle, band up, band down, Mode cycle, mute)
A1 – // band output . (TBC)
A2 – // band output . (TBC)
A3 – // band output (msb) (TBC)
A4 – si5351 SDA
A5 – si5351 SCL

Voltmeter, S-meter, RF power meter, SWR meter

Experimenters are using Arduino analog inputs for other useful things.

  • Voltmeter: a volt meter is extremely valuable, even mandatory for monitoring battery voltage and health from a portable QRP rig. A voltmeter is one of the easiest additions — simply create a voltage divider with two 1% resistors across the supply rail so that the peak supply voltage is about 5 volts (measures close to 1024 on the pin using AnalogRead()) and scale the resulting value in software.
  • S-meter: a simple one transistor circuit can sample and rectify IF or audio signal and bring it into the 0-5 volt range for another analogue pin.
  • RF-meter: sample and rectify the PA output via a tiny capacitor (a few pF); the Arduino can use the same display space for S-meter on receive and RF on transmit.
  • SWR: a simple directional coupler can supply both forward and reflected indicative voltages, which can be displayed concurrently or alternately.

Useful notes on Arduino Nano

While researching the Nano I found the following useful facts.

  1. D0 and D1 are used in the serial interface between the Arduino and the PC. The same channel is used by the system’s serial monitor Serial:: which allows a script to trace to the attached screen or other serial device.  Seems best to not use these pins.
  2. D13 controls an on-board LED through an appropriate resistor to ground. As the Nano boots, D13 is made an output (all the other i/o lines come out of a reset as inputs). And the system software, before it executes whatever you’ve put in setup(); will briefly take D13 high before returning it to low. For this reason this pin should be used for input only, to avoid relays clattering during the first seconds after power up.
  3. Arduino analogue I/Os can be used as digital ones.  To set A0 as output and high you use:

 pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);

August 2017: I’ve subsequently made a second Arduino Nano and si5351 VFO/BFO/Controller for another homebrew rig, with some improvements.  The post describing the VFO is here.   A video of the new rig (receiver only at this stage) is here.

March 2018: Have built four or five Arduino Nano/si5351 VFO/Controllers now.  A post describing my latest Nano/si5351 controlled QRP rig is here.

Tagged , , , ,

12 thoughts on “Yet another Arduino Nano and si5351 Digital VFO/BFO

  1. VK3IL says:

    You’re turning to the dark side! Welcome to the world of digital electronics! There are a number of VFO kits out there now too using this synthesizer. I used one in upgrading my KN-Q7A rig (see ). You can do an awful lot with microprocessors in rig control and still use analog for the signal chain. Now you just need to get into designing surface mount PCBs and start using the microprocessors directly 🙂 Even though it costs money to have PCBs produced commercially, it’s pretty cheap these days from China.




    • Paul Taylor says:

      Thanks David. Its pretty good here on the dark side of digital electronics! I can see a steady trajectory in my projects from 1970s radio craft. I can see the day when i do design one off PCBs with surface mount components, mainly to reduce size for portable rigs. Thanks for your Likes and comments David! 73 de vk3hn.


  2. […] the success of My First DDS VFO, complete with Arduino script programming, I found myself interested in mimicking more of the […]


  3. Ardy says:

    Congratulations Paul, si5351 have more clean output and low distortion than DDS ad9850 / 51. 2nd output can using for local oscilator.
    Nice project Paul. 73 de yc2lev


  4. […] the success of My First DDS VFO, complete with Arduino script programming, I found myself interested in mimicking more of the […]


  5. […] in February 2017 I scratch-built my first Arduino and si5351 VFO. Here’s my second one.  It is a generic Nano/si5351 module wired up to Farhan’s […]


  6. […] apart from soldering the SMA connectors) it is just 30mm wide and can used with an Arduino to make VFO with 3 programmable sine wave outputs. Current cost is less than £5 on ebay plus the […]


  7. Michael says:

    Hello Paul. I am just starting to replicate your VFO in the above article (As the basis for another project later). Do you have the exact code still for this exact configuration please? I have downloaded the code dated VK3HN, 20 June 2017, but it cannot find Rotary.h and pcf8574.h which is not needed in this version. I’m looking forward to getting this going. Many thanks…, Michael ZL3AX


    • Paul Taylor says:

      Hi Michael, sorry for the delayed reply, WordPress alerts have dropped off.

      The code is for the Progressive Receiver, not yet posted as it’s not working to my satisfaction. Look at Progressive_VFO.ino on my github page in the vk3hn_si5351_VFO_controller repository. I haven’t flashed this particular controller for probably 9 months but it should still work. You may need to adjust it a bit, and of course, it probably has bugs! Let me know if you need anything interpreted. Regards Paul VK3HN.


      • Anonymous says:

        Thanks Paul. Things have already moved on a bit and have found some code and got the VFO working. Now the project begins, and the code will evolve here. I am still interested in code that gets the best quality from the Si5351 and am working on this. Thanks Paul. M. (Zl3AZ, J87AB, G0GPX)


      • Paul Taylor says:

        Sounds good Paul, there’s lots of code and help around. Good luck with your project. Thanks for commenting.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Amateur Radio and unrelated technologies

Paul Gacek


Peter Rachow's (DK7IH) Amateur Radio Engineering Projects

Amateur projects for the radio draftsman. Hardware, software, test equipment for the radio amateur

VK3KR Workshop

Homebrew electronics and a bit about a Tandoor oven

Homebrew Amateur Radio

Homebrew Amateur Radio and Electronics.

W3JDR Bright Ideas

For Ham Radio Experimenters


Amateur Radio and Stuff


My Projects

The Dragon and The Phoenix

Bard's Journey into the Collective Subconscious and How It Shapes Our World

Bryce Dombrowski's Projects

electronics engineering and more!

%d bloggers like this: