Arduino Morse Code Translator

by 22hasson5770 in Circuits > Arduino

1174 Views, 1 Favorites, 0 Comments

Arduino Morse Code Translator

IMG_1724.JPG

This device uses an Arduino to translate a morse code message through light. When a light flashes in a specific pattern (morse code) it will print out the corresponding letter on the LCD. This device is especially helpful for learning morse code or passing secret messages to someone who does not know morse code.

Supplies

1 Arduino Uno

1 Photoresistor

1 LCD screen (16 x 2 character)

1 Potentiometer

1 Bread boars

1 USB cable

2 1k ohm resistors

At least 17 wires

STEP 1: Assembly

Screen Shot 2021-06-03 at 11.17.10 AM.png
IMG_1831.JPG

1) Place photoresistor, potentiometer, and LCD on breadboard

2) Connect one of the wire terminals of the photoresistor to the positive charge. Use a resistor to connect the other wire terminal to negative. On the same row the photoresistor is connected to the terminal, add a wire connected to A0 on the Arduino. 3) For the potentiometer, connect Terminal 1 and 2 to positive and negative. Connect the Wiper (the wire terminal at the center) to V0 of the LCD 4) For the LCD use a wire to connect GND, RW and LED to ground (negative). Use a wire to connect VCC to positive charge. Use a resistor to connect the other LED to positive. Connect DB4 to terminal 6 on Arduino, DB5 to 5, DB6 to 4, DB7 to 3, RS to 9, and E to 8. 5) Connect GND on arduino to the negative charge on the breadboard and 5V to positive.

Link to TinkerCad: https://www.tinkercad.com/things/enmUfoSnh5Q-final-final-mores-code-translator-final3/editel?sharecode=h5kZpLCnoEu6F7_8DCHL7OQqFy8GbgwWVwss9HbQi3U

STEP 2: Program Arduino

IMG_1725.JPG

1) Download the file with code from Arduino IDE: https://create.arduino.cc/editor/22hasson5770/cc3363bf-f139-479a-9585-52e506cdb0ed/preview

2) Copy the code onto Arduino IDE

3) Using the USB cable, download the code onto the arduino.

STEP 3: Use

Screen Shot 2021-06-03 at 11.32.35 AM.png

The morse code translation is now ready to use. How it works is, if a light is turned on over the photoresistor, it will detect the change in light and start a timer for the user to see. It counts in milliseconds. Anywhere between 1-2000 milliseconds counts as a ‘short’. 2001-5000 counts as a ‘long’. To print the letter, shine the light for more than 5001 milliseconds then turn it off. This code only does letters, not numbers.

Now. It is time to enjoy, feel free to play around with this code and have fun with your friends exchanging secret messages in morse code.

Troubleshooting

Light sensor: if the light sensor is not working properly, the light in the room might be fluctuating too much. Make sure you are in a room where the light is constant. If that is not the issue, then the change in light is too low. Try to use a brighter light to flash on the photoresistor or change the code by changing the variable varyAllowed.

Timer: occasionally the timer will move to negative numbers or count faster than it should. This is due to an error in the code which I cannot locate. Usually it happens after marking a ‘long’ (aka ‘2’). The way to fix this is to let the timer run until it goes back to regular counting and then continue as usual.

LCD: if the LCD is not working, try checking the connections. You might have a different model of LCD which has slightly different connections. If you are struggling with seeing what the LCD is printing, adjust the light of the LCD with the potentiometer.