Simulating an LED Blinking S.O.S Signal with Arduino

Imagine being stranded on a deserted island with no means of communication except for a flashlight. Fortunately, a distant ship is approaching. In such a situation, how can you send a distress signal to the approaching vessel? You can use the flashlight to emit flashes of light, varying in length, to create the internationally recognized Morse code distress signal – S.O.S.

arduino sos

Table of Contents

S.O.S Distress Signal

Morse code is a character encoding system based on dots and dashes used to transmit English letters, numbers, and some symbols. In emergencies, the SOS signal is an internationally recognized distress signal. It is composed of Morse code, representing letters through combinations of dots (.) and dashes (-). The SOS signal is highly recognizable, consisting of three short signals (S), three long signals (O), and three short signals (S):

S = …

O = – – –

S = …

SOS = … – – – …

Next, we will demonstrate how to create an LED project using Arduino to simulate the SOS signal. In this project, we will represent the dots (.) and dashes (-) by controlling the duration of LED illumination.

Required Components and Wiring

  • 1 × Arduino UNO R3 (with a USB data cable included)
  • 1 × Breadboard
  • 2 × Colored jumper wires
  • 1 × 5mm LED light
  • 1 × 220-ohm resistor

Arduino S.O.S signal light wiring diagram

Arduino S.O.S Blink Code

				
					int ledPin = 9;  // Define interface 9
void setup() {
  pinMode(ledPin, OUTPUT);
}
void loop() {
  // Three short flashes to represent the letter "S"
  for (int x = 0; x < 3; x++) {
    digitalWrite(ledPin, HIGH);   // Set LED to ON
    delay(150);                   // Delay for 150 milliseconds
    digitalWrite(ledPin, LOW);    // Set LED to OFF
    delay(100);                   // Delay for 100 milliseconds
  }
  // Delay of 200 milliseconds to create a gap between letters
  delay(200);
  // Three short flashes to represent the letter "O"
  for (int x = 0; x < 3; x++) {
    digitalWrite(ledPin, HIGH);   // Set LED to ON
    delay(400);                   // Delay for 400 milliseconds
    digitalWrite(ledPin, LOW);    // Set LED to OFF
    delay(200);                   // Delay for 200 milliseconds
  }
  // Delay of 100 milliseconds to create a gap between letters
  delay(100);
  // Three short flashes to represent the letter "S" again
  for (int x = 0; x < 3; x++) {
    digitalWrite(ledPin, HIGH);   // Set LED to ON
    delay(150);                   // Delay for 150 milliseconds
    digitalWrite(ledPin, LOW);    // Set LED to OFF
    delay(100);                   // Delay for 100 milliseconds
  }
  // Wait for 5 seconds before repeating the S.O.S signal
  delay(5000);
}

				
			

Code Explanation

In the setup() function, the code initializes the LED pin (pin 9) as an output pin, indicating that it will be used to control the LED.

The main part of the code is in the loop() function, which executes continuously in a loop.

Inside the loop() function, there are three sections, each representing a letter in “S.O.S” using Morse code.

  • The first section flashes the LED in three quick bursts, with short on and off intervals, to represent the letter “S” in Morse code.
  • After each letter, there’s a delay of 200 milliseconds to create a gap between the letters.
  • The second section does the same for the letter “O,” but with longer on and off intervals.
  • Another 100 milliseconds delay is used to create a gap after the letter “O.”
  • The third section repeats the pattern for the letter “S.”

Finally, there is a longer delay of 5 seconds before the loop starts over. This creates the pause between repetitions of the “S.O.S” signal.

More content you may be interested in

How to Enable Multi-Core on ESP32 Microcontroller
How to Enable Multi-Core on ESP32 Microcontroller

This comprehensive guide elucidates the process of enabling multi-core functionality on the ESP32 microcontroller, leveraging its dual-core architecture for enhanced parallel processing capabilities. Through detailed

Arduino MQ-3 Alcohol Sensor Project
Arduino MQ-3 Alcohol Sensor Project

Creating an alcohol sensing project with an MQ-3 sensor and Arduino allows for accurate alcohol concentration monitoring in environments like bars and factories. The MQ-3

Arduino Temperature Alarm Project
Arduino Temperature Alarm Project

This Arduino temperature alarm project effectively demonstrates how to create a practical temperature monitoring system. By utilizing the LM35 temperature sensor and a buzzer, it

Arduino Breathing LED Project
Arduino Breathing LED Project

A breathing light is an LED lighting effect that simulates the human breathing process, gradually increasing or decreasing in brightness within a specific cycle. This

Scroll to Top