Morse code was the breakthrough that made possible long-distance
communication in the era of the telegraph. The code represents
alphanumeric characters by short and long intervals of signal -- those
familiar dots and dashes. For many years passing a Morse code test was a
prerequisite of getting a Ham license, but nowadays most radio amateurs
use it only infrequently. No longer are ship-to-ship distress signals
sent in Morse, as was the famous CQD (dah-dit-dah-dit dah-dah-dit-dah
dah-dit-dit) transmitted by the sinking Titanic's radio operator in 1912.
Still, Morse remains important for signalling distress,  if only by a lost
hiker blinking a flashlight into the lonely, dark night.

Hacking the Arduino as a Morse code trainer is fairly straightforward.
All you need is a blinking light, such as a high-intensity LED, and a sound
source, say a mini piezo speaker, to provide the beeps. Rounding out
the project is an LCD display to show the character being beeped/blinked.

The goal is to beep and simultaneously display the letters, numbers,
and a few important punctuation marks in ordered sequence. Following
this, do 50 random letters. Then, have the entire routine repeat.
The combination of beeps, flashes, and LCD display serves as an
effective tool for memorizing the Morse code.

I built this project as an Arduino shield, using an Adafruit protoshield
blank board. It will likewise work with most of the commercially pre-built
16x2 LCD shields or even just breadboarded. The hardware consists of
an 8x2 or 16x2 LCD wired to the Arduino in conventional fashion, an LED,
and a piezo speaker. Most of the actual work is done by software.

I used point-to-point wiring, otherwise known as "haywiring," a
venerable technique lost in the mists of antiquity. Before the mid 1950s,
virtually all electronic devices were built this way, and by humans,
not robots or automatic devices.

This is how the completed project works:


Step 1: What you'll need to build it


blank protoshield board (Adafruit and Sparkfun sell nice ones)
8x2 LCD, type JHD802A-2 (the kind with no backlight preferred)
  [This project will work just as well with a 16x2 LCD,
   with one change on line 105 of the sketch.)

1 high-intensity LED
  (Doesn't need to be the ultra-bright variety.
   A "clear" LED works just fine.)

1 cheap piezo beeper
(All Electronics sells a plastic-encased one for $1.50,
which is nice and loud and non-polarized. Catalog # SBZ-26.)

1 220 ohm resistor
1 47 ohm resistor
Very nice! I built one of these with a 16 X 2 LCD and not only does it work beautifully but now I have a really good working LCD shield for other projects too. Most of the other shields you buy mount the LCD accross the shield and it hangs off both sides. Your's is a much cleaner build. Thanks.
<p>honestly i cant reat ... it is too slow to get the rithm is there an adjust ment to make it faster to 5 words a minute?</p>
<p>Excellent project with great instructable. Thank you</p>
Thank you for the praise.
I have several (hopefully constructive) comments regarding your code, including algorithm, use of memory, constants and code simplification. Interested?
Sure, why not? I don't know if I'll adopt your suggestions, since an Arduino<br>sketch is by no stretch of the imagination elegant code that might be submitted<br>to a professional journal. It's more like a quick-and-dirty back-of-the-envelope<br>hack just to get things working.<br><br>I think you'd find, if you compare my sketch to others, that's it's reasonably<br>well-structured and maintainable. Note also that since I've placed it in the<br>Public Domain, that you or anyone else is permitted to alter and distribute<br>your own version without restriction.
Hopefully my comments are informative and &quot;instructive&quot; they are not meant as a criticism nor an &quot;I can write it better:&quot;<br> <br> 1) The algorithm, that is the basic idea, which breaks up the symbols into categories ( numeric and alphabetic) sounds like a good idea. However, since the space between the categories is small, rearranging the table (numbers, then alphabetics) and combining them, makes a big difference in the complexity of the code. The fact that there are a different number of &quot;tones&quot; (i.e. the letters take a maximum of 5, numbers always 5) is overshadowed by the need to create additional tables ( strings) defining the categories. This also avoids specifying a category to play_letter. You should try to keep nomenclature consistent (morse, Alpha, ALPHABETIC) (I suspect the differences has to do with the way you developed the code)<br> <br> 2) Some of the code is replicated for each category. For example within the play_letter function: each category contain a statement that increments the variable i ( I cannot seem to get the plus plus into this reply!).<br> Although this may seems like nit picking, when later modification are made it is easy to forget to include code that is common to all cases.<br> <br> 3) Not sure why you made the numbers [20][6] rather than [10][6] ? (Maybe also from code &quot;evolution &quot;)<br> <br> 4) int s are 2 byte variables, better idea for the table to use CHAR. You could even test for a '.' or a '-'.<br> <br> 5a) &quot;Define constants&quot; are, well, constant and so should be declared using const . Even better use PROGMEM. This is applicable for any strings or tables.<br> <br> 5b)Then there is the DEFINE issue. (This concept is under active discussion within the arduino community at this time. )<br> The compiler directive<br> #define ccc vvv<br> does not allocate ANY space in target memory. When the compiler encounters the string ccc in the source it substitutes vvv.<br> This is significant since the code that can be generated for a small valued DEFINEd constant can use the immediate instruction that does not reference memory(other than the instruction) and are twice as fast. These include Load, Add, Subtract, Compare, AND and OR Immediate as well as instructions for setting or clearing bits. Similarly, I/O to pins can be handled better if the pin is DEFINEd. This allows the compiler to construct instruction. With ints the value needs not be retrieved from a memory location and the instruction &quot;built&quot; at execution time as in the case of pinSpeaker, pinled. This is not applicable for tables.<br> <br> 6) Size considerations mentioned are especially important if the code is extracted and added to another program as a means of error reporting using LED_BUILTIN (that is my intention)<br> <br> 7) Calculating &quot;constatnts&quot;. If dashlen is twice a dot than have the CODE say so, i.e. dashLen =dotLen*2<br> <br> 8) Are you familiar with the tone() function ? http://arduino.cc/en/Reference/Tone Why did you use mikegrb's code instead?<br> <br> Please reply or Private message me with comments or questions.<br> <br> Where did you find values for punctuation? Are there values for other symbols?<br> <br> Where did you find enum?<br> <br> I am still finishing up a version which takes these thoughts into consideration and will post it when I have it completed.
&gt;&gt; Where did you find values for punctuation? &lt;&lt;<br><br>Standard Internation Morse Code, per Wikipedia.<br><br>&gt;&gt;Where did you find enum?&lt;&lt;<br><br>Standard ANSI C.<br><br><br>&gt;&gt; Why did you use mikegrb's code instead? &lt;&lt;<br><br>Because it works.<br><br><br>&gt;&gt; I am still finishing up a version which takes these thoughts into consideration and will post it when I have it completed. &lt;&lt;<br><br>You have my best wishes.<br>
I think you ment 2012<br>Reldate: 04 March 2102<br><br>Question: Why is the dashlen = 2 * dotlen <br>&quot;Not the standard dash = 3 x dot length!&quot; ?
Yes, probably 2012. Will maybe release 99th update in 2102<br>if still around.<br><br><br>&gt;&gt; Question: Why is the dashlen = 2 * dotlen &lt;&lt;<br><br>I tried 3 * dotlen to start with, but it just didn't sound right.<br>2 * sounds more natural. If you like 3 * or something else,<br>you can easily enough edit the sketch to match your preference.<br><br>Thanks for your comment.
Nice idea! I think is the sister of mine https://www.instructables.com/id/The-useless-but-mazing-QR-clock/
Not the sister, but maybe second cousin.<br><br>Like your project, too.

About This Instructable



Bio: hobbyist, tinkerer, old curmudgeon
More by thegrendel:The HacqueBoard The Arduino / TFT LCD Connection Using an In-System Programmer 
Add instructable to: