Arduino Controlled Telegraph, by George Theall, and Finn Snow
by PHS_Engineering in Circuits > Arduino
687 Views, 3 Favorites, 0 Comments
Arduino Controlled Telegraph, by George Theall, and Finn Snow
This antique telegraph is controlled by an Arduino. You can type a sentence into your computer in English, and the Arduino will translate it into Morse Code and tap it out in the traditional Dots and Dashes on a real antique Telegraph.
Supplies
Arduino
USB -> Arudino connector
8 Arduino wires
5 Wires with alligator clips
2 Banana Plugs
Two telegraphs
1K Ω Resistor
Relay
Diode
Transistor
Computer with Arduino program
Set Up the Circuit
Please follow the diagram to carefully to set up the telegraph circuit.
Set Up the Arduino Circuit
Please follow the diagram to carefully to set up the Arduino circuit.
Connect the Arduino to the Telegraph
Connect the telegraph to the relay with alligator clips. The positive wire should connect to the moveable bar that connects to the finger plate (where someone would push to send a signal), and the negative wire should connect to the stationary metal at the base of the telegraph.
Write the Code
The code is written out in the following document. Upload the code to the Arduino and use the Serial Monitor to type a sentence. Click enter when you are done, and it will send your sentence to the telegraph in Morse Code.
int relayPin = 13; // Assign relayPin to pin 13. This is the power source for the relay int timeUnit = 100; // This variable will be used to measure dots, dashes, breaks, and pauses char input; // Variable to save the input to void setup () { Serial.begin(9600);//for the connect with the board pinMode(relayPin,OUTPUT); } void loop () { if (Serial.available()) { input = Serial.read();//read the input if (input == 'a' || input == 'A') {lA();}//if the input is a or A go to function lA if (input == 'b' || input == 'B') {lB();}//same but with b letter if (input == 'c' || input == 'C') {lC();} if (input == 'd' || input == 'D') {lD();} if (input == 'e' || input == 'E') {lE();} if (input == 'f' || input == 'F') {lF();} if (input == 'g' || input == 'G') {lG();} if (input == 'h' || input == 'H') {lH();} if (input == 'i' || input == 'I') {lI();} if (input == 'j' || input == 'J') {lJ();} if (input == 'k' || input == 'K') {lK();} if (input == 'l' || input == 'L') {lL();} if (input == 'm' || input == 'M') {lM();} if (input == 'n' || input == 'N') {lN();} if (input == 'o' || input == 'O') {lO();} if (input == 'p' || input == 'P') {lP();} if (input == 'q' || input == 'Q') {lQ();} if (input == 'r' || input == 'R') {lR();} if (input == 's' || input == 'S') {lS();} if (input == 't' || input == 'T') {lT();} if (input == 'u' || input == 'U') {lU();} if (input == 'v' || input == 'V') {lV();} if (input == 'w' || input == 'W') {lW();} if (input == 'x' || input == 'X') {lX();} if (input == 'y' || input == 'Y') {lY();} if (input == 'z' || input == 'Z') {lZ();} if (input == ' ') {wordPause();} Serial.println (input); } } //Letter functions void lA () {dot();dash();letterPause();}//letter A in morse code! void lB () {dash();dot();dot();dot();letterPause();}//same for B void lC () {dash();dot();dash();dot();letterPause();} void lD () {dash();dot();dot();letterPause();} void lE () {dot();letterPause();} void lF () {dot();dot();dash();dot();letterPause();} void lG () {dash();dash();dot();letterPause();} void lH () {dot();dot();dot();dot();letterPause();} void lI () {dot();dot();letterPause();} void lJ () {dot();dash();dash();dash();letterPause();} void lK () {dash();dot();dash();letterPause();} void lL () {dot();dash();dot();dot();letterPause();} void lM () {dash();dash();letterPause();} void lN () {dash();dot();letterPause();} void lO () {dash();dash();dash();letterPause();} void lP () {dot();dash();dash();dot();letterPause();} void lQ () {dash();dash();dot();dash();letterPause();} void lR () {dot();dash();dot();letterPause();} void lS () {dot();dot();dot();letterPause();} void lT () {dash();letterPause();} void lU () {dot();dot();dash();letterPause();} void lV () {dot();dot();dot();dash();letterPause();} void lW () {dot();dash();dash();letterPause();} void lX () {dash();dot();dot();dash();letterPause();} void lY () {dash();dot();dash();dash();letterPause();} void lZ () {dash();dash();dot();dot();letterPause();} void dot() //Create a tap and delay for 100 milliseconds { digitalWrite(relayPin,HIGH); //turns the relay on, creating a tap on the telegraph delay(timeUnit); //delays the dot so it is distinguishible from a dash digitalWrite(relayPin,LOW); //turns the relay off delay(timeUnit * 2); } void dash() //Create a tap and delay for 300 milliseconds { digitalWrite(relayPin,HIGH); //turns the relay on, creating a tap on the telegraph delay(timeUnit * 3); //delays the dash 3 times the delay of the dot digitalWrite(relayPin,LOW); //turns the relay off delay(timeUnit * 4); } void letterPause() //Delay between letters for 300 milliseconds { delay(timeUnit * 3); } void wordPause() //Delay between words for 700 milliseconds { delay (timeUnit * 7); }
This code uses heavy inspiration from: https://www.deviceplus.com/arduino/how-to-create-a-morse-code-generator-using-arduino/