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.

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 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.
You Might Be Interested


This article will explore the Arduino Nano’s pinout, explaining each pin’s function and providing practical insights on how to effectively use them in your DIY projects—whether you’re working with digital


This article provides a comprehensive guide on using CMake and rosserial_client to compile and upload code to Arduino for larger Arduino projects, offering an alternative to the Arduino IDE. The


Looking for a simple and efficient way to monitor your heart rate? Check out our latest project: the Arduino Heart Rate Monitor. With this easy-to-use device, you can keep track


This Arduino project demonstrates how to create the internationally recognized Morse code distress signal “S.O.S” using an LED. By controlling the LED’s duration of illumination, it represents the pattern of


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 warns users with an audible


This DIY project introduces an Arduino-based smart tea maker that combines mechanical and electronic control for automated tea brewing. It uses multiple Arduinos, servos, and sensors to handle tasks like


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 sensor’s high sensitivity to alcohol,


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 project can be achieved through