AVR Butterfly Keyer

The Atmel AVR "Butterfly" is a credit card sized board which contains an AVR MEGA169 processor, a six character LCD display, a five way joystick navigation switch, a piezo speaker, a 3 volt lithium battery cell for power and a few other odds and ends. The board is available from Digi-Key for $21.95 (part number ATAVRBFLY-ND), making this a reasonably inexpensive project. The board comes assembled, so you only have to add a few wires to make it work.

The "Butterfly keyer" program converts the Butterfly demo board into an Iambic keyer which can decode and display the characters you send using the paddle. This forces you to have proper letter and word spacing, otherwise the letters will not decode or there will be no spaces between words. One of the most common errors both Novices and Old Timers alike make when sending Morse is running their letters and words together, so its hard for someone trying to copy your sending to tell when a letter stops or a word starts. The Butterfly keyer can also help you with learning to copy Morse code, as it can send random 5 character groups, then display the characters so you can check your copy. The keyer also features selectable 5 to 40 wpm code speeds in 1 wpm steps, selectable A or B Iambic modes and two 63 character message memories.

Reprogramming the Butterfly demo board:

The stock demo firmware which comes loaded in the Butterfly board needs to be replaced with the keyer program. This is done using the built in "boot loader" and a PC with a serial port. A DB-9 connector is wired to the Butterfly board and connected to a PC with a standard null serial cable. (see diagram at bottom of page) The actual file transfer is performed by a sub-program included in the Atmel AVR Studio 4 development suite. The Studio 4 program is a free down load from www.atmel.com. It's a rather large file, (37 Megs), so having access to broadband would be good. The procedure for re-programming the Butterfly is contained in the Studio 4 help files, the Butterfly user guide (down load this from Atmel also) and in the Butterfly programming tutorial. Both the .hex file needed to be programmed into the board and the .asm source code are located in a zip file. The source code can be edited and modified using Studio 4 if you want to learn or know assembly language programming of the AVR processors. Click here to down load zip folder.

Keyer Operation:

Once the Butterfly board has been reprogrammed with the keyer program, the program is started by pushing the joystick switch [LEFT]. The letter "R" will appear on the left hand side of the display and the letter "R" will sound. The keyer is now ready for use. There isn't an "off" switch, so the keyer will go into a very low power sleep mode after about 2.5 minutes of inactivity. A beep sounds and the LCD goes blank when this happens. The keyer will “wake up” as soon as the paddle or one of the joystick switches are used. All settings and what was on the display are restored when the keyer wakes up. If the keyer is not being used for an extended period of time, it would be a good idea to remove the battery.

You can now send code with the paddle and hear the side tone as you send. All letters, numbers and some punctuation are decoded and displayed. If a group of code elements are not recognized, a blank space will appear. Due to limitations of the LCD, some of the letters look a bit odd and only the most commonly used punctuation characters { , . / ? + } are recognized. A period is displayed as a { ^ }. After completing a character, you have to pause sufficiently long for the processor to recognize a letter space before it will appear on the display. Same goes for a word space. The first character sent will appear on the right hand side of the display and then be shifted to the left as subsequent characters are sent.

Selecting Options:

Pushing and holding closed the joystick switch to the [LEFT] will scowl through several available options. When the option you want to use appears on the display, release the switch. The selections appear in this order:

CSxx - select code speed, where xx is the current code speed.
TUNE - this allows toggling the transmitter on and off using the paddle.
E-MEM - for entering messages into the memory.
CP-RDM - starts sending random 5 character groups for code practice

I MODE Toggle between Iambic A or B modes
KST-ON / KST-OFF Toggles side tone on or off for transmitted characters.

Code speed:

Use the dash paddle to increase speed and the dot paddle to decrease speed. A beep will sound each time the speed is changed and the selected code speed is displayed. Code speeds of 5 to 40 wpm can be selected, in 1 wpm increments. The code speed select option will be automatically escaped after about two seconds if a paddle isn't closed. It can also be escaped by pushing the joystick button [IN].

TUNE:

This mode is used when you want to get a power reading or adjust an antenna tuner with a steady carrier. Tapping the dash paddle toggles the transmitter on, tapping the dot paddle toggles the transmitter off. To exit and return to normal operation, push the joystick [IN].

E- MEM:

This option is used to input messages to one of the two message memories. Each message can be up to 63 characters long and include word spaces. If you accidentally enable this option, push the joystick [IN] before using the paddle. If you want to enter a message, key it in with the paddle. When you are done, push the joystick [IN]. The message will repeat so you can check for errors and hear how it sounds. If you notice any mistakes or otherwise wish to re-do the message, push the joystick [IN] again. If you want to store the message as is, push the joystick [UP] to store it in Message location 1, or push the joystick [DOWN] to store it in Memory location 2. Once the message has been stored, normal keyer operation is resumed.

Sending a message:

Push the joystick [UP] to send message 1 and push the joystick [DOWN] to send message 2. If a message has not been stored in that location, nothing will happen when you push the joystick. As a message is being sent, it can be stopped or paused by using the paddle. Holding the dash paddle closed will pause the sending of the message while holding the dot paddle closed will end it.

CP-RDM:

Releasing the joystick when this message is displayed will start the sending of random five character groups. Both numbers and letters are sent. First, a group of five characters are sent by the side tone. After a short pause, the characters sent appear on the display, so you can see if you copied them correctly. After another short pause, the next group of characters is sent. This is repeated until this mode is escaped, by pushing the joystick [IN] during the pause between character groups.

I MODE

When enabled, the currently selected Iambic mode will be displayed A MODE or B MODE. Click the joystick button to the [LEFT] to toggle between the modes. Push the joystick button [IN] to return to normal operation.

The difference between Iambic A and B modes:

Iambic keying means that when you close both paddles, alternating dots and dashes are sent as long as you hold both paddles closed. The difference between A and B modes is what happens when you release the paddles. In A mode, the keyer simply stops sending. In B mode, and extra and opposite code element is sent. So, when in B mode, if you release the paddles while a Dash is being sent, a Dot will be automatically inserted before it stops sending. This allows you to release the paddles a little earlier when sending some characters such as R, K and C. However, when sending a simple letter such as A and N, you need to be careful not to accidentally send a R or K.

KST-ON / KST-OF:

This option toggles the side tone on or off, depending on its previous state. If it was off, KST-ON will appear and the side turned on, and visa-versa. This option allows turning the side tone off when the keyer is used to key a rig, which generally generates it's own side tone. Non-transmitted characters are still annunciated by the Butterfly's side tone.

Connecting the keyer to a rig:

In order to key a rig, a transistor or MOSFET has to be wired to the keyer output pad on the Butterfly board. A 2N7000 is a good choice for the MOSFET and the gate (G) can be wired directly to the keyer output pad. (S is ground and D is output) Any NPN transistor can also be used, such as a 2N3904 or 2N2222, etc. In this case, a base resistor is required. The value is not critical. A 2.2 K should be sufficient. A higher value could be used if the transistor does not have to sink much current from the rig. See figure 1 for the keyer output pad location.

External side tone connection.
If you use headphones a lot, you might want the side tone to come out of the rig instead of the speaker on the Butterfly board. Figure 1 shows the location of the side tone output port on the board. This is a 3 volt square wave. This signal can be wired to the audio amp of your rig, through a simple R/C low pass filter as shown in Figure 1, to round up the square wave to make it sound better and to reduce it's amplitude. The value of R2 and/or C2 can be increased if even less signal level is needed.

Using external switches:

If you mount the Butterfly board into some kind of enclosure, accessing the joystick switch might be a problem. I have yet to locate a suitable switch cap for this switch. All the switch connections come out to the header pins on the Butterfly board. Refer to the Butterfly User Guide for their locations. A row of larger push buttons can be wired to these points. De-bounce caps of 0.01 ufd might be required across these switches if they have a lot of bounce to them.

Using external power:

While the button cell battery on the Butterfly will power it for a goodly long time, external power can be used. Figure 1 shows where external power can be applied to the Butterfly board if it is desired. The maximum voltage is 3.5 volts. Exceeding this may damage the processor. The battery should be removed if external power is used. A pair of "AA" batteries would power the board for a very long time.

Figure 1 Hook up diagram for Butterfly board