How to Create a Morse Code Transmitter Using Arduino and LED

How to Create a Morse Code Transmitter Using Arduino and LED
0
0
3 min read

Build a Morse Code Encoder using Arduino and an LED to transmit text messages in light pulses. Learn Morse encoding, embedded programming, and practical signal communication with this beginner-friendly project.


Introduction

🔍 What is Morse Code?

Morse code is a method of transmitting textual information using sequences of short and long signals, commonly represented as dots (.) and dashes (-). It has historical significance in telecommunication and is still used in aviation and amateur radio.

💡 What This Project Does

This project takes a message input (e.g., “HELLO”) and converts each character into its Morse code representation. The Arduino Uno blinks an LED to visually transmit the Morse signals — short pulses for dots, longer ones for dashes.

🌐 Real-World Use Case

  • Emergency communication
  • Low-bandwidth or no-network scenarios
  • Teaching embedded systems and encoding concepts

🎯 Skill Level & Expected Outcome

  • Skill Level: Beginner to Intermediate
  • Expected Learning:
    • Character-to-Morse mapping
    • LED blinking with precise timing
    • Using arrays and loops in Arduino
    • Understanding Morse timing standards

Components Required

QtyComponentDescriptionBuy Link
1Arduino Uno with cable Microcontroller BoardBuy on Elecsynergy
1LED (5mm)Light Emitting DiodeBuy on Elecsynergy
1220Ω ResistorTo limit current to LEDBuy on Elecsynergy
1BreadboardFor assembling the circuitBuy on Elecsynergy
10+Jumper WiresFor connectionsBuy on Elecsynergy

Circuit Diagram + Explanation

⚙️ Circuit Connections

Arduino PinConnected To
D13Anode of LED
GNDCathode via Resistor (220Ω)

Ensure the LED’s longer leg (anode) is connected to D13 and the shorter one (cathode) to GND through the resistor.


Arduino Code – With Line-by-Line Explanation

// Define LED pin
const int ledPin = 13;

// Morse code dictionary
const char* morseCode[] = {
  ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",
  ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.",
  "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."
};

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
  delay(1000);
}

void loop() {
  const char* message = "HELLO"; // Change to your message
  for (int i = 0; message[i] != '\0'; i++) {
    if (message[i] == ' ') {
      delay(700); // Space between words
    } else {
      int index = toupper(message[i]) - 'A';
      const char* code = morseCode[index];
      transmitMorse(code);
      delay(300); // Space between characters
    }
  }
  while (1); // Stop loop after one message
}

void transmitMorse(const char* code) {
  for (int i = 0; code[i] != '\0'; i++) {
    if (code[i] == '.') {
      blinkLED(200);
    } else if (code[i] == '-') {
      blinkLED(600);
    }
    delay(200); // Pause between dots/dashes
  }
}

void blinkLED(int duration) {
  digitalWrite(ledPin, HIGH);
  delay(duration);
  digitalWrite(ledPin, LOW);
  delay(100);
}

🔍 Code Breakdown

  • morseCode[]: Holds representations for A–Z
  • transmitMorse(): Sends dot/dash signals using LED
  • blinkLED(): Handles actual LED blinking for the desired duration

Working Explanation

  • Arduino reads the character array (“HELLO”)
  • Each character is converted into Morse using a lookup table
  • LED blinks according to Morse encoding
  • Timings:
    • Dot: 200 ms ON
    • Dash: 600 ms ON
    • Gap between signals: 200 ms
    • Between letters: 300 ms
    • Between words: 700 ms

This simulates a real Morse signal transmission through light.


Demo / Output Preview

  • 🔦 LED blinks in patterns like:
    • H: ....
    • E: .
    • L: .-..
    • O: ---

Troubleshooting & Tips

  • LED not blinking?
    • Check polarity (long leg to D13)
    • Use correct resistor
    • Ensure LED is not faulty
  • Irregular blink speed?
    • Adjust delays properly
    • Check delay() consistency
  • Want it to repeat?
    • Remove or modify the infinite loop (while(1)) in loop()

Project Expansion Ideas

  • Use a buzzer or laser to transmit sound or light-based Morse
  • Add button input to send dynamic messages
  • Upgrade to LCD display to decode and display Morse input
  • Connect with Bluetooth and control via mobile app
  • Integrate with photoresistor to decode Morse from light pulses

Conclusion

The Morse Code Encoder Using Arduino and LED project is a fantastic way to understand basic embedded system principles. It blends character encoding with precise timing control and hardware interaction.

🚀 What You Learned:

  • Morse encoding logic
  • How to control LED through code
  • How timing translates characters to blinking patterns

This hands-on project is an excellent foundation for learning how communication protocols work at the lowest level.


🛒 Buy the Full Kit

👉 Purchase Full Kit on Elecsynergy


#MorseCodeArduino #LEDCommunication #MorseWithArduino #ArduinoLEDProject #SignalEncoding #ArduinoBeginners #ElecsynergyKits #ArduinoCodingTutorial #MorseEncoderDIY #InnovateYourselfBlog

Leave a Reply