Skip to content

🔉 Morse Code communication system created with two Arduino UNOs (2015)

Notifications You must be signed in to change notification settings

Adamouization/ArduinoUnoMorse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Morse code communication system - Arduino UNO

Adam Jaamour and Benjamin King

This project allows the user to express himself in Morse code by controlling two moving platforms using two buttons to create either a dash or a dot.

The objective of the project is to create an original project which incorporates two different Arduinos instead of only one. The main challenge is to find workarounds in order to connect the two Arduinos in a useful and smart way. In order to do so, we decided to connect the two Arduinos using wires in order to create a fully functional Morse code writer. The main feature of the Morse code writer is the used to infrared light to detect objects at specific distances above an infrared light detector, and act accordingly.

To achieve this Morse code writer using two Arduino boards, we started off by writing small bits of code to make each individual element of the Morse code writer work properly before connecting the two Arduinos together and syncing all the steps. First, the two buttons were added on the master Arduino (the one that send out the information to the slave Arduino, which receives the information and does something accordingly). We connected them to the pins 2 and 3 in order to allow more efficient interruptions during the code execution. Next, on the slave Arduino, we added a servo which receives information according to which button is pressed and acts depending on the information received, an infrared distance detector, which is used to make the difference between a dot and dash in Morse code (explained in detail later), and a piezo element to play different sounds depending on the values read by the infrared distance detector. The two Arduino boards are connected via wires. Here are more details on each element of the Morse code writer (in order of execution) and their respective piece of code:

  • Buttons: the two buttons are placed on the master Arduino. One is used to perform a dash sound, and the other is used to perform a dot sound. When one of the button is pressed, it interrupts the loop (using an interrupt method) and changes the value of a Boolean set specifically for it. Once the Boolean has been changed, the loop restarts and an if statement for each of the buttons checks if the value of the boolean has changed and acts accordingly: if it had changed, then it begins transmitting a specific integer (x1 for a dot and x2 for a dash) to the slave Arduino via wires, then ends the transmission and sets back the boolean to its original state so that the if statement isn’t executed until the button is again pressed.

  • Servo: the servo is connected to the slave Arduino and acts according to the integer sent by the buttons. It is set at three different constant positions: a middle one where no sound is played, and two other ones which either play a dash or a dot. When the program is launched, it begins in the middle position. In the loop of the slave code, two if statements (one for each of the servo positions) check the integer received by the master Arduino and are executed upon receiving the information. When the integer is received, if it matches with one of the conditions from the two if statements, then the servo changes position accordingly and after 1 second, it returns to its middle position (so that no sound is played), resets the value of the variable storing the integer received by the buttons and prints either a dot or a dash to the serial monitor. If the integer x1 is received, then the servo moves to the position 1 (which represents a dot), or to the position 3 (dash) if the integer x2 is received, before returning to position 2 (middle position = no sound). A piece of carton with different heights at each edge is attached to the top of the servo.

  • Distance detector: the distance detector is connected to the slave Arduino. It works by sending infrared light waves and detecting the amount of infrared light returned to its detector. If the amount is high, then the object is close since it reflects a great amount of light, otherwise if the amount is low, it means no concrete objects is reflecting enough infrared light to its sensor. Therefore, the three positions assigned to the servo are all very different in order to allow different light intensities to be received by the distance detector. If the position 2 of the servo is assigned, then it means the servo is in its middle position with no piece of carton above the distance detector. If the position 1 of the servo is assigned, then it means the servo turns in the position where a relatively low piece of carton is placed above the distance detector causing a lot of infrared light to be reflected back to the distance detector. If the position 2 of the servo is assigned, then it means the servo turns in the position where a relatively high piece of carton is placed causing little infrared light to be reflected back to the distance detector. The distance detector reads the amount of infrared light reflected every one second, which is is then checked in the loop of the slave code.

  • Piezo element: the piezo element is the last piece of the Morse code writer. It is used to play different sounds depending the intensity of the reflected infrared light read by the distance detector. If the intensity is very low, it means no piece of carton is above the detector so no sound is played (for distances lower to 250). For distances between 250 and 580, it means the low piece of carton is above the distance detector while the value is being read, meaning not a lot of infrared light is reflected, causing the piezo to play a short sound which represents a dot. And for distances over 580, the piezo plays a longer sound representing a dash. To play the sounds, two if statements in the loop check for the values read by the distance detector. If they meet the conditions, one of the two sounds is played, otherwise no sounds is played.

  • Wires: the two Arduino boards are connected via wires. One wire connects the two grounds of the Arduino boards, and the two others connect the Analog In pins A4 and A5 of the two Arduinos in order to allow the transfer of information from the master to the slave.

The Morse code writer works as follows: when the program is launched, no carton platform is above the distance detector. When the first button is pressed, the lower carton platform moves over the distance detector which causing the piezo element to play a dot sound. When the second button is pressed the higher carton platform moves over the distance detector causing the piezo element to play a dash sound. After each button is pressed, the carton platforms return to their original positions so no sound is played until the user presses one of the buttons another time.

About

🔉 Morse Code communication system created with two Arduino UNOs (2015)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Other 100.0%