Two Way Morse Code Communication System

by aromalmihraj42 in Circuits > Arduino

29 Views, 0 Favorites, 0 Comments

Two Way Morse Code Communication System

PXL_20250209_041542629.MP (1).jpg

This morse code translation system utilizes a KY-008 laser module and a photoresister (LDR) to send and decode messages. This circuit is made to simulate the communication and encryption on Singulus. While Singulus uses QKD for encryption purposes, this circuit makes use of existing Morse code for rudimentary replication.


The program first takes input from the Serial Monitor, which is then translated to morse code in forms of light pulses. This is then detected by the angled photoresistor which translates the detected light durations to morse code and back to English to display for the user.

Supplies

PXL_20250209_042513587.jpg

Breadboard x2

Arduino UNO + USB Cable

Jumper Wires x8

Photoresistor (LDR)

4.7k Resistor x2

KY-008 Laser Module

Connect Laser Module to Arduino

PXL_20250209_041423276.jpg
laser-diode-Module-Pinout-550x550.jpg

Connect 5V and GND pins to power rails for easy access. Then:

  1. Connect right pin to GND rail using 4.7 kΩ resistor
  2. Connect middle pin to 5V rail
  3. Connect left pin to digital pin 2 as the output

See attached pin diagram to ensure correct orientation.

Connect Photoresistor to Arduino

PXL_20250209_041454289.jpg
02fce68c34e1c26ee73aefac380e3dd772d3f5b2.jpeg

To connect the photoresistor, on another breadboard:

  1. Connect one pin to GND rail using 4.7 kΩ resistor AND connect to A1
  2. Connect other pin to 5V rail

See attached pin diagram to ensure correct wiring.


Troubleshooting: If not working, try connection power rails over as they might not cover entire board but rather only half.

Angle Photoresistor to Detect Laser

PXL_20250209_041542629.MP.jpg

Before the code is executed, it must be ensured that the laser is clearly pointing to the photoresistor. Ensure additionally that other sources of light do not fluctuate and influence the photoresistor readings.

Check the photoresistor first using the code below that should display the voltage. Check this by covering it with your finger, a cloth, turning off the lights, etc.

int sensorValue = 0;
void setup(){ //Setup. This section runs only once.
pinMode(A1, INPUT);
Serial.begin(9600); //Sets the communication speed between PC and Arduino Uno to 9600 baud.
} //end of setup
void loop() {
sensorValue = analogRead(A1);
float voltage = (sensorValue / 1023.0) * 5.0; // Convert to voltage
Serial.println(voltage, 2); // Print voltage with 2 decimal places
delay(1000);
}

Add and Deploy the Code

The final step is to compile upload the code onto the Arduino. Before this, however, ensure sensorThreshold (Line 7) is set to the default voltage outputted with ambient light and that the photoresistor is in clear line of sight of laser. After uploading the code, test with letters (i.e. A, B,...) then simple words (e.g. HI), then simple sentences (e.g. Hey there).


Note: To write in the Serial Monitor and also receive output from the detected morse code in the Serial Monitor, open it by clicking the magnifying glass in the top-right of the screen. Furthermore, if you wish to see how the detected light changes, open the Serial Plotter for a graph visual.