Automating a manual antenna tuner

MFJ Versatuner with servo’s, a stepper and a Raspberry Pi

Automatic antenna tuners are expensive, manual antenna tuners are slow. So it has been a long time I dreamed of making my own automatic system.

As this year I was following a raspberry pi class and we needed to make our own project I decided to finally try to make this automatic tuner.

Summary:
– Forward and reflected power are measured with a Boxa Swr bidirectional coupler combined with an ADC
– SWR is calculated in the raspberry pi and displayed on an LCD
– When SWR is to high an alarm is sounded in CW
– after pushing a button the capacitors and the coil in the tuner are reset to 0. For the capacitors I use 2 servos, for the coil I use a stepper motor. All mechanical connections are made using 3d-printed parts. The reference point for the stepper motor is made using an infrared port.
– next is the tuning operation:
— the ‘transmitter’ capacitor is sweeped over it’s full range and swr is measured every degree. Then this capacitor is returned to it’s best position
— next idem for the ‘antenna’ capacitor
— sweeping operation is repeated for maximum 4 times, if the SWR is below 1,5:1 then tuning is stopped. If SWR is above this limit then the coil is moved to the next setting and the sweeping is repeated
– built in securities:
— all alarms on the LCD and in morse code
— alarm when SWR is to high
— alarm when tx-power is to high for tuning
— coil/stepper can not be switched when there is rf-power

Remarks:
– no tuners have been harmed in any way for this operation!
– Was the raspberry pi the best choice for this? This could probably have been done using some microcontroller instead but the class I followed wat not arduino or esp 32 🙂

Arduino Leonardo external keypad

Am I the only one finding it difficult to find the ctrl-alt-down key combination to tune to the next mult in N1MM+ logger when I am 30hrs into a contest?

This is the solution I made for it: an extra keypad that emulates these key combinations (or whatever key combination you want to program):

Arduino keypad closeup

Arduino keypad internals 1

2016-03-26 09.29.12

The core is an Arduino Leonardo with a 12 key keypad. These keypads can be salvaged out of an old phone or purchased online. Of course if you need less keys you can use pushbuttons also.

I printed the case with my Delta Rocket 3d-printer.

For the complete beginners with Arduino there is a lot to be found on the net. I found this Instructable very helpful.

This is a pretty easy project, the 2 hardest things are to figure out how the matrix of the keypad is to be wired and what keycodes you need to send to the computer.

In most helpfiles for the Arduino they say that the Leonardo sends ASCII to the computer but this is not true. In fact the Leonardo sends keycodes and they are based on the configuration of the ‘real’ keyboard that is connected and configured in Windows (or any other operating system I guess). As far as I could test the Leonardo uses the same keyboard ‘layout’ as the standard US QWERTY keyboard. So for us Belgians with our AZERTY keyboards it’s not as simple. I had to try out dozens of combinations before finding the correct ones.

For now this is the code I use (not all keys are implemented as of now):

/*
ON5MF/OQ6A Arduino Leonardo Keypad

I did not really 'invent' this myself, I only implemented stuff found on the net. Please feel free to use,
copy, enhance this code at your own will.

If you use it for commercial purposes I'd like to receive at least 50% of the gains ;-)

If you like the code or if you find some enhancements or improvements please let me know.

73 es have fun with it.

Jurgen ON5MF
www.on5mf.be
*/

/*
v001 = testing if keypad works
v002 = added ctrl-left and ctrl-right
v003 = next spot up and down
*/

/* keys and functions
 1  next spot up left radio   ! ctrl-left ctrl-up
 2  Escape                    ! esc
 3  next spot up right radio  ! ctrl-right ctrl-up
 4  next spot dwn left radio  ! ctrl-left ctrl-dwn
 5  back to CQ frequency      ! alt-Q
 6  next spot dwn right radio ! ctrl-right ctrl-dwn
 7  next mult up left radio   ! ctrl-left ctrl-alt-up
 8  turn rotator              ! alt-j
 9  next mult up right radio  ! ctrl-right ctrl-alt-up
 0  swap radios               ! alt-F5
 *  next mult dwn left radio  ! ctrl-left ctrl-alt-dwn
 #  next mult dwn right radio ! ctrl-right ctrl-alt-dwn
 */

//Libraries
#include <Keypad.h>
//----- end of libraries

//Constants
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
//----- end of constants

//Variables
//define the symbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3'},
  {'4', '5', '6'},
  {'7', '8', '9'},
  {'*', '0', '#'}     //ok
};
byte rowPins[ROWS] = {4, 9, 8, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 3, 7}; //connect to the column pinouts of the keypad
char ctrlKey = KEY_LEFT_CTRL;
char leftKey = KEY_LEFT_ARROW;
char rightKey = KEY_RIGHT_ARROW;
char upKey = KEY_UP_ARROW;
char downKey = KEY_DOWN_ARROW;
//----- end of variables

//initialise Keypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
//----- end o initialise Keypad

void setup() {
  Serial.begin(9600);
  Keyboard.begin();
}

void loop() {
  char customKey = customKeypad.getKey();
  if (customKey == '1') {
    Keyboard.press(ctrlKey);
    Keyboard.press(leftKey);
    delay(100);
    Keyboard.releaseAll();
    delay(100);
    Keyboard.press(ctrlKey);
    Keyboard.press(upKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '4') {
    Keyboard.press(ctrlKey);
    Keyboard.press(leftKey);
    delay(100);
    Keyboard.releaseAll();
    delay(100);
    Keyboard.press(ctrlKey);
    Keyboard.press(downKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '7') {
    Keyboard.press(ctrlKey);
    Keyboard.press(leftKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '*') {
    Keyboard.press(ctrlKey);
    Keyboard.press(leftKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '3') {
    Keyboard.press(ctrlKey);
    Keyboard.press(rightKey);
    delay(100);
    Keyboard.releaseAll();
    delay(100);
    Keyboard.press(ctrlKey);
    Keyboard.press(upKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '6') {
    Keyboard.press(ctrlKey);
    Keyboard.press(rightKey);
    delay(100);
    Keyboard.releaseAll();
    delay(100);
    Keyboard.press(ctrlKey);
    Keyboard.press(downKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '9') {
    Keyboard.press(ctrlKey);
    Keyboard.press(rightKey);
    delay(100);
    Keyboard.releaseAll();
  }
  if (customKey == '#') {
    Keyboard.press(ctrlKey);
    Keyboard.press(rightKey);
    delay(100);
    Keyboard.releaseAll();
  }
}

My current project

Ever tried to manually switch your antennas and bandpass filters 30 hours into a contest? I have been doing it for years. 🙂 (And I have been complaining about it for ages too)

But the solution is near:

band decoder 001 band decoder 002

This is the prototype for my new universal band decoder.

The hardware is an Arduino (in the pictures is a Mega, it will be replaced by a UNO r3 in the finished product) and 2 4×4 Driver Shields from Logos Electromechanical.

The goal is to switch my SixPak and my 2 Dunestar 600 band pass filters for SO2R.

The data comes from the pc (over the usb port) using the Open Two Radio Switching Protocol (OTRSP) which is supported by N1MM and DXLab logging software.

For now this is a work in progress,  so come back here soon to follow the evolution!

SO2R switchbox

I’m still working to get the station up and running for some SO2R in phone and digi. I started by looking for a way to switch audio and PTT for my 2 (oldtimer) transceivers (TS-50S and FT-990).

As a commercial controller seems to expensive to me for the moment I found a way to homebrew a *basic* switchbox myself. The layout is based on this one made by DL1IAO but with a few enhancements:

Continue reading SO2R switchbox