Morse Code keyboard
Have you switched your QSOs to PSK31 or some other digital mode, but miss the joy of sending CW with an iambic paddle? Then here's a project for you.
Bill Ward (KD4ISF), Guy Dickenson (KD7TJJ) and Dave Clausen (W2VV) setup a club call sign N2YCR and a remotely operated computer station running fldigi for PSK31. The machine is in the backroom at NYCR and can be operated by members with general class amateur radio licenses from anywhere, using xvnc to display the fldigi application.
But operating it with a keyboard has none of the feel of an old fashioned QSO, so I designed an interface for Dave's BY-1 Bencher Iambic Paddle. Iambic paddles are very different from straight keys in that they have two inputs: one for "dit" and one for "dah". If an input is held in, it will repeat at a pre-programmed speed. If both are held in, they will alternate between the two symbols. Typically the dah is three time as long as the dit.
The paddle itself doesn't generate the code; this is the responsibility of the radio, or in this case, of the Teensy 2.0. It runs a state machine that listens for
<s>PIND4</s>PINB4 to be pulled low to indicate a dah, or
<s>PIND5</s>PINB5 to be pulled low for a dit. If neither is pulled low within the time of two dits, the current bit-stream is looked up in a table and if there is a valid USB keyboard event in the table it will be sent to the host computer.
With a straight key the computer would need to estimate the codes per minute and try to differentiate dits from dahs. But with the iambic paddle, the operator has input the separate symbols so there is no difficult step to determine the code. This makes it feasible to run the entire decoding stack in a small microcontroller like the ATMega32U4.
Sending CW without audio feedback is very hard, so a tone is produced via PWM on
OC0A at 498 Hz, directly into a speaker scavenged from an old headset. Software controls the volume in a crude fashion by limiting the on-time of the square wave. If the input sequence is not a valid Morse code, the timer 0 is switched to a slower speed, which causes
OC0A to be driven at half speed, or 249 Hz, which will indicate an error tone.
Full source for the Teensy is available for your own use. It should appear as a generic USB keyboard and work with any application.
The case is made using my laser cut box generator and thing:17901. I cut it using 6mm clear acrylic at 100% power, 4% speed, and etched the raster at 100% power, 20% speed. The box is a friction fit and holds together without any screws or glue.
Some possible improvements are to have an external potentiometer to control the speed of the CW (currently it is a compile time constant), and to create a USB serial device that translates its input into audio so that you can have a full CW QSO with fldigi.