I recently decided to build another project, this time involving morse code and the arduino.
I took a standard Arduino UNO, an LCD keypad shield, a relay module and a piezo buzzer. Total cost was under $25
What does it do?
Well it can send morse cq’s or any morse message to the onboard piezo or the relay for connection across a radio key. It has the ability to adjust the speed and timing of the morse. It demo’s the morse alphabet. You can decide it you want to use the relay or not. It can save the settings to the onboard EEPROM and keep them on power off.
Step 1: Do a Little Soldering..
There's really not much to do here, just solder the piezo buzzer wires to the LCD keypad shield. The black wire to ground and the red wire to pin 11.
I also added a small relay $2 so I could clip it across my morse key. I gave it 5 volts and ground and then it's input pin to pin A3 on the arduino.
Then i hot glued everything to everything!
All done on the hardware front.
Next up , software.
I believe in trying to do it your self, so you can learn first. Once you’ve tried it your way, head over to the web and see how the programmers do it! I decided to look around the web.
One example i saw, had left or right scrolling through all of the functions, looping back around to the start. One variable, the program number, incremented or decremented by the left and right keys. Much smarter,simpler and good enough for what i was trying to do here, keep it simple for me and if anyone else wanted to use it.
So that’s pretty much how the code goes.
I browsed around the web trying to improve my programming skills, as this was probably the hardest code I had written to date. I learned somewhere along the way that good practice was to write out all your comments first, then fill the code in later.
// here is where the setup will be
// here is where we will define all the variables
// This is the routine that converts a letter into dits and dahs
// this is where the menu code will live
And so on. I added a notes section that described the programs way of working. And i added a TO DO list, for example;
add press any key to abort
change pitch of morse key sound
add numbers and special characters
maybe reduce system to one key, short press advances menu, long press to use
provide ability to enter a custom message ie callsign direct from the keypad
beacon menu support
serial control or ethernet if possible
special sounds? psk replies??
A todo list was something that i later found to be an invaluable way of adding things that needed to be fixed.
There have been ten revisions so far, each one adding more capability to the device, I hope the code can be improved further still. There’s even a bit of silly stuff thrown in there for fun.