Download Arduino VFO

By using an Arduino uno R3 and an AD 9850 or AD9851 DDS module a very stable VFO can be created to add a VFO to any crystal locked radio or to replace the VFO in an older VFO controlled radio that suffers from drift or add an external VFO. Give new life to an old Codan that is crystal bound with the ability to switch from upper to lower sideband.
This project can be configured in numerous ways to be a simple RF oscillator that is capable of generating output signals from 1 Hz to 70 MHz or as a VFO with IF offsets . Examples given hear are for an RF signal generator, a VFO for a Codan with a 1650KHz IF and as a 5 to 5.5 MHz VFO for an old 6 meter Rig. The software allows for the frequency to be adjusted in steps from 1 Hz, 10 Hz, 50 Hz,100 Hz, 500 Hz, 1 KHz,2.5 KHZ, 5 KHz, 10 KHz, 100KHz and 1 MHz. Pushing the button on the rotary encoder will step through the steps or by holding it down will scroll through the steps.

The project requires an Arduino uno R3, a 16 x2 line LCD display, an AD9850 or AD9851 DDS module and a rotary encoder. All these items are readily available on eBay at a total cost of less than $50. If sourced from local Australian suppliers expect to pay a little more.
The AD 9850 DDS has an upper frequency limit of about 40 MHz and is cheaper than the AD 9851 that is capable of output to 70 MHz, if building a VFO the AD9850 will most probably be the one to choose. While the onboard crystal may not be precisely on frequency minor adjustment to the code that sets the DDS frequency can be made to correct for this, this line of code in the examples is well documented. The output frequency is remarkably stable after just a few minutes after power up so the frequency stability of the DDS module is as good as crystal locked. I did notice that changes to supply voltage can result in a few hertz change in frequency, so for good frequency stability a well regulated 5 volt supply rail is suggested.
There is only one line of code that requires changing when using the AD9851 as opposed to the AD9850 The 9850 uses a 125MHz clock the 9851 uses a 180 MHz clock, it is necessary to enable the six times multiplier of the on board crystal for the 9851 180 MHz clock. This line of code is clearly documented in the supplied examples.
Programming the Arduino is achieved by going to the Arduino site and download the Arduino IDE ( Integrated development environment ) use this to upload the software to your Arduino board via a USB cable. It will also be necessary to load the additional library file for the rotary encoder into the Arduino IDE, instructions on how to do this can be found at The rotary encoder code is courtesy of Ben Buxton.


None of the main code is of my creation, the supplied examples are modified versions of code written by Richard Visokey AD7C and others, I have made a few very minor modifications to Richards main code for the Codan IF offset and USB LSB switching as well as minor modifications to his code to allow for the LCD to display the Carrier Frequency of the 6 meter radio while outputting 5 to 5.5 MHz. Anyone with a little knowledge of C programming will be able to make suitable modifications to the code to adapt to their individual requirements as well as add additional features. The code is well documented and allows even a poor C programmer like myself to understand how the program functions.
Upper and lower sideband selection for the Codan radios is a simple matter of changing the frequency of the VFO to either mix on the high side of the signal frequency or on the low side. For example with the Codan’s 1650 KHz IF and a signal frequency of 7.193 MHz for an upper sideband signal the VFO would need to be 8.843 MHz however to produce a lower sideband signal the VFO is set to 5.543 MHz both these signals mix with the 7.193 MHz signal to produce the required 1650 KHz IF. The software takes the IF offset into account and the display outputs the actual Carrier frequency.
Construction is simplified if you also purchase an Arduino proto shield to mount the couple of components required, this board then plugs into the Arduino. All wiring from the peripheral devices are also made to the proto shield board. Less than an hour will see the project complete.


The switch connected to A5 is a toggle switch for sideband selection. Further switches could be added and code written to allow for Dual VFO’s, Band selection etc your imagination is the limit.
Connecting the VFO to the Codan Radio is also reasonably simple, Make sure the coils fitted are for a frequency somewhere close to your desired frequency of operation. Remove the crystal and feed the output of your VFO via a 0.1 uf capacitor connected to the side of the crystal socket that connects to the diode not to the side that connects to the capacitors. This is actually feeding the signal into the buffer transistor not into the oscillator transistor the oscillator transistor then acts as an AGC control, the actual level of the signal coming from the VFO becomes very non critical. You can connect a 0.1 capacitor to as many crystal positions as you wish and simply connect the other ends together, only the selected channel will operate , crystals left in position will also still operate. To cover the entire 80 meter band you will probably require three channel positions as the output will fall off as you move the VFO frequency further away from the frequency the coils are tuned to.

If you are going to use the VFO to feed older valve radios the direct output from the DDS module at -10 dBm will probably be too low in level and will require a buffer amplifier, I am in the early stages of implementing a buffer using the AD811 Chip, a device designed as a wideband video amplifier in television cross point switchers further development is ongoing. The code for this project will be available on the WIA website. I have included three versions of the code a 5 to 5.5 MHz VFO for a 6 Meter Rig, a signal generator from 1 Hz to 70 MHz and a Codan VFO with sideband selection. From these examples you should be able to work out how to change Richards code to suit your particular requirement. Please note the downloadable code has been produced by several authors and is by no means my work please give credit where credit is due, also feel free to modify the code for your requirements and share your work, it’s great to see what others do. Downloadable code available under the Arduino Tab
Richard Visokey
Ben Buxton
Arduino dot cc