Project showcase

Morse Code Transmitter - Light Signal © CC BY

In this project I made a Morse code transmitter using Arduino and Winform application.

  • 2,242 views
  • 1 comment
  • 7 respects

Components and supplies

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)

Apps and online services

About this project

In this project I tried to make a Morse code transmitter with light signal. It was for a University project and I will make the receiver in the next time.

Demo

You only need one LED but I suggest that use at least 3 different color. One of them is for the main message (I mean dot and dash) the other is for the delay to separate the dot and dash to recognize the letters and the last one is for the delay to separate the words.

The syntax for Arduino for example for letter A : .`- or X : -`.`.`-

Translate method in C#:

List<string> MorseSting = new List<string>();
       private string MorseToSend;
       private string MorseToShow;
       private string MorseToReady;
void Translate()
       {
           char[] characters = Msg.Text.ToCharArray();
           for (int i = 0; i < characters.Length; i++)
           {
               Console.WriteLine(characters[i]);
           }
           for (int i = 0; i < characters.Length; i++)
           {
               if (characters[i] == 'a' || characters[i] == 'A') { MorseSting.Add(".`-`s`"); }
               if (characters[i] == 'b' || characters[i] == 'B') { MorseSting.Add("-`.`.`.`s`"); }
               if (characters[i] == 'c' || characters[i] == 'C') { MorseSting.Add("-`.`-`.`s`"); }
               if (characters[i] == 'd' || characters[i] == 'D') { MorseSting.Add("-`.`.`s`"); }
               if (characters[i] == 'e' || characters[i] == 'E') { MorseSting.Add(".`s`"); }
               if (characters[i] == 'f' || characters[i] == 'F') { MorseSting.Add(".`.`-`.`s`"); }
               if (characters[i] == 'g' || characters[i] == 'G') { MorseSting.Add("-`-`.`s`"); }
               if (characters[i] == 'h' || characters[i] == 'H') { MorseSting.Add(".`.`.`.`s`"); }
               if (characters[i] == 'i' || characters[i] == 'I') { MorseSting.Add(".`.`s`"); }
               if (characters[i] == 'j' || characters[i] == 'J') { MorseSting.Add(".`-`-`-`s`"); }
               if (characters[i] == 'k' || characters[i] == 'K') { MorseSting.Add("-`.`-`s`"); }
               if (characters[i] == 'l' || characters[i] == 'L') { MorseSting.Add(".`-`.`.`s`"); }
               if (characters[i] == 'm' || characters[i] == 'M') { MorseSting.Add("-`-`s`"); }
               if (characters[i] == 'n' || characters[i] == 'N') { MorseSting.Add("-`.`s`"); }
               if (characters[i] == 'o' || characters[i] == 'O') { MorseSting.Add("-`-`-`s`"); }
               if (characters[i] == 'p' || characters[i] == 'P') { MorseSting.Add(".`-`-`.`s`"); }
               if (characters[i] == 'q' || characters[i] == 'Q') { MorseSting.Add("-`-`.`-`s`"); }
               if (characters[i] == 'r' || characters[i] == 'R') { MorseSting.Add(".`-`.`s`"); }
               if (characters[i] == 's' || characters[i] == 'S') { MorseSting.Add(".`.`.`s`"); }
               if (characters[i] == 't' || characters[i] == 'T') { MorseSting.Add("-`s`"); }
               if (characters[i] == 'u' || characters[i] == 'U') { MorseSting.Add(".`.`-`s`"); }
               if (characters[i] == 'v' || characters[i] == 'V') { MorseSting.Add(".`.`.`-`s`"); }
               if (characters[i] == 'w' || characters[i] == 'W') { MorseSting.Add(".`-`-`s`"); }
               if (characters[i] == 'x' || characters[i] == 'X') { MorseSting.Add("-`.`.`-`s`"); }
               if (characters[i] == 'y' || characters[i] == 'Y') { MorseSting.Add("-`.`-`-`s`"); }
               if (characters[i] == 'z' || characters[i] == 'Z') { MorseSting.Add("-`-`.`.`s`"); }
               if (characters[i] == '1') { MorseSting.Add(".`-`-`-`-`s`"); }
               if (characters[i] == '2') { MorseSting.Add(".`.`-`-`-`s`"); }
               if (characters[i] == '3') { MorseSting.Add(".`.`.`-`-`s`"); }
               if (characters[i] == '4') { MorseSting.Add(".`.`.`.`-`s`"); }
               if (characters[i] == '5') { MorseSting.Add(".`.`.`.`.`s`"); }
               if (characters[i] == '6') { MorseSting.Add("-`.`.`.`.`s`"); }
               if (characters[i] == '7') { MorseSting.Add("-`-`.`.`.`s`"); }
               if (characters[i] == '8') { MorseSting.Add("-`-`-`.`.`s`"); }
               if (characters[i] == '9') { MorseSting.Add("-`-`-`-`.`s`"); }
               if (characters[i] == '0') { MorseSting.Add("-`-`-`-`-`s`"); }
               if (characters[i] == ' ') { MorseSting.Add("/`"); }
           }
           for (int i = 0; i < characters.Length; i++)
           {
               MorseToSend += MorseSting[i];
           }
           MorseToSend += "/";
           MorseToReady = MorseToSend.Replace("`", "");
           MorseToShow = MorseToReady.Replace("s", " ");
           Morse.Text = MorseToShow;
       }

You can download the WinForm application below.

IF YOU HAVE ANY PROBLEM WITH THE PROJECT YOU CAN BE IN TOUCH WITH ME.

Code

Arduino CodeC/C++
int mrs = 7; 
int slsh = 4; 
int spc = 10; 
int ddot=100;
int ddash=500;
void setup() { 
  Serial.begin(9600);
pinMode(mrs, OUTPUT); 
pinMode(slsh, OUTPUT); 
pinMode(spc, OUTPUT); 
}

void loop() { 

}
//////////////////
String Splitter(String data, char separator, int index)
{
    int found = 0;
    int strIndex[] = { 0, -1 };
    int maxIndex = data.length() - 1;
    

    for (int i = 0; i <= maxIndex && found <= index; i++) {
        if (data.charAt(i) == separator || i == maxIndex) {
            found++;
            strIndex[0] = strIndex[1] + 1;
            strIndex[1] = (i == maxIndex) ? i+1 : i;
        }
    }
    return found > index ? data.substring(strIndex[0], strIndex[1]) : "";
}
///////////////////////////
void serialEvent (){
  String serialResponse = Serial.readString();
  int _length = serialResponse.length();
  String morse[_length];
  for(int i = 0 ; i <= _length ; i++)
  {
     morse[i] = Splitter(serialResponse, '`', i);
  }
  for (int j = 0 ; j <=_length ; j++)
  {
    if(morse[j]==".")dot();
    else if(morse[j]=="-")dash();
    else if(morse[j]=="/")slash();
    else if(morse[j]=="s")space();
  }Serial.println("End");
  
}
void space ()
{
 // Serial.println("space ");
  digitalWrite(spc, HIGH); 
delay(500); 
digitalWrite(spc, LOW); delay(400);
}
void slash ()
{
//  Serial.println("slash ");
  digitalWrite(slsh, HIGH); 
delay(1600); 
digitalWrite(slsh, LOW); delay(400);
}
void dot ()
{
//  Serial.println("dot ");
  digitalWrite(mrs, HIGH); 
delay(ddot); 
digitalWrite(mrs, LOW); delay(400);
}
void dash ()
{
//  Serial.println("dash ");
  digitalWrite(mrs, HIGH); 
delay(ddash); 
digitalWrite(mrs, LOW); delay(400);
}

Custom parts and enclosures

WINDOWSFORM APPLICATION
MORSE.EXE
morse_RCSRE0ggDp.exe

Schematics

Circuit
Morse ebkqojurmc

Comments

Similar projects you might like

Morse Code Translator

Project showcase by Team ONYX

  • 10,197 views
  • 2 comments
  • 15 respects

Morse Code Receiver

Project showcase by Alireza Karkon

  • 3,385 views
  • 5 comments
  • 23 respects

Morse Code Communication Using Arduino

Project tutorial by Jalal_Mansoori

  • 2,701 views
  • 7 comments
  • 19 respects

Morse Code Machine

Project showcase by brzi

  • 3,643 views
  • 1 comment
  • 7 respects

Morse Code Communication Using Laser Module (Both)

Project tutorial by SURYATEJA

  • 752 views
  • 0 comments
  • 8 respects

Arduino Morse Code Machine

Project showcase by Vlada Krsmanovic

  • 10,221 views
  • 1 comment
  • 30 respects
Add projectSign up / Login