Converting Morse Code To Text With Arduino

Morse code used to be widely used around the globe. Before voice transmissions were possible over radio, Morse code was all the rage. Nowadays, it’s been replaced with more sophisticated technologies that allow us to transmit voice, or data much faster and more efficiently. You don’t even need to know Morse code to get an amateur radio license any more. That doesn’t mean that Morse code is dead, though. There are still plenty of hobbyists out there practicing for the fun of it.

[Dan] decided to take a shortcut and use some modern technology to make it easier to translate Morse code back into readable text. His project log is a good example of the natural progression we all make when we are learning something new. He started out with an Arduino and a simple microphone. He wrote a basic sketch to read the input from the microphone and output the perceived volume over a Serial monitor as a series of asterisks. The more asterisks, the louder the signal. He calibrated the system so that a quiet room would read zero.

He found that while this worked, the Arduino was so fast that it detected very short pulses that the human ear could not detect. This would throw off his readings and needed to be smoothed out. If you are familiar with button debouncing then you get the idea. He ended up just averaging a few samples at a time, which worked out nicely.

The next iteration of the software added the ability to detect each legitimate beep from the Morse code signal. He cleared away anything too short. The result was a series of long and short chains of asterisks, representing long or short beeps. The third iteration translated these chains into dots and dashes. This version could also detect longer pauses between words to make things more readable.

Finally, [Dan] added a sort of lookup table to translate the dots and dashes back into ASCII characters. Now he can rest easy while the Arduino does all of the hard work. If you’re wondering why anyone would want to learn Morse code these days, it’s still a very simple way for humans to communicate long distances without the aid of a computer.

34 thoughts on “Converting Morse Code To Text With Arduino

    1. Yes the guy who created the Arduino Enigma Machine has rewritten his code to incorporate Morse code creation, but only to be produced on a speaker, as sending encrypted data over Ham Radios is against the law. I had contacted him interested in a learning tool for hams. I though it would be great to have the Arduino Enigma create Morse code for the encrypted output to drive a small led or speaker.

  1. Other advantages of Morse Code:
    Morse Code transmitters are some of the simplest to build
    …as are receivers for Morse
    The human brain is a pretty remarakble signal processor, of which Morse Code takes good advantage
    Best throughput with least complexity and power…if the message has to get through, Morse is a good choice
    Very economical on bandwidth – many Morse conversations can be held in a limited amount of spectrum
    Simple, elegant and fun.

    1. There are plenty of digital modes that works better in weak signal conditions then CW today.
      But with that said, it is the most effecient signal that the human brain can encode/decode, and the complexity of the equipment is as low as it gets.
      Unless you need an arduino to decode it :D

  2. Why learn morse?

    If you are interested in building your own radio transmitter CW is the easiest way to start. I’m really struggling to learn Morse myself and so I have attempted to start right out with SSB instead. I even bought a kit, how hard can that be? It is hard.

    On the other hand… Check out the Michigan Mighty Mite. http://goo.gl/UsYACq
    That’s a real easy build and yet some people have made it 100s of kilometers with them! If I ever get confident enough to actualy go on the air with Morse code then I will start building CW radios of increasing complexity and work my way up to voice. But.. meanwhile… I’m not giving up on that voice transciever either. I guess it will depend a lot on which I get to first!

  3. “Nowadays, it’s been replaced with more sophisticated technologies that allow us to transmit voice, or data much faster and more efficiently.”

    I guess that depends on your definition of “efficiently”. When it comes to transmit power efficiency, Morse is still very high on (if not at the top of) the list. That’s how people can communicate globally using QRP (<5W power output) radios.

      1. In cases of high-technology failure (zombie apocalypse or something more likely, war or natural disaster for example) Morse code is still usable because of it’s low-tech nature. So it is a very good thing to know for extreme survival situations. I think it will never be outdated or replaced.

  4. I am a ham radio operator who struggles to use Morse code. I have used automatic reading devices, but the ones I’ve used don’t work very well on real-world weak signals which have static in the background. The reason? They seem to determine the presence or absence of a tone by the volume of the audio received. The ear, on the other hand, determines the presence or absence of tone based on the spectral purity of the signal received. The ear easily hears the difference between a tone and a static crash. It’s a lot more difficult for a computer to do that, if the computer is working strictly on the volume of the audio. A key thing the ear picks up is not only the presence of noise of the proper frequency, but the relative absence of noise of other frequencies. I’m not sure how to make a machine do a good job of that, but I suspect the solution might involve some DSP and FFT work.

    It’s not too hard to build a Morse reader that works well with a strong signal in a low-noise environment. It’s a lot harder to outperform an experienced human ear with weak signals on noisy bands, but those tough conditions are precisely where Morse has its biggest advantage over voice.

    –… …– -.. . .- –. -…. –.- .-.

    1. The ear is not only good at picking out whether there’s a clear tone, it’ll pick out from several. *I* can’t do this, but wizard-level HAMs can have a half-dozen conversations sharing a transmission frequency, with different tones for each sender, and be able to pick out only the one they want to hear.

      1. You can do this, and have–if you’ve ever talked to anyone in a crowded room. Brains are pretty good at that sort of signal processing. You’re a wizard too, you just need a little practice.

    2. A way to go is to use a teensy, make an fft and look at the frequency (range) where you except the morse signal. A magnitude threshold gives you the tone. With 86 updates / second there is enough bandwith for detecting the short tones.

      Or use a bandpass first to reduce noise.

      Should the FFT be somehow too slow a implementation of the Goertzel algorithm will help (Has anyone done this so far? I didn’t find anything on it).

  5. CW Skimmer will decode up to 700 morse code signals at once.

    It can be used with a standard sound card audio input or attached to an SDR receiver for wide bandwidth reception.

    When CW Skimmer decodes a callsign, identifying a particular station, it can be sent to the Reverse Beacon Network</a., where other ham operators can look to see who is on the air right now.

    On Sunday, RBN decoded 930,812 (total, not unique) callsigns. I guess someone must still be using Morse code. The bands were active with a contest and a DXpedition to Navassa Island.

  6. When I was a wee lad, I remember doing CW decoding with an LM567 tone decoder chip, and writing code in BASIC on a 8088 PC clone to monitor the output of the IC and print text to the screen. I remember struggling to get it to calibrate itself well enough by listening to a few dits and dahs before attempting a decode. It didn’t work well for the average fist, but worked great for machine-sent CW which wasn’t common back then. Long before DSP and it was a pretty fun project for a budding coder.

  7. Just use an NE567 to detect the CW tone. Then you can “tune” it to hone in on a specific stream of morse at a specific audio frequency and eliminate a good bit of the superfluous noise.

    1. Also it appears that the conversion only occurs if the code is being transmitted at a specific rate. Let’s see a scheme to deduce the rate and adjust the algorithm accordingly.

  8. Wow for an article that is in no way anti-Morse, it’s certainly treated like it is. where CW was used for radio communications and no longer is Morse has been replaced and is effectively dead,and it being used more now than ever than before is impossible. mostly likely will never be replace in the amateur radio service, but I’m insure how the characterization CW is now being used more now in the amateur radio service, than it ever was can be backed up.

  9. Morse code is not king anymore.. WSPR can get further in worse conditions and less power, It’s almost magical.
    Where Morse code wins is that it’s a digital mode that humans can easily learn so all you need is a radio and you can transmit/recieve a message.

    WSPR requires the radio, a PC, the OS, software, and an interface to the radio to function.

  10. Modern digital modes, like WSPR, are very impressive in their weak signal capacity. There is, however, one thing that Morse code has than none of these other modes will ever have: the feeling of accomplishment that comes from mastering a skill. In this area, Morse code is like playing a musical instrument, learning a second language, or training for a marathon. It has advantages of simplicity and reliability, but it is also something we do to challenge ourselves and have fun in the process.

Leave a Reply to staticCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.