Introduction: Experiment for Fun: Morse Code Encrypter Using Arduino and Smartphone!!!!

Well, Hello there everybody!! How are you, guys? I hopes everyone is ok and in a good mood. Today I would like to share with all of you about a simple experiment that I made during my free time. It is called the Morse code encrypter. The flow of this experiment would be like this:

1. The user sends a text or alphabet from his smartphone via MIT app inventor app

2. The message is received by Arduino

3. The Arduino then encrypts the message received from the phone into morse code.

The Image shown is the morse code representation of alphabets and numbers (numbers are not included in this experiment).
Now let's go to the first step shall we?

Step 1: Items Needed

There are very little items needed for this experiment:

Hardware (shown in the image):

1.LED

2.Resistor (recommended)

3.male to male jumper

4. Arduino UNO

5.bluetooth module ( I am using HC 06)

6. Smartphone

Software:

Arduino IDE

MIT app inventor

Step 2: Circuit Assembly

The circuit is assembled as shown. The sketch was made by using fritzing. Now let's go to the MIT app inventor sketch

Step 3: MIT App Inventor Code

Well the MIT app inventor code is also fairly simple. When bluetooth had already been connected and the text had been typed. just press the send button and the app will send the text/alphabet to arduino

Step 4: Arduino Code

(The main part of this experiment is in the arduino code. The code will match the letters read from the smartphone to the array and produce the output which matches the alphabets)

int LED = 13;

int dot = 250;

char* morseL[] = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..",".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.","...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.." };//morse letters

void setup() {

pinMode(LED, OUTPUT);

Serial.begin(9600);

}

void loop() {

char info;

if (Serial.available() > 0) {// read from smartphone

info = Serial.read();

if (info >= 'a' && info <= 'z') { //We can use use this by the fact that each ASCII code is a number letterId(morseL[info - 'a']);

}

else if(info >= 'A' && info <= 'Z') { //capital letters also included

letterId(morseL[info - 'A']);

}

else if(info == ' ') { //delay for space

delay(dot * 4);

}

}

}

void letterId(char* character) {

int i = 0;

while(character[i] != '\0') {

output(character[i]);

i++;

}

delay(dot * 3);

}

void output(char ID) {

digitalWrite(LED,HIGH);

if (ID == '.') {

delay(dot); }

else {

delay(dot * 3);

}

digitalWrite(LED,LOW);

delay(dot); }

Step 5: Test and Enjoy!!!

Well that's all you need to do for this experiment. All you need to do after that is to download the apk file to your smartphone from app inventor and upload the arduino code and test it... I hope this experiment brings benefits for you guys. Well, that's all from me, until the next experiment I would like to say I'll BE BACK!!! The simple demo for this experiment will be at:

https://youtu.be/mg8bXe5CX2g

Comments

About This Instructable

1,430views

33favorites

License:

More by halim930112:Arduino Systems: Simple Bluetooth Door LockVoice To Arduino: Control LEDs using MIT Speech RecognizerExperiment for Fun: Morse Code Encrypter Using Arduino and Smartphone!!!!
Add instructable to: