Morse De-Coder

1,305

7

Introduction: Morse De-Coder

About: I'm Dan, hobbyist and maker of things.

Everyone has heard of Morse Code, but does anyone actually remember anything other than SOS (...---...)?

This device simply decodes Morse Code into the correct letters and numbers. Use it however you like - whether that's practicing at home, or trying figure out what that flashing torch on a distant hillside is trying to say. You never know, it might save a life!

Supplies

1x BBC micro:bit

1x Computer to upload program

1x MakeCode Website (https://makecode.microbit.org/#editor)

Step 1: Write Program

This program is written using the easiest programming language ever: MakeCode. It's simply a case of dragging blocks into place. The browser-based software then turns that into javascript, and then into the machine code itself. All you have to do is download it to the micro:bit and your code runs.

Even better, the software provides an emulator that shows exactly what the code does. You can interact with this as you would a physical micro:bit, then use it to test and tweak your code. By the time the code is uploaded to the actual device, all your troubleshooting is already complete.

The software isn't perfect, carrying out more complicated tasks isn't straightforward, but it gets the basics done.

I've designed this device to buffer button presses and figure out what Morse Code character it is. It uses two arrays - one holds the input code in the form of 1's and 0's (replacing dots and dashes), the other holds the output characters (A-Z,1-0). If no match is found, it shows a simple instruction page - dot on the left, dash on the right.

Once the buffer reaches more than 5 dots or dashes, it resets to start the next character. The other way to reset is by pressing both buttons together.

Step 2: Test Program

Use the emulator to test the program. It allows you to rapidly change code if something doesn't work.

The only thing I missed was recognising the first character in the array. I'd forgotten that the first position in an array is 0, not 1. All I did was add a result that'll never get reached as position 0.

Step 3: Download and Upload Program

Simply download the program from the website, then upload it into the micro:bit. Simples.

Step 4: Run It!

You already know it'll work thanks to the emulator, but it feels so much better once it's in your hands. Test it, press all the buttons to see if it performs as expected.

Step 5: Use It!

Get practicing your Morse Code! See if you can decode the dots and dashes of a distant flashing torch. Or if you're not on a hillside, how about trying this for starters:

.... . .-.. .-.. --- / .-- --- .-. .-.. -..


Step 6: Future Developments

The best project is an unfinished project. Here are some things to add in the future:

  • 3D printed case
  • Actual computer keyboard output, for the advanced Morse Coders out there.
  • Full morse code recognition, including timings and spacings.
Micro:bit Contest

Participated in the
Micro:bit Contest

Be the First to Share

    Recommendations

    • Raspberry Pi Contest

      Raspberry Pi Contest
    • Knitting and Crochet Speed Challenge

      Knitting and Crochet Speed Challenge
    • Anything Goes Contest 2021

      Anything Goes Contest 2021

    Comments