Archive

Posts Tagged ‘morse’

Arduino: Morse Code Blinking


Learning : ARDUINO, Morse-Code, Electronic Circuit
Subject: LED to Blink Morse Code

[NOTE:
W
e are working on Electronic Devices, Voltage, Resistors and other Electronic Parts that may Become HOT due to un-stable current or Wrong Wire Connections..
PLEASE BE CAUTIOUS AND TAKE SAFETY NEEDED PROCEDURES.]


Some days ago I just went through some pages of Morse-Code. Then I got an idea to write a code for the ARDUINO to blink an LED for some letters.

Morse Code: In a basic and easy way, Morse code is a Dots (.) and Dashs (-) to present alphabet characters. So A = .- ; B = -… ; C = -.-. and so on (Morse code table in Wikipedia)

Morse Code Rules:

if we assume a unit is U, then :

  • 1. A Dot is 1U.
  • 2. A Dash is 3U.
  • 3. A Space between a part of the same letter is 1U.
  • 4. A Space between letters is 3U.
  • 5. A Space between words is 7U.

In our project here, the Unite U will be the Delay in Arduino, so the LED will be High for 1U to represent a Dot (.) and will be High for 3U to represent the Dash (-).

What we will Need: I will use a Breadboard, ARDUINO Nano , One Red LED, One 300 ohm Resitro, Jumper Wire.

  • A BreadBoard.
  • ARDUINO Nano.
  • 1 Red LED.
  • 1 Resistor [I will Use 300 ohm]
  • Some Jumper Wire.

Connection:

  • The ARDUINO Nano will be on the Breadboard
  • Connect D13 on Nano to Column 11 on the Breadboard using Jumper-wire.
  • Connect the Resistor on Column 11 and Column 6 on the Breadboard.
  • Connect the LED Anode (+) pin on the Column 6 on the Breadboard.
  • Connect the LED Cathode (-) pin to the Column 4 on the Breadboard.
  • Connect the Column 4 on the Breadboard to the Cathode Row on the Breadboard using Jumper-wire.
  • Connect the Column 17 on the Breadboard (Nano GND pin) to Cathode Row on Breadboard using Jumper-wire.
  • Connect the Column 19 on the Breadboard (Nano 5V pin) to the Anode Row on Breadboard using Jumper-wire.
Image of the Connected Breadboard.
ali radwani ARDUINO Projects morse code



The Coding: First we need to define the Dots and Dashs for each Alphbets, in this example I will do only three carecters for my Name A L I, I will create an array of 0 and 1, 0 is a dot, 1 is a dash, here is the code:
int A [ ] = {0,1} ; // 0 = dot (1U), 1 = dash (3U)
int L [ ] = {0,1,0,0} ;
int I [ ] = {0,0} ;

Here is declearing the Unite, u as Delay time:
int u = 170 ; // 1U = 170 delay.

and here is the Arduino pin I will use:
int ledpin = 13 ;

in the void setup, we will only write one line to set the pinMode(ledpin, OUTPUT)

then I create a function to read the letter array-content

 // CODE: Function to read the letters contents. 

void letter(int c [], byte s)
{
      if (c[s] == 0)   // dot 
        {morse1(ledpin, 1) ;}
      if (c[s] == 1)   // dash 
        {morse1(ledpin, 3) ;}       
}



In this code, I will let the LED to Blink in Morse code saying “ALI” [My Name 🙂 ]. You may add the Morse code in the Application and making the LED to send you message. Code Available in Download Page.

RUN TIME..






:: ARDUINO PROJECTS LIST ::
[ Click Here to See all ARDUINO Projects ]

To Download the ARDUINO Project [Code and Diagram] files Click-Here



ali radwani ahradwani.com python projects codeFollow me on Twitter..

By: Ali Radwani