W5ALT Morse Keyer

W5ALT Morse Keyer

I wanted to learn how to design and use the PIC microprocessor chips from Microchip. I had played with the chips for a while, but never did anything useful. Finally I dug out my Kenwood TS-50S transciever and realized pretty quickly that it wasn't too easy to use without a keyer, especially when I was working pileups. Hence, I decided to design and build my own keyer based on the 16F84A chip. I don't claim that this is the best keyer ever, but I was able to design, program, breadboard and finish it in one weekend. Since then I've used the keyer on the air and it performs flawlessly.

The keyer circuit is actually very simple, with the PIC chip doing most of the work in software. Besides a 5 volt regulator (not shown) and the PIC 16F84A with a 4 MHz ceramic resonator, the keyer consists of a 2N2222 transistor, 2 10k resistors, a 1.2 k resistor, a 0.01 mmfd capacitor, a couple of switches and cables, and an LED that flashes when the CW is sent. The transistor is used as an inverter, so when the output bit on the PIC chip is set high, the keying line to the transmitter is grounded and vice versa. The LED is connected through the 1.2k resistor directly to a PIC output pin. A sidetone speaker can be connected directly across another PIC output pin and the program generates a square wave tone. I put a switch across the key output to be able to manually key the transmitter for testing and tune up. The dit and dah paddle outputs are connected directly to 2 separate PIC input pins, and another switch is used to put the keyer is speed adjustment mode. The keyer works nicely from a 9v battery.

Here is a picture of the breadboard circuit. I actually made a few on the air contacts with the breadboard and worked out a couple of bugs in the software. Once everything was checked out, I mounted the parts on a small piece of perf board and assembled it into a IR remote control plastic case from Radio Shack. I noticed that there appeared to be some RF getting back into the keyer, but a ferrite core on the key line to the transmitter cured that problem easily enough. Here's what the finished product looks like.

When the keyer is turned on, it will send an "R", signifying that it is "Ready". To change the speed, press and hold the SPEED ADJUST button. The keyer will begin sending alternating "dits" and "dahs". To increase the speed, tap the "dit" paddle. To decrease the speed, tap the "dah" paddle. When the speed is adjusted, release the SPEED ADJUST button and the keyer will send "R" signifying "ready". The speed parameters are saved in the EEPROM memory in the PIC chip, so when the keyer is turned on it will start at the same speed it was before it was turned off.

The "guts" of the keyer is really in the software. Here is the source code, in PIC assembly language. I don't claim that it is elegant or optimized, but it seems to work. Besides, with the chip running at 4 MHz, there's plenty of time to process "dits" and "dahs" and not too much incentive to optimize the code. The basic algorithm is to check the "dit" input and send a "dit" if pressed, then check the "dah" input and send a "dah" if pressed, then check to see if the speed adjust button is pressed. If not, then cycle back and do it all again. That's it - very simple.

All in all it was amazing how simple the keyer really is. I'm working on a way to add some software to make it into a memory keyer and will probably add another switch and software to record and play back characters when I have time.