Skip Navigation

Morse Code with Arduino

By Nabeela Merchant 60 minutes
Grades 9-12
Science and Technology,
  • Programming
  • Computing and Networks
  • Technology and Society
Tools & Languages

Key Coding Concepts

  • Functions
  • Loops
  • Sequences



“Arduino is an open-source electronics platform based on easy-to-use hardware and software. Arduino boards are able to read inputs – light on a sensor, a finger on a button, or a Twitter message – and turn it into an output – activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the Arduino Software (IDE), based on Processing.”


In this activity, learners will set up an Arduino Uno microcontroller and program a light (LED) to display a message in Morse Code.


  • Laptops with administrator permissions
  • Arduino Uno
  • An A B USB cable (USB printer cable) to connect the Arduino Uno to the laptop

Before the lesson...

  • Review key coding concepts and ensure you are confident describing them to your group
  • Create an Arduino Create account
  • Follow the instructions to install the Arduino plug-in. This will let the web browser communicate with the Arduino Uno. Read this article to learn more about the Arduino Create Editor, or if you have any trouble installing the plug-in
  • Work through the example project to get familiar with the hardware and software, and ensure everything is working correctly
  • Go over the slides for the lesson
  • Print the solutions sheet

Use these slides for this lesson.


Robots are devices that can carry out a series of complex actions. They can be programmed by a computer and can respond to their environment.

Robots already exist in our daily lives, though we may not recognize it. Have you ever been to a store where the door magically opens as you approach it? There is robotics in the background that makes the magic happen.

Robots work in a simple 3 step process: input, processing, and output. This is quite similar to how humans work, as well; we take in information, our brain processes it and makes a decision, and then our body reacts. So if you see a snake, your brain recognizes that it is dangerous and commands your body to run! Similarly, hardware and software can work together to do cool things and react to their surroundings.

We’ll be using a microcontroller, called the Arduino Uno, to write a message in Morse Code. The Arduino Uno acts as the brain of our robot. Watch a snippet of this video to learn more: (0:20 - 1:22)

*Video also included in the slides


Open up the example project and show learners the code and physical output (blinking light).

Point out the main elements of the code: comments, setup, loop, and commands. Explain the purpose of each of the commands using the descriptions in the adjacent comments.

Check for understanding by asking learners what would happen if you changed the first delay(1000) to delay(500). What would happen if you changed the second delay(1000) to delay(2000)?

Demonstrate the effect of changing the value of the delays in the code. This should change the speed at which the light blinks. Don’t forget to verify and upload the code each time you want to show learners the effect of the change.


In this activity, you’ll spell a word in Morse Code using an LED.

Morse Code is a way to communicate text information using a combination of dots and dashes to represent letters. The dots and dashes can be broadcast using sounds or light. S.O.S. is a famous sequence of letters that sailors used as a distress signal.

For example, S in Morse Code is dot dot dot (...) and O is dash dash dash (---). We can use these codes to spell S.O.S. (See slides for example gif)

Use the solution sheet to guide learners through the following steps:

  1. Choose a word with at least 5 letters and convert it to Morse code.
  2. Connect the Arduino Uno to the computer.
  3. Create an account with Arduino Create Editor + Download the Arduino plug-in.
  4. Walk through the example project to make sure the hardware and software work.
  5. Open up the Morse Code project and Add to Sketchbook.
  6. Run the existing code.
  7. Comment on the existing code.
  8. Add first letter (replace S.O.S. with the letters of the chosen word).
  9. Add remaining letters.
  10. End the word.
  11. Check your code.
  12. Verify and upload the code to the Arduino Uno.

Have a partner decode the pattern of blinking lights to ensure the learner has spelled their word correctly.

  • After reviewing the example project, co-construct success criteria with the class to be used to evaluate their final projects.
  • Have learners research the following programming concepts and explain how they used them in their project: Functions, Loops, Sequence.

Program the built-in LED on the Arduino Uno to flash the same word in Morse code, but instead of using the functions dot, dash, end_of_letter, and end_of_word, have learners use the following commands:

  • digitalWrite(LED_BUILTIN, HIGH); // turns the LED on
  • digitalWrite(LED_BUILTIN, LOW); // turns the LED off
  • delay(1000); // pauses the system; use appropriate delay values (in milliseconds)

A dot is a light that's on for 500 milliseconds. A dash is a light that is on for 1,500 milliseconds. The LED is off for 2000 milliseconds between letters and for 5000 milliseconds between words.

The history of Morse Code is quite interesting! As an extension to this lesson, consider exploring the impact of Morse Code and the telegraph on society in the mid-1800’s. Learners may find parallels between the way that the telegraph allowed communities and businesses to deliver messages across immense distances and the impact that the Internet has on day-to-day life.

  • How do you keep in touch with friends and family members? Why do you use that tool?

Teach lessons that are tied to your existing curriculum!


More Lesson Plans For Grades 9-12

    View All Lesson Plans

    Explore lessons based on components

    The K-12 Computer Science Framework

    Although learning how to build digital projects is a key part of Computer Science education, students should also learn a wider set of skills and competencies that will help them to harness the power of digital technologies as both creators and consumers. A comprehensive approach to K-12 Computer Science education includes learning about the following five focus areas:

    View Framework ➝


    By the end of high school, students should be able to create a simple computer program.

    Computing and Networks

    By the end of high school, students should understand and be able to use the tools and devices commonly used to build digital projects.


    By the end of high school, students should be able to explain how we use computers to create, store, organize, and analyze data.

    Technology and Society

    By the end of high school, students should be able to explore the ways in which technology and society have mutually shaped each other.


    By the end of high school, students should be able to apply design principles to the digital projects they create.