loading
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
<p>Here is my version (for situations when conservation of memory IS an issue). Transmits a stored message over and over again by simply flashing the built in LED on Arduino Nano or Digispark.<br>I have used a struct to encode dash-dot sequence for each letter in a bit field and the number of symbols for each letter:<br>struct mc {<br>unsigned char dd;<br>unsigned char len;<br>};<br>Using something like<br>struct mc {<br>unsigned int dd:6;<br>unsigned int len:3;<br>};<br>performs the same, using exactly the same amount of memory (because we need 6+3=9 bits for each letter) and the produced code is even slightly longer.<br>The Morse equivalents of all the letters are stored in an array<br>const struct mc mrs[] = { // right to left bit encoded, 1=-; 0=. , only len rightmost bits valid<br>...<br>/* A = &quot;.-&quot; */ { 0b000010, 2},<br>/* B = &quot;-...&quot; */ { 0b000001, 4},<br>/* C = &quot;-.-.&quot; */ { 0b000101, 4},<br>...<br>Here is the <a href="https://goo.gl/JFNHZ2" rel="nofollow">sketch</a> file. Feel free to use it or comment.</p>
<p>Check my version, Android controlled ^_^ <a href="https://youtu.be/_eryK1NHz8Q" rel="nofollow">https://youtu.be/_eryK1NHz8Q</a></p>
<p>i keep getting this error</p><p>In file included from sketch_sep22a.ino:1:</p><p>C:\Users\cc-electronics\Desktop\Arduino\libraries\Morse/Morse.h:10:22: error: WProgram.h: No such file or directory</p>
<p>This is because the library is made for old IDE. You should go to the library path (C:\Users\cc-electronics\Desktop\Arduino\libraries\Morse) and replace in Morse.h and Morse.cpp &quot;WProgram.h&quot; with &quot;Arduino.h&quot;</p>
<p>great job</p><p>i created a site to translate text to morse so it is just copy paste</p><p>http://blueeye.dk/?page_id=39 and scroll to the bottom</p>
<p>by the way if you add a 0.5w LED you can see it 800m away......</p>
<p>Check out my blog post at http://jamestav.blogspot.com/2013/03/arduino.html?spref=bl. I made a morse code device that uses the serial port in the Arduino IDE. Feel free to use the code and mash it up with this code</p>
<p>you need to change the Wprogram.h include in the CPP and H file to Arduino.h</p>
Cool. Never knew you could make custom libraries! I made a &quot;hello&quot; message manually:<br> <div> <pre> /*This&nbsp;program&nbsp;has&nbsp;a&nbsp;buzzer&nbsp;hooked&nbsp;up&nbsp;to&nbsp;Pin&nbsp;11. (My&nbsp;buzzer&nbsp;fit&nbsp;right&nbsp;between&nbsp;GRD&nbsp;and&nbsp;11,&nbsp;so&nbsp;I&nbsp;used&nbsp;that.)*/ int buzzerPin=11; void <b>setup</b>() { &nbsp;&nbsp;pinMode(buzzerPin, OUTPUT); } void <b>loop</b>() { &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(1000); //....(H) &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(1000); //.(E) &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(500); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(1000); //.-..(L) &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(500); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(1000); //.-..(L) &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(500); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(500); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(200); &nbsp;&nbsp;digitalWrite(buzzerPin, HIGH); &nbsp;&nbsp;delay(500); &nbsp;&nbsp;digitalWrite(buzzerPin, LOW); &nbsp;&nbsp;delay(5000); //---(H) } </pre> </div> <br> To do:<br> Right-Click,<br> Copy as HTML<br> IN THE EMBED VIDEO DIALOG:<br> Paste
<p>how had u done for it not to repeat????</p>
void setup() runs once, void loop() loops.
Typing the code up like that seems like a lot of work. I made a morse code translator where you type out the message on the serial monitor send it to the arduino where it translates the message to morse code and an led flashes the message.
see here code. <br> <br>https://docs.google.com/document/d/1ieZq9nmCgYaISdEErRhkbx4r5UvNKsEg7bXtgpPOLnI/edit
The video doesn't work
Nice job! Now, if someone could create a tone detector with an arduino, A program I adapted from an old MBASIC program, would go the other direction! (convert Morse code received off a radio, to ASCII text.)<br>
I gave it in BASIC for PICAXE... they are very cheap chips.<br><br>https://www.instructables.com/id/Morse-Code-Magic-An-Algorithm/<br><br>I've been to busy to convert to an Arduino lib, but should be straightforward. <br><br>BTW, there are a number of Magic Morse posts on Instructables... one even uses the algorithm in &quot;reverse&quot; to send the temperature as a number.<br><br>- Ray
Great work I mean really great XD I am following
Nice Project, but i have a few questions:<br>When I paste the SOS code from step 5 and I verify it, it says: <br><br><br>In file included from sketch_mar06a.cpp:1:<br>C:\Users\Doede\Desktop\Arduino\arduino-1.0\libraries\Morse/Morse.h:10:22: error: WProgram.h: No such file or directory<br><br>I have downloaded the .zip and placed it where I have to.<br>What can I do?
You are using arduino 0.1 I also had problems with it switch back 0022 or 0023 and you will be fine
Thanks, I downloaded both 0022 and 0023. This time, when verifying, there where no errors, but when I tried to upload it gave me this message on both versions:<br><br><br>Binary sketch size: 1362 bytes (of a 32256 byte maximum)<br>avrdude: stk500_getsync(): not in sync: resp=0x00<br>avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51<br><br>(btw, this is my first arduino project, thats why I don't get it ;) )
I suspect you havent installed the drivers so do it a step by step screenshot's can be found be <a href="http://arduino.cc/en/Guide/UnoDriversWindowsXP" rel="nofollow">here</a>.I had the same error when I tried my first arduino program but then I realized I had to install the drivers.!
I thougt that I allready installed the drivers, I'll do it again tonight.
Great work so far, but rather than morse.dash(); morse.dash(); morse.dash(); why not have a function in the library with a list of characters and do morse.print(&quot;Save us! Save us now! OMG we are sinking!&quot;); and let the library do the rest?
Great Project!<br><br>oh, the song is Britney Spears - Till the World Ends
Patched
Great work mate, <br>Check make projects, they've got something about morse code too. :)

About This Instructable

66,309views

82favorites

License:

Bio: Preapering for my medical entrance exams
More by Bot1398:555 Crriter Repellent Solar Powered Clock Hack DIY Astronomy Flashlight 
Add instructable to: