Introduction: Arduino Morse Code Flaher

About: Preapering for my medical entrance exams
I am a big fan of programming but I like to keep it down to 555 timer but when it comes to complex functions like flashing a LED in a certain pattern programming is necessary.One day while surfing through the I came across something known as Morse code.I decided to read it and found it totally awesome.I tried to make it with an arduino and I was successful in doing so. And now here that project explaining what I did.This is a low cost fun to do project suitable for beginners ;it also requires minimal parts.

This instructable will explain how to create the circuit ,making a shield for the arduino,making some changes,displaying custom messages and how to install the Morse code library.

This instructable is a entry in the arduino contest so if you like it please vote.

Here is a short video of it in action:


The first message that it displays is the SOS the second that it displays is HI and the third message that it displays is HELLOW.You can see the LED blink for three or four times in between the message this means that a new code has been uploaded and a new message is been displayed.

Step 1: Morse Code

Morse code is a method of transmitting textual information as a series of on-off tones, lights, or clicks that can be directly understood by a skilled listener or observer without special equipment. The International Morse Code encodes the ISO basic Latin alphabet, some extra Latin letters, the Arabic numerals and a small set of punctuation and procedural signals as standardized sequences of short and long signals called "dots" and "dashes" respectively, or "dis" and "dahs". Because many non-English natural languages use more than the 26 Roman letters, extensions to the Morse alphabet exist for those languages.
Each character (letter or numeral) is represented by a unique sequence of dots and dashes. The duration of a dash is three times the duration of a dot. Each dot or dash is followed by a short silence, equal to the dot duration. The letters of a word are separated by a space equal to three dots (one dash), and two words are separated by a space equal to seven dots. The dot duration is the basic unit of time measurement in code transmission.In the picture you can see the Morse code for each alphabet and number.

Step 2: Parts & Tools

Parts-
~ 1 x LED (color optional) - Sparkfun.com
~ Arduino Board - Sparkfun.com
~ 330 Ohm Resistor - Sparkfun.com

Tools-
~ The arduino programming Environment - Arduino.cc
~ USB Cable A-B - Sparkfun.com
~ Soldering Iron - Sparkfun.com
~ Solder Wire - Sparkfun.com

The price will be about 0.60 $ assuming that you have a arduino and all the tools and if not it will be about 47.95 $ (Quiet expensive)

Step 3: Built the Circuit

We have collected all the parts we need now lets make the circuit.The circuit is pretty straight forward (it could also be the simplest circuit you have ever seen) connect the longer lead of the LED (i.e the positive terminal) to digital pin13 and the shorter lead of the LED (i.e the negative terminal) to the gnd pin of the arduino(located besides the digital pin13) you need not connect a resistor as there is already a resistor connected to the digital pin13 or you can use the LED attached to digital pin 13 on the board itself. See the last picture for the fritzing diagram.

Step 4: The Library

Now having built the circuit its time to upload some code to our arduino but besides that I have also included the Morse code library (the reason why some of you are reading this).Now lets start up and install our library (fun eh) and upload some code.

To install your library first, make a Morse directory inside of the libraries sub-directory of your sketchbook directory. Copy or move the Morse.h and Morse.cpp files into that directory. Now launch the Arduino environment. If you open the Sketch > Import Library menu, you should see Morse inside. The library will be compiled with sketches that use it. If the library doesn't seem to build, make sure that the files really end in .cpp and .h (with no extra .pde or .txt extension, for example).

I have included a downloadable folder which you have to just paste in your libraries folder.

Screenshots are also included so that you can easily install the library.The location of the arduino folder in your computer maybe different.

The example codes are included in the library just open file>examples>Morse and choose your desired message that you want to display(see the last screenshot).If you want to display any other message other than that in the library feel free to ask or just make it yourself.

Step 5: Displaying Custom Message

We can display a custom message on the LED using the Morse code library (The library makes it easy to make your own messages).Refer to picture on step two to see the morse code for every alphabet and number on the basis of that type "morse.dot()."to display a dot on the LED and type "morse.dash();" to display a dash on the LED.To make your own code follow this format:

#include <Morse.h>

Morse morse(13);

void setup()
{
}

void loop()
{

}

Enter your code between the curly brackets after the void loop()

We will consider the example of flashing SOS the letter S consists of three dots so we write "morse.dot();" for three times The letter 0 consists of three dashes so we write "morse.dash();" for three times again the letter S has 3 dots so we write "morse.dot();" for three times and everythings done and your code for flashing SOS in morse code is ready.

#include <Morse.h>

Morse morse(13);

void setup()
{
}

void loop()
{
  morse.dot(); morse.dot(); morse.dot(); // The letter S consists of three dots
  morse.dash(); morse.dash(); morse.dash(); // The letter O consists of three dashes
  morse.dot(); morse.dot(); morse.dot(); // The letter S consists of three dots
  delay(3000);
}

The library itself contains four examples
1. SOS
2. HELLOW
3. HI
4. BOT1398

To open the examples open file>examples>Morse and choose your desired message.In the video on the first step you can see three different messages been flashed.

Step 6: Testing

To test your circuit plug the arduino into the USB port and program your arduino for any message(Eg-SOS) you can use the USB port for powering your arduino or you can use a 3.5mm jack to power it.(NOTE: the voltage from the 3.5 mm jack should not exceed 9v DC) after powering the arduino the LED at digital pin13 should start blinking in different patterns.A short blink means its a dot and a long blink means a dash.We take the example of SOS the message SOS in morse is something like this- dot dot dot dash dash dash dot dot dot.So the LED will give three short blinks then three long blinks and again three short blinks.See the video on step one and you will get the idea.You can also see the video directly on youtube.

Step 7: All Done!

Hope this project inspires further experimentation. The Arduino board is incredibly versatile,cheap, and accessible to all hobbyists . This is just one of many simple projects which can be constructed using the arduino. Keep pondering!. Don't forget to follow mores comming up!!. For any queries leave a comment me or send me a PM or mail it to me at r1398ohit@gmail.com

Arduino Challenge

Participated in the
Arduino Challenge