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();
  }
}

Do you really want to pay €49 to be able to program your (mobile) radio through your computer?

For years I have been struggling to manage the 1000 memories on my FT-7800 mobile radio. Memory channels, subtones, memory banks ==SIGH==

Recently a friend (thanks Jan ON4KB) gave me the kit he bougth from Yaesu for the FT-8800 and of course, the cable was correct for my FT-7800 but the software didn’t work ==shame on you Yaesu!==.

That’s when I decided to get some help from Google and I found CHIRP, a free, open-source tool for programming your amateur radio. It supports a large number of manufacturers and models, as well as provides a way to interface with multiple data sources and formats.

I tested it for my radio and it works very well indeed! Downloading the data already in the radio, modifying it on the pc and uploading it to the radio again all in a breeze!

CHIRP supports over 60 different radios from 5 or 6 brands (including the ‘big’ ones of course) and is available for Windows, Mac and Linux.

Programming cables can easily be found on Ebay (for some €12) or you can make your own.

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!

Designing antennas using a genetic algorithm?

A few days ago I found a nice piece of software on the internet: BoxCar 2D. This is a way to design a car using a genetic algorithm: a population of cars is created at random and then tested on a track chosen by the user. Then the best cars ‘mate’ to get a next generation. Together with a set mutation rate the cars improve over the generations.

Warning: watching this is addictive, it’s far better than television!

My programming skills are rather limited but I wondered if someone maybe could design antennas using one of the (mini)NEC engines and this genetic system?

Update: it seems that this is not such a new idea, at least for developing antennas. A little googling for ‘genetic algorithm antenna’ gave me some 160000 results 🙂

SuperNec seems to be great software for this but at $6080 it seems I’ll stick to Eznec and MMANA for a while.

Pretty frustrated after EU PSK63 QSO Party

I quit…

Or at least my PC forced me to by deciding to let me down about 0630hrs in the contest. Due to a for now unknown reason  the N1MM-loggerFldigi combo froze and I had to reboot the PC. But, after rebooting and starting Windows XP, both displays stayed black. After some trying (rebooting multiple times, disconnecting and reconnecting all cables,…)  I could get an image on only one of the displays but in the wrong resolution. Setting the resolution back to the correct values again gave me a black screen. This time I could not get back to the one working screen any more so after about an hour I decided to quit the contest. Yes I know, winners never quit, quitters never win… but it’s pretty hard to work a digi-mode contest without a computer, don’t you think?

but I learned a lot… Continue reading Pretty frustrated after EU PSK63 QSO Party