Morse Code

Introduction

Ever wanted to send your friend a secret message? Now you can, with CodeBug! You can send Morse Code messages with CodeBug using its LED, music blocks and buttons.

You will need
CodeBug CodeBug
Micro USB cable
Computer
Crocclips
OR Headphones
Buzzer
10k ohm potentiometer (optional)

1 Question

How it works

Morse Code is like a dictionary for letters to be spelt out in dots and dashes. Every letter has a unique sequence of these dots and dashes so you know which letter is being sent. Dots are created using small pulses and dashes with large ones.

Dots and dashes are used in combination because if you just used dots, then for each letter to have a unique sequence, you would have to have letter codes with up to 26 dots, this would take too long to transmit and people would almost certainly lose count! By using dots and dashes, Morse Code can represent all the letters with a maximum sequence length of just four, so even though a dash is 3 times longer than a dot, representing characters is still quicker than just using dots.

Morse Code is used with a number of different mediums such as: radio, telegraph and spotlights. It was invented in 1836, it played a major part in World War II communications and is even still used today!

Although we are transmitting simple messages made of dots and dashes, you can unknowingly transmit more information than you intended. In the second world war, people intercepting enemy military messages could tell which operator was sending the message based on the length of time they held down the telegraph tapper (a morse code ‘accent’, if you will), which meant they could tell when an operator was pretending to be someone else.


  • Ask a new question:

Morse Code Alphabet

The Morse code alphabet is rather simple, each of the letters A to Z and 0 to 9 have their own unique dot-dash code.

The Morse sequences for characters from the alphabet seem to be quite random and do not seem to follow any logical order, but there is method behind the madness! Alfred Vail realised that if you gave more commonly used letters shorter sequences - ones with fewer symbols and using more dots than dashes - then most messages would be shorter.

Try counting the frequency of the different letters in this sentence to see what letters are used the most and the least. Judging from the lengths of the Morse character codes above, E, I and S should be among the most used, and Y J and Q among the least, if used at all!


  • Ask a new question:

Morse Code timing rules

There are rules to help people distinguish dots from dashes in Morse code.

  1. The length of a dot is 1 time unit.

  2. A dash is 3 time units.

  3. The space between symbols (dots and dashes) of the same letter is 1 time unit.

  4. The space between letters is 3 time units.

  5. The space between words is 7 time units.


  • Ask a new question:

Writing your program

You can make a Morse code generator with a few simple blocks. Follow the tutorial below to program your very own Morse code generator.


2 Questions
  • I tried this, and ran in to a snag. The LEDs would change with the button pressing, but the sound was a constant note. I tried messing around with it, but as I don't know much about code, I was not able to find a way to make the sound depend on the button being pressed as well. Any suggestions? I hope this makes sense. Kaden Kirkham @ May 1, 2016, 6:40 a.m.


    Answer this question:

  • Same problem here! Constant beep, but the lights only flash when button A is pressed. So we can morse code in light, but the beep is constant. Cornelia @ June 16, 2017, 11:23 a.m.


    Answer this question:

  • Ask a new question:

Attaching your noise maker

You can make noise with CodeBug using a sounder or headphones/speakers and crocclips. First connect a black crocclip to the GND leg on CodeBug and a coloured crocclip to leg 0 on CodeBug.

To play the noise through headphones or a speaker, clip the black crocclip that is connected to the GND leg, to the metal part of the headphone plug that is closest to the plastic cover. Now connect the coloured crocclip to the tip of the headphone plug. There should be a middle metal part of the plug that is not touching either crocclip.

Warning: This will be very loud, do not put the headphones into your ears.

To play noise through a sounder, connect the black crocclip to one leg of the sounder and the coloured crocclip to the other leg of the sounder.


  • Ask a new question:

Controlling volume

You will find that the volume of the noise will be too loud when using headphones. You can change the volume by adding a resistor in series between leg 0 and the headphone tip. Larger resistor values will make the music quieter.

If you want to be able to vary the volume, you can add a potentiometer. Make sure you have followed this activity on using potentiometers. Disconnect your coloured crocclip from your headphones/buzzer and connect it to the power leg of the potentiometer. Now connect another crocclip from the output leg of the potentiometer to the tip of the headphone plug (or free leg of the buzzer). Finally connect the ground leg of the potentiometer to the GND leg on CodeBug.


  • Ask a new question:

What next

Try encrypting your messages by shifting the Morse alphabet, so that the code for A (dot and dash) is what you use for B instead, and shift all the rest down by one too.


  • Ask a new question:

Back to top