1

member

Medium Basics: Project 012l Flashing LED - Translator to Morse code

of Acoptex.com in UNO

Basics: Project 012l

Project name: Flashing LED - Translator to Morse code

Attachments: sketch1

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables

4. LED 1 pc

5. Resistor 1 pc (220 Om)

6. Breadboard

General

Morse code is a method of transmitting text information as a series of on-off tones, lights, or clicks that can be directly understood by a skilled listener or observer without special equipment. It is named for Samuel F. B. Morse, a telegraph inventor. The International Morse Code encodes the ISO basic Latin alphabet, some extra Latin letters, the Arabic numerals and a small set of punctuation and procedural signals (prosigns) as standardized sequences of short and long signals called "dots" and "dashes", or "dits" and "dahs", as in amateur radio practice. Because many non-English natural languages use more than the 26 Roman letters, extensions to the Morse alphabet exist for those languages.
Each Morse code symbol represents either a text character (letter or numeral) or a prosign and is represented by a unique sequence of dots and dashes. The duration of a dash is three times the duration of a dot. Each dot or dash is followed by a short silence, equal to the dot duration. The letters of a word are separated by a space equal to three dots (one dash), and the words are separated by a space equal to seven dots. The dot duration is the basic unit of time measurement in code transmission. To increase the speed of the communication, the code was designed so that the length of each character in Morse varies approximately inversely to its frequency of occurrence in English. Thus the most common letter in English, the letter "E", has the shortest code, a single dot.
Morse code is used by some amateur radio operators, although knowledge of and proficiency with it is no longer required for licensing in most countries. Pilots and air traffic controllers usually need only a cursory understanding. Aeronautical navigational aids, such as VORs and NDBs, constantly identify in Morse code. Compared to voice, Morse code is less sensitive to poor signal conditions, yet still comprehensible to humans without a decoding device. Morse is, therefore, a useful alternative to synthesized speech for sending automated data to skilled listeners on voice channels. Many amateur radio repeaters, for example, identify with Morse, even though they are used for voice communications.

In an emergency, Morse code can be sent by improvised methods that can be easily "keyed" on and off, making it one of the simplest and most versatile methods of telecommunication. The most common distress signal is SOS or three dots, three dashes, and three dots, internationally recognized by treaty.

You can read more about it here.

In this project, we will make universal translator to convert symbols (letters, numbers, words, sentences) to Morse code; print that in serial monitor and flash with LED.

Signals and connections of LED

The operating voltage of the LED is 1.8V and the operating current is 10mA-20mA. The Arduino Uno board can supply 5V or 3.3V power. We will use 5V for this project, so the minimum resistance of the current limiting resistor should be (5 V to 1.8 V)/20 = 160 Om. The 220 Om offered in the kit is suitable and you can also choose other resistors that meet the condition. The larger the resistance is, the dimmer the LED will get.

Build the circuit

The following picture shows the needed connections with the Arduino Uno 

 

Code

COLREG (Convention on the international regulations for preventing collisions at sea) 1972. Part D SOUND AND LIGHT SIGNALS is clearly describing the definitions of short (1 second duration) and prolonged blast (from 4 to 6 seconds duration) (Rule 32); the duration of each flash (1 second), interval between flashes (1 second), interval between successive signals (not less than 10 seconds) (Rule 34).

We set up 2 arrays of strings - one for letters and one for numbers. So to find out what we need to flash for the first letter of the alphabet (A), we will get the string letters[0] - remember that the first element of an array is element 0, not element 1.The variable dotDuration is defined, so if we want to make our Morse code flash faster or slower, we can change this value, as all the durations are defined as multiples of the time for a dot.

In the loop function, we are going to repeatedly see if we have been sent any letters over the USB connection and if we have to process the letter. The Arduino function Serial.available() will be true if there is a character to be turned into Morse code and the Serial.read() function will give us that character, which we assign to a variable called “symbol” that we defined just inside the loop. We then have a series of if statements that determine whether the character is an uppercase letter, a lowercase letter, or a space character separating two words. Looking at the first if statement, we are testing to see if the character’s value is greater than or equal to “a” and less than or equal to “z.” If that is the case, we can find the sequence of dashes and dots to flash using the letter array that we defined at the top of the sketch.We determine which sequence from the array to use by subtracting “a” from the character in symbol. At first sight, it might look strange to be subtracting one letter from another, but it isperfectly acceptable to do this in C language. For example, “a” - “a” is 0, where “c” - “a” will give us the answer 2. So, if the letter that we read from the USB connections was b, we will calculate “b” -“a,” which gives us 1 as the position of the letters array. Looking up letters[1] will give us the string“-...”. We pass this string to a function called flashSequence. The flashSequence function is going to loop over each of the parts of the sequence and flash it as either a dash or a dot. Strings in C language all have a special code on the end of them that marks the end of the string, and this is called NULL. So, the first thing flashSequence does is to define a variable called “i”. This is going to indicate the current position in the string of dots and dashes, starting at position 0. The while loop will keep going until were a symbol the NULL on the end of the string. Inside the while loop, we first flash the current dot or dash using a function flashDotOrDash and then add 1 to “i” and goback round the loop flashing each dot or dash in turn until we reach the end of the string. The function flashDotOrDash turns the LED on and then uses an if statement to either delay for the duration of a single dot if the character is a dot, or for 4 times that duration if the character is a dash, before it turns the LED off again.

Step by Step instruction

  1. Plug your Adruino Uno board into your PC and select the correct board and com port
  2. Open up serial monitor and set your baud to 9600 baud
  3. Verify and upload the the sketch to your Adruino Uno board
  4. You should see your symbols translated to Morse code and LED flashing that.

Summary

You can make the Universal translator to Morse code now.

Library:

  • No libraries required for this project

Sketch:

  • See attachments on the begining of this project description. 


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 28-08-2017
Viewed: 733 times