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 amazing si5351. Three oscillators, 1-160mhz, all software controlled, in a tiny 10 pin MSOP package, and all for a few dollars. The price:usefulness ratio is off the scale.
Of course, moving your oscillators into software is just one part of the software defined radio revolution, and I have been deliberately playing SDR-Luddite for a while now. Having now crossed that line, it will be hard going back to quartz.
I’m comforted but the observation that luminaries like Pete Juliano N6QW use software defined oscillators but still solder together time-proven analogue modules in the signal path. It seems this hybrid approach can bring homebrew happiness without compromising one’s analogue heritage. I’ll just have to be careful not to get hooked on A/D converters and Fast Fourier Transforms. Temptation is never far away.
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, fritzling (wiring) diagrams, library guides and a lot more. A few basic homebrew receiver/ rig controller applications that you will have already seen done by lots of others are dot pointed below.
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. Let’s see who can deliver a fully functioning DDS VFO with display that draws 40 to 50 mA. With LiPO and LiFePO4 batteries, that will be impossible to ignore!
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:
- freq step (100Hx, 1kHz, 10kHz)
- VFO cycle (VFO A, VFO B, VFO C)
- band up (40, 30, 20 etc)
- band down (20, 30, 40 etc)
- mode cycle (SSB, CW, AM)
- 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 a re 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.
- 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.
- 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.
- Arduino analogue I/Os can be used as digital ones. To set A0 as output and high you use: