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.

Retrotechtacular: ⋅⋅⋅⋅ ––– ⋅–– – ––– –– ––– ⋅–⋅ ⋅⋅⋅ ⋅ –⋅–⋅ ––– –⋅⋅ ⋅

There’s a lot to learn from this 1966 Army training film about the International Morse Code, but the most crucial component of good keying is rhythm. A young man named [Owens] demonstrates very clean keying, and the instructor points out that skill is the product of sending uniform and short dits, uniform and short dahs, and correct spacing between dits, dahs, letters, and words.

Throughout the film, there are title cards in a typeface that shows the stroke order of military printing. The instructor points this out after a brief interlude about the phonetic alphabet (Alpha, Bravo, Charlie, &c). Right away, we see that the Morse Code for ‘H’ is four dits that gallop with the rhythm of a horse in a hurry to get to the hotel.

big keySuch clever and memorable pictures are painted for a few other letters. We wish he would have covered them all, but that’s not the aim of this film. The Army is more concerned with good, clean rhythm and proper spacing that marks the difference between ‘low’ planes and ‘enemy’ planes. There’s a simple, three-step plan to getting what is called a ‘good fist’, and the Army demonstrates this in the best possible way: a giant J-38 and fake hand descending from the ceiling to match. Yes, really.

The first step is to adjust the key to ensure good contact alignment, proper gap spacing, and ideal spring tension. The second step is to develop good technique by resting one’s elbow on the table and holding the key rather than slapping it. The third step is simply to practice. Learning through imitation is helpful, as is taping one’s practice sessions and playing them back. [Owens] likes to use an RD-60 code recorder, which immortalizes his signals in ink.

Continue reading “Retrotechtacular: ⋅⋅⋅⋅ ––– ⋅–– – ––– –– ––– ⋅–⋅ ⋅⋅⋅ ⋅ –⋅–⋅ ––– –⋅⋅ ⋅”

A Wireless Web-Connected Morse Code Keyer

[Kevin] recently scored a Morse code keyer/sounder unit from the 1920s on eBay. While many hams would love to use an old keyer for CW, [Kevin] took a different route and repurposed it into a wireless web-connected morse code keyer.

[Kevin] mounted an Arduino Yun under the keyer, which listens for user input and provides web connectivity. The Yun connects to [Kevin]’s open-source web API he calls “morsel,” which allows it to send and receive messages with other morsel users. When a message is keyed in, the Yun publishes it to the API. When another keyer queries the API for incoming messages, the Yun downloads the morse sequence and replays it on the sounder.

[Kevin] also added some copper electrodes to the top of his enclosure, which act as capacitive buttons while keeping the keyer’s old-school appearance. The left button replays the most recently received message, and the right button sets the playback speed. Check out the video after the break to hear and see the keyer in action.

Thanks for the tip,  [Jarrod].

Continue reading “A Wireless Web-Connected Morse Code Keyer”

Morse Decoder’s Lean and Sexy Search Algorithm

Often the Morse Code centered projects that we feature are to help you practice transmitting messages. This one takes a tack and builds an automatic decoder. We think [Nicola Cimmino’s] project is well worth featuring simply based on his explanation of the Digital Signal Processing used on the signal coming in from the microphone. Well done. But he’s really just getting warmed up.

What makes this really stand out is a brilliant algorithm that allows conversion from Morse to ASCII using a lookup table of only 64 bytes. This provides enough room for A-Z and 0-9 without chance of collision but could be expanded to allow for more characters. Below is a concise description of how the algorithm works but make sure you take the time to read [Nicola’s] project description in its entirety.

The algorithm can be decribed as follows. Have an index inside the lookup string inizialied to zero. Have an initial dash jump size of 64. At every received element (dot or dash) halve the initial dash jump and then increase by 1 the index inside the lookup string if a dot was received and by dash jump size if a dash was received. Repeat until a letter separator is reached, at that point the index inside the lookup string will point to the ASCII corresponding to the decoded morse.

Have you heard of this technique before? If so, tell us about it in the comments below. Before you jump all over this one, realize that Magic Morse uses a different technique.

Transmitting Data Long-Distance with Morse Code

[Konstantinos] wrote in to tell us about his CDW project: a digital encoding scheme for ham radio that uses CW (continuous wave) Morse code for digital data transfer. [Link updated 1/5/16] CW operation with Morse code is great for narrow-bandwidth low-speed communication over long distances. To take advantage of this, [Konstantinos] developed a program that takes binary or text files, compresses them, and translates them to a series of letters and numbers that can be represented with Morse code.

The software translates the characters into sequences of Morse code pulses, and plays an audio stream of the result. His software doesn’t support decoding Morse from an audio stream, so [Konstantinos] recommends using one of many existing programs to get the job done. Alternatively those with a good ear and working knowledge of Morse can transcribe the characters by hand.

After receiving a broadcast, the user pastes received characters back in the software. The software re-assembles the binary file from the Morse characters and decompresses the result. [Konstantinos] also added a simple XOR encryption feature, but keep in mind that using encryption on ham radio bands is technically illegal.

City Lights Telling Stories

If you’re walking around town and you see a light suddenly start to switch on and off seemingly at random, don’t discount it as a loose wire so quickly. [René] has been hard at work on a project to use city lights of all shapes and sizes for Morse messages, and a way for anyone to easily decode these messages if they happen upon one while out and about.

The lights can tell any story that is programmed into them. The code on the site is written for an Arduino-style microcontroller but it could be easily exported to any device that can switch power to turn a light on and off. Any light can work, there’s even video of a single headlight on a van blinking out some dots and dashes.

The other part of this project is a smartphone app that can decode the messages using the camera, although any Morse code interpreter can translate the messages, or if you’re a ham radio enthusiast you might recognize the messages without any tools whatsoever!

The great thing about this project is that it uses everyday objects to hide messages in plain sight, but where only some will be able to find them. This is indeed true hacker fashion! If you’re interested in making your own Morse code light, the code is available on the project site.

Dots and Dashes… on a Roll!

morse code device

Morse code was once a staple of the communications industry, but with advancing technology it has become relegated almost exclusively to movies and a niche group of ham radio operators. [Jan] has created a device which might not put a stop to this trend, but will at least educate children on the basics of how Morse code works by visually displaying Morse code as it’s generated.

The setup is fairly simple. An old momentary switch (which could easily be used in an actual Morse code setup) activates two pieces of circuitry. The first is a 555 timer circuit that creates an audible tone when the switch is pressed so the user can hear exactly what an operator would hear when decoding a real Morse code message.

The second piece of circuitry is where the real genius lies: a continuously spinning roll of glow-in-the-dark tape is placed in front of a white LED. When the switch is pressed, the LED turns on, which produces dots and dashes on the roll of tape as it passes by. This eliminates the need for rolls of paper or a more complicated moving pen/pencil setup to draw on the paper which might also be less child-proof.

While [Jan] built this as a toy, the children who used it thoroughly enjoyed it! They even decoded some Morse code messages and used the device to practice on it. After a while they’ll easily be able to master the Morse code trainer!