Tags: radio, arduino

Posted: January 5, 2012

Rig control with an Arduino, Part 2

Quite a bit has happened since my last post about my Arduino-based rig controller (which I recommend reading first if you haven’t already done so, because it’ll make this make much more sense.) The RRS Ernest Shackleton has been and gone, bringing (quite literally!) a ship-load of supplies onto station; among them my personal radio gear.

The arrival of the K3 has allowed me to start testing the rig controller against a real radio, and quite a bit of progress has been made. The nunchuk interface works well; the bottom button is the main PTT, the top button is used for latching PTT and cancelling DVR playback. Joystick left plays back DVR memory 1 on a loop; right plays memory 2 once and down gives me memory 3 once. I used the controller with these settings on air for a couple of evenings over the New Year period, and was very happy with them. The nunchuk, as you would expect, fits the hand well and is comfortable, and the macros are very convenient. Being able to trigger the macros so easily means I’m more inclined to use them for shorter transmissions: memory 2 is just “VP8DMH, QRZ?”, which allows me a quick pause to drink while running.

Moving up on the joystick is a bit more interesting. I wanted to play with a more advanced macro that demonstrates the power of a microcontroller by doing something that you can’t do with a macro on the K3 or P3 directly. The ‘up’ macro has two features that make it fit that bill; it’s a combined macro involving both the K3 and the P3, and it remembers and returns to previous state.

So what does it do?

I’ve often wished for a quick ‘zoom’ function for the P3 (Elecraft’s panadaptor); I tend to have the span set quite wide for most of the time, but sometimes I want to take a closer look at the area around my VFO frequency, and then return to the previous settings. The ‘up’ macro on the nunchuk provides just this: it has two states (zoomed and not) and toggles between them. Before zooming, it makes a note of the current span and centre frequency of the P3. Then it zooms in to settings which depend on the current mode. Pressing up again simply restores the previous span and centre frequency.

The final feature of the current system was added after a chat with Ian, G0VGS; band stacking registers. In theory, band stacking registers are trivial to implement in software using macros to the K3. All I needed was a way of adding enough buttons to the Arduino to have one per band, without using up all of its input lines. A dedicated button controller with a keypad would have been one possibility, but I don’t have one with me, and there’s no chance of getting one shipped in. But wait! What is this thing before me with all of the letters and numbers on? A computer keyboard is, of course, a button controller with a keypad attached, and, to make things even easier, there is a PS2 keyboard library for the Arduino. A quick rummage around the dusty corners of the science labs and I had 102 buttons for my rig controller (plus modifier states!) for the cost of only 2 I/O lines (one clock and one data.)

With my button needs more than met it only took a couple of hours to implement band stacking registers, and would have taken a lot less if I hadn’t had to pause to re-learn some of the more advanced features of C (it’s been a while…)

The current implementation of all of these features is crude—still at the proof-of-concept stage, really—and the code is shamefully poor. So much so that I’m not going to post it here. However, the point is that it works, and that it’s possible to add your own useful features to your radio using only a cheap microprocessor board and some standard components.

As Amateurs, we all have to demonstrate at least a basic knowledge of electronics to gain our licenses, and many people are happy designing custom hardware for their station, or modifying off-the-shelf hardware to meet their personal needs. But why stop there? I suspect that everyone reading this uses some kind of computer-based logging for their home station now; rig control and logging is as much a part of the station as more traditional hardware, and there’s no reason it shouldn’t be as open to customisation. Modern radios and accessories like Elecraft’s offer powerful serial interfaces that make it easy to add useful features of your own to your station, without having to convince someone else that they are worth adding to the main radio firmware or that your personal interpretation is best. Microprocessor environments like the Arduino are cheap, incredibly powerful and very approachable; they can be programmed directly in C over a USB connection, without any need for dedicated PIC programmers or assembler.

So rather than saying “Wouldn’t it be great if…”, fire up your editor of choice and get coding!