- Amateur Radio (Ham Radio) Community

Call Search

New to Ham Radio?
My Profile

Friends Remembered
Survey Question

DX Cluster Spots

Ham Exams
Ham Links
List Archives
News Articles
Product Reviews
QSL Managers

Site Info
eHam Help (FAQ)
Support the site
The eHam Team
Advertising Info
Vision Statement

[Articles Home]  [Add Article]  

Making the Butterfly Beep

Ulrich H. Steinberg (N2DE) on August 28, 2005
View comments about this article!

Making the Butterfly Beep

If you have read one of my more recent articles you have probably concluded that I spend most of my waking hours thinking about keys and the design aspects of the perfect paddle. That's, of course, absurd - I'm not that parochial. I also think a lot about computers and how they could help me create Morse code. :-)

Actually there wasn't any good reason to do that until quite recently. I already own the keyer that I consider the best on the market (although it went out of production about 10 years ago), the AEA MM-3 MorseMachine. But then I stumbled across something that just cried out to become part of the ultimate keyer, with features that the MM-3 couldn't dream of.

Imagine a pretty powerful microprocessor that can be programmed in C or Assembler, that has 512K of non-volatile (EEPROM) memory, a LCD display, a joystick for user navigation, a small piezo speaker for sound, a real time clock, all the circuitry to interface it to a PC, that has analog and digital inputs to hook up paddles and your transmitter and a speed potentiometer, and that can even measure the temperature in your shack and monitor its own battery voltage. Now imagine this thing is about half the size of a credit card and runs on a lithium knob cell. It is called the AVR Butterfly evaluation board. And what really dropped my jaw: you can buy it for $20 from Digi-Key, and you need nothing besides free software and a simple serial connection cable to start developing applications for it - the programmer hardware and firmware that you normally need for microprocessors are already on the board. (Although, for a project of this complexity, you probably want some prototyping and debugging tools - ECROS Technology is an excellent source with bargain basement prices.)

0x01 graphic

I mean, every sensible human being has to see immediately that this has to be molded into a Morse keyer (Although in the meantime I have begun to imagine some applications that might be more profitable … Unfortunately, in real life, I do nothing that even resembles this sort of work, and I probably can't pursue that)

One choice to make was the programming environment for my first tentative steps. The C programming language might sound like a convenient choice, but the Assembler development environment that you can download from AVR is VERY slick, and when you are programming a processor like this you are dealing with low-level hardware interaction, and at that level something written in C doesn't look very different from Assembler code. ( … and, of course, I grew up at a time when high-level languages were for wimps and real programmers used binary toggle switches ) Also, this little gem has 16K of program memory - actually less than that - and I wasn't too sure how much code space my germinating ideas would use up. So, Assembler it was - something I hadn't done in a LONG time.

This is what I wanted to create, hoping that somehow I would discover all the necessary ingredients as I went along: a full-featured keyer with

  • Self explanatory user navigation using the LCD display

  • Iambic modes A and B, bug emulation, and a hand key hook-up

  • Configurable analogue and digital speed control

  • 24 hour clock/calendar function

  • Two selectable user profiles

  • Intelligent messages with call/name insertion, repeat, local speed-up, etc., that survive even with a dead battery

  • Automatic serial numbering for contests

  • Compensation for shortened first elements in Morse characters due to t/r switching delays

  • Tuning function that uses a pulse train or a constant key-down

  • Maybe some random trainer modes if space permits (the AEA MM-3 has several fantastic trainer modes and simulators, but I really don't need those)

  • AND … so far, only a few novelties if you throw all other keyers on the market into a pot and stir a bit, but then:

  • Automatic logging of at least 10,000 QSO's with real-time checking for duplicates and the capability to upload that information to a PC in ADIF format.

That logging capability in a self-contained device smaller than the palm of my hand was too tantalizing to not try. After all, this thing has 512K of memory which is far too much for a regular memory keyer. If I were to use this for canned messages only we're talking 70 hours of CW text at 25 wpm - hardly something that is normally needed. On the other hand, if each of my two user profiles had their own generous space for messages, say 90 minutes of CW at 25wpm in total for both, I could store the usual information for 12,000 QSO's in the remaining space. And with a fast search and compare algorithm I was hoping to be able to detect a prior QSO with a station in real time. (As a selectable option I am also comparing band/call, like for most contests, with an option to automatically reject a duplicate by sending “DUP” in CW)

The trick for an automatic logger of this kind is to make the program logic smart enough so that it “understands” in a typical exchange that the last word you sent is the other fellow's call or his/her name. Fortunately CW QSO's have some set patterns: if it sees you sending “ xxxx DE [YOURCALL]” and xxx contains at least one numeral, then it's a safe bet to assume that xxxx is the other station's call. Or if it sees “ RST yyy” and yyy has a total of three characters, starts with a digit between 1 and 5, and the remaining two positions are either digits between 1 and 9 or N's, then you can be pretty sure that yyy was the signal report. Actually there's a lot more to that, and this is where real creativity is asked for.

Although I eventually opted to not create special trainer modes for copying practice, it became a very nice training device anyway. In order to make it “understand” what you are sending it obviously has to translate your dits and dahs into characters that it keeps in a scrolling buffer. Initially, for debugging purposes only, I displayed the tail of this buffer on the LCD, creating a scrolling “ticker tape” of what you are sending - but it looked so cool that I kept this as a display option. And that, of course, lets you see minute timing mistakes that are barely audible, like when you don't use proper spacing between words and run them together. Actually, I had to cut a little slack and allow some deviation from perfect timing at higher speeds. It becomes very difficult to create characters like “A”, where you switch paddle sides, and still maintain the perfect spacing between the dit and the dah, although that minutely longer space may sound fine. But I'm digressing into the technical nitty-gritty. The bottom line is that this really is a nice trainer with immediate feedback to improve your keying skills. That visible feedback also comes in handy when you are wondering why it wasn't able to extract the call or the RST from your outgoing transmission: you probably paused too long between characters and inserted a word space, or you ran two words together with too little spacing - after all some of the logic relies on analyzing words, and it will fail if your word spacing deviates too far from perfection. My ego, at least, was a little deflated when I realized how sloppy my fist was on occasion.

How can you possibly do all that and more with such a small and inexpensive device? The answer is: processing power. I run it at 8 million instructions per second, the maximum without special circuitry. Now, 8 million doesn't sound much when you're a politician spending taxpayer money, but it is an awfully large number. Let's put this into perspective: if you had a vehicle that was magically powered by this processor and each of the instructions moved that vehicle by 0.01 inch - barely visible to the human eye. Then you would be moving along at about 6 times the speed of sound, faster than any speeding bullet or jet plane. (I had to check this several times because intuitively it sounds so improbable) So, 8 million instructions per second are plenty if you can dedicate them to a single task and don't have the overhead of a fancy operating system. The main limitation to your creativity will typically not be processing speed, but the 16K of program space. And actually that is surprisingly large, too, if you're using Assembler and a well designed RISC instruction set.

Let me tell you where I stand with this work-in-progress and about some of the challenges that I had to overcome.

At first glance you tend to think that the Butterfly has plenty of I/O channels (analogue and digital) to hook up the paddles, a numeric keypad, a speed pot, and produce output to key a transmitter. But then you realize that many of those ports are used for devices that you can't give up: the LCD display, the piezo speaker, the joystick. Actually you'll discover that there's not a single I/O pin that is not already being used. This is an evaluation board, and the engineers used almost everything there is for demonstration purposes. That's where the fun starts.

It was easy enough to provide a serial interface to a PC to download settings and to upload the log in ADIF format. (Sorry, but for a USB interface even 8 million instructions per second is not fast enough. But then, USB-Serial adapters cost only a few dollars and work fine.) This saves a few headaches because you don't enter or edit your recorded messages on the keyer, but with a regular text program of your choice on the PC, and then download them. That's not only convenient, but it also saves a lot of code in the keyer.

The paddle is hooked up to some of the same ports as the joystick. While you are keying you obviously don't need the full navigation capability of the menus, so this imposes few restrictions and actually allows you to use the joystick as a key if you really want to. But this type of keyer also needs a numeric keypad so that you can select messages for it to play, and, for the built-in log, to enter some information like RST and serial number that you receive from the other station. After all this is not a decoder for received signals … Wow, here's an idea: The fully automated operator - all you'd have to do in the morning is to roll out of bed and check whether you've made the DXCC Honor Roll yet. Fortunately that's probably illegal and would require a processor a tad larger After some trial and error I found an inexpensive ($9) numeric keypad for a PC, and a way to hook it up to the Butterfly. Initially I wanted to combine the Butterfly and the keypad into a single device, but after playing around with it for a while I like the ability to put the keypad right next to my hand and place the Butterfly display in eye sight. Here's the Butterfly on a test board together with its companion devices:

0x01 graphic

As you can see, I need very few external components in addition to the Butterfly - mainly connectors, the power supply, the speed pot, and a circuit to key the transmitter. That also means that I had to take a soldering iron and remove components and attach wires to a board that uses surface mounted components that you can barely see. This is not for the faint hearted, especially if they don't have a 10x magnifier and a tiny soldering iron, and the whole project is definitely not an Elecraft kit at this time (now, here's another idea: Wayne, Eric, are you out there?) But it's not a complicated project with dozens of parts, either.

Does it work as a smart keyer? The answer to that is a resounding YES - I am actually using this prototype regularly for real QSO's to further refine it, and I was surprised that I don't have problems from stray RF despite of all those exposed and unshielded guts (…I'm running ladder line right into my shack). Although I haven't had the opportunity to actually log 12,000 QSO's on it, I have refined the search algorithm so that it can scan that number in less than a second for duplicates and display the other fellow's name and the date of the previous QSO or, optionally, reject the QSO. The worst case is obviously when this is QSO number 12,000 and a new contact, and it looks through 11,999 QSO's to determine that fact - this is what takes about 0.8 seconds. If it finds a match, the time can be much less, down to virtually the blink of an eye - actually it usually is less than the time of the beep (0.3 seconds) that I let it emit if a match is found. This kind of performance can only be achieved in Assembler language, and when you think of it looking through thousands of QSO's in a fraction of a second, it boggles the mind. (In case you're technically inclined: I am using an interrupt-free pipeline approach that overlaps the actual reading of a byte from storage with operations on the previous byte. This requires that you keep an exact count of processor cycles, which you can only do in Assembler)

At this time, this is a very fancy CW keyer with a logging function that extracts some of the information that it stores in the log by “looking at” the CW you send, complementing it with information that you enter with the keypad. Since I am supporting a full-size keyboard, too, instead of the numeric keypad, it wouldn't be too difficult to create a very small self-contained logger for other modes of operation. (Although the keyboard looks gigantic next to the Butterfly - there might even be enough space inside most keyboards to put the whole Butterfly keyer in there.)

Trying this seemingly impossible feat with a $20 device has been a lot of fun, although this is still a work in progress. I almost wished I could do this kind if thing for a living. :-) If any of you intrepid readers would like to participate in polishing this thing further, please drop me an email: The software side of things is well under control, although some additional testing by someone less familiar with it can never hurt - there must be some bugs in over 5000 lines of compact Assembler code that I haven't found yet. And maybe one of you can help me with the mechanical packaging, so that the finished product looks as good as it performs.

I have been thinking about a good name for this keyer for some time, and I actually wanted to call it the MorseMachine. But, talking to TimeWave, the legal successor to the old AEA company that produced the MorseMachine keyers, they objected to letting me use that name although it's not a registered trade mark. So I decided to find something better. This is a key(er) with beautiful features and a large amount of memory, isn't it? So what else could be the name: it's the Key Largo.

73, Ulrich, N2DE

Member Comments:
This article has expired. No more comments may be added.
Making the Butterfly Beep  
by KG4RUL on August 28, 2005 Mail this to a friend!
OK, you got my interest. I have already ordered one and am planning to integrate it into an Az/El rotator control project.

Dennis KG4RUL
Making the Butterfly Beep  
by N4ZOU on August 28, 2005 Mail this to a friend!
This thing is slick! I downloaded some of the application sheets and found many other ways to use this device. One thing that came to mind was a nice little automatic control box for the remote tuner on my Butternut HF vertical antenna. Years ago I had it connected to an old XT computer that would read the data port on my IC-761 and drive a stepper motor connected to the capacitor out on the antenna and automatically step the capacitor to a position listed in a lookup file that was created manually by stepping the motor one step and checking the frequency with the lowest SWR reading. This worked very nice! As you would tune around 40 or 80-meters in receive the old computer would drive the capacitor so the antenna was always ready to provide a low SWR on transmit and instantly available. This would keep the received audio peaked as well. It was like having the ultimate wide bandwidth antenna connected to your transceiver. The old XT computer was a pain to maintain and so I quit using it and returned to manual operation of the remote tuner. This device is small and self-contained with a display and best of all, cheap! I can now return to fully automatic operation of my Butternut vertical and using the same setup would allow control of a screwdriver antenna as well. Imagine your screwdriver antenna adjusting it's self as you tune the dial looking for contacts! No more fidgeting around with the up and down switch and trying to get the SWR set or even moving it around trying to find the place where the audio peaks out as it's always at the proper position! Adding an SWR indicator to the display would be easy as well just as a double check and make fine-tuning available for changing conditions around the antenna that effects it. Thank you for this wonderful article! I hope I don�t go broke buying these things for different projects!
RE: Making the Butterfly Beep  
by LNXAUTHOR on August 28, 2005 Mail this to a friend!
and don't forget one of KD1JV's AVR projects, a digital SWR/Power meter:

although i also really like his LED version, here:

happy homebrewing!
Making the Butterfly Beep  
by K7ESU on August 28, 2005 Mail this to a friend!
I've had one of these little things sitting on my desk at work for the past 6 months. It is a cute demo board. I consider myself a creative engineer, but the idea to use it as a keyer...I bow to your greatness! This could be really fun. Thanks,

Making the Butterfly Beep  
by W2BLC on August 28, 2005 Mail this to a friend!
Yes, technology is great - but, I still like my pencil, lined paper, and a straight key or paddle. I must be old fashioned or a stick in the mud.
Making the Butterfly Beep  
by KW4N on August 28, 2005 Mail this to a friend!
Great article! For those of us that don't have the time or interest in developing this unit, here's a super alternative: go to the K1EL site and look at his K40 keyer. It's all most of us will ever want or need.
All the programming is done. Has a great Echo CW trainer. You can even order a 2x16 display. Documentation is excellent. A box is coming shortly (I build mine in a candy can)
Separately, check out his Winkey and other cool stuff.
Dave, KW4N
RE: Making the Butterfly Beep  
by N2DE on August 28, 2005 Mail this to a friend!
All the programming is practically done on this one, too, since I submitted the article. Certainly there will be minor changes as experience from other users comes in - this is a far more comprehensive device than any of the PIC keyers, especially with the built in logging function that no other stand-alone device has. The documentation is nearing completion, too, and is about 45 pages by now. All that really needs to be done is to package this device in a decent box and put the few external components on a pc board.
RE: Making the Butterfly Beep  
by K0BG on August 28, 2005 Mail this to a friend!
This article is worthy for any amateur publication, and certainly a goodly number of technical publications as well. Thank you for sharing it with us.

Alan, KØBG
RE: Making the Butterfly Beep  
by N2DE on August 29, 2005 Mail this to a friend!
Looking at your post again I realized that I misread your comment about the K1EL keyers already being programmed. One strong point of this device is that "programming" it means running a free utility on your PC that loads software into it through the serial connection that you need anyway. Unlike any of the PIC keyers you can easily upgrade the software yourself when new versions become available.
RE: Making the Butterfly Beep  
by WA6BFH on August 29, 2005 Mail this to a friend!
A very nice article!

I also appreciate that you encourage Hams to heat up that soldering iron!
RE: Making the Butterfly Beep  
by W0FM on August 30, 2005 Mail this to a friend!
Amateur radio at its best! I love the smell of solder in the morning.


Terry, WØFM
Making the Butterfly Beep  
by NT4XT on August 31, 2005 Mail this to a friend!
I can't get over the size of it plus the ability to log 12,000 Q's, and do everything an Idiom K-3 does plus have a clock AND calendar function (without my watch I rarely know the date).
Awesome article. Okay, I've scraped my lower lip off the floor and resituated my dislocated jaw now.
Amazing. Yes, ham radio at it's best.
Making the Butterfly Beep  
by NE1OB on September 2, 2005 Mail this to a friend!
Great article! It inspired me to immediately order a
Butterfly from Digi-Key which already arrived.
I hope to turn this into a morse code trainer.

Take a look at for an alternative
bread boarding system for the Butterfly.

Making the Butterfly Beep  
by KI4IXU on September 6, 2005 Mail this to a friend!
Hmmmm... the ultimate RTTY/PSK-31 HF reciever the size of your pocket! This has AMAZING possibilities!
Making the Butterfly Beep  
by W8LV on September 8, 2005 Mail this to a friend!
I have thought a good deal about this as well. I think that there is a 'basic stamp' out there now that plugs into the usb port--very handy! You could also use your same key/bug setup to send CW "ON" the internet (with the free "CW communicator") programme!
It seems like the 'ultmate turnaround' to me when you can plug in your key into the Internet via such a setup.
Basic stamps could do a lot of jobs in and around the shack, and the price is right!
RE: Making the Butterfly Beep  
by KG4RUL on September 8, 2005 Mail this to a friend!
My Butterfly finally flew in! I played with it for a day then ordered the carrier from Ecros. When on-line the order was completed, the printable invoice informed me that they were on vacation until 19 September. You wish they would tell you that up front.

The Atmel website indicates that there is development support in Pascal for this device. Unfortunately the Pascal compier is a $500 item and there is no free/shareware compiler. Even the Basic support, not my favorite language by a long shot, is pricey.

However, in spite of it all, my Az/El rotator controller project is still on the front burner. Perhaps, if it turns out well, I may submit it to QST.

Dennis KG4RUL
Email Subscription
You are not subscribed to discussions on this article.

My Subscriptions
Subscriptions Help

Other How To Articles
RFI Mitigation in Rheem RGFG High Efficiency Furnace