Morse Code Blinker

posted Dec 12, 2014, 11:42 AM by Gord Sellar   [ updated Dec 12, 2014, 11:57 AM ]

Lately I've been working on some different projects with each of you. I figured that, until you manage to meet up and try collaborate a little, this page could be useful for you to try one anothers' sketches. I'll post a few sketches created in collaboration with each of you, so you can experiment. 

Today, I'm posting the sketch I did with Taein/Tommy. We worked on the Blink sketch/circuit, which just makes the Arduino blink a light following a pattern. Taein and I wondered whether that blink could be used for a purpose... and of course, it can! 

So we put together a Morse Code Blink sketch. 

The Circuit: 

You just need to build the same circuit from the Blink sketch tutorial on the Arduino.cc Learning page. The Blink sketch itself is here, and here are the Fritzing diagram and circuit schematic for it:

I'm pretty sure I've done the blink tutorial with all of you, so this should be easy to build. 

Here's the trick: instead of programming the light to blink regularly, we're going to program it to blink in patterns... the pattern, in fact, is Morse Code. You can read more about Morse Code at Wikipedia. The short version is, it's a code that was used to send messages through telegraph wires before phones were invented. You can send a message without any speaker or microphone, by coding letters into patterns of dots and dashes (short beeps and long beeps). 

Translating a message to Morse Code can be easy and fun, but if you want a shortcut, there are websites that will do the translating for you automatically. Here's one of those websites... and it not only translates your message, it can also play a sound sample of what your Morse Code message will sound like. Just remember not to include any punctuation!

For example, in Morse Code, ARGH (아이고~!) looks like this:

.- .-. --. ....

Taein and I decided we'd code a sketch with the Morse code for ARGH. We also decided to use the following rules:

  • dots are 100 milliseconds long, and so are the spaces between every dot and dash
  • dashes are 300 milliseconds long
  • the spaces between letters are 150 milliseconds long
  • at the end of the whole message, there's a 2-second pause before it repeats again. 
We didn't include a space between words. You don't need it anyway: if you look at this message, you'll see the different words easily:


... so we don't need spaces between words. 

Anyway, once we decided that, it was easy: all we had to do was try remember the 150 millisecond pause at the end of each word. (It's tricky.) We started, first, with an even simpler code: SOS. (SOS is the old signal that was used on ships to call for help.)

In Morse code:
  • S is three dashes. 
  • O is three dots. 
So SOS looks like this:

--- ... ---
That's easy to code. See the sketch attached below, titled Taein_s_Morse_Code-SOS.ino, for an Arduino code for an SOS blinking light. You can download it and load it right into your Arduino and try it out! 

Taein's homework is to completely code DO YOUR HOMEWORK. If he finishes the coding, we'll share the sketch here!

Things To Try:

There are a few things you can try, once you've mastered coding messages in Morse Code:

  • Try build a circuit with a beeper, so that the Arduino causes the beeper to beep the dots and dashes of your message, instead of (or along with) blinking a LED. 
  • Try coding messages in SKATS mapping, which is the Korean version of Morse Code. 
  • Try build a Morse Code decode that uses a light sensor and time measurement to catch the message, decode it, and display it on a screen (or on your computer). 
  • Try build an interface with your computer, where you type a message, and the Arduino takes the message, translates each letter to Morse Code, and then sends a signal to your friend's Arduino using a light or sound. (Warning: this is a huge project. You'll learn a lot, but you should try this much, much later. Don't start with this!)
That's it for the Morse Code blinker sketch... at least until Taein gives me a sketch for the coding of DO YOUR HOMEWORK! Have fun. Next time, I'll add sketches for what I worked on with Peter and Jaehyun, specifically using two buttons to control either one light, or two lights.  




posted Nov 10, 2014, 6:13 AM by Gord Sellar   [ updated Nov 10, 2014, 6:14 AM ]

Hi guys! 

Here's a new video for more cool ideas about how people are using the same things we're studying--programming and electronics--to build wonderful "wearable" technology!

Starting Out!

posted Oct 31, 2014, 6:32 AM by Gord Sellar   [ updated Oct 31, 2014, 8:42 AM ]

Hi guys! 

So, we've been working with Arduino for a little while now. Peter, Taein, Jaemin, and Jaehyun have all been working with Arduino. We all started at the same place:

 - The Analog Input tutorial, which allows you to use a photoresistor or a potentiometer to control a LED. 

However, we've moved on to different tutorials. Here are some of the projects different people have tried:

 - Blink: Turn an LED on and off (without a potentiometer or photoresistor).
 - Fade: Use of analog output to fade an LED.
 - Button: use a pushbutton to control an LED.
 - Button State Change: counting the number of button pushes: this uses the same wiring as BUTTON above, but the code is different. Trying both and studying the code is a great way to learn about code! 

If these sound interesting to you and you haven't given them a try, make sure to try them out. If you can't make one work, bring it over and I'll help you figure it out. 

For those who do understand and complete them, we'll spend some time with Button State Change studying "Modulo Operations" (don't worry, it's easy!) and learning to alter code to do different things with that operation!

And don't forget Sylvia: she's the girl who helped me introduce Arduino to you. You should drop by her Youtube channel and thank her for helping you discover such a cool, fun hobby!

Keep working on your projects and eventually -- when you are able to write your own code -- we'll try have a larger group get-together so you can share your discoveries and talk about bigger projects you'd like to try.  

1-3 of 3