Introduction: Laser Data Transfer, Part2- Binary Transmitting.

Picture of Laser Data Transfer, Part2- Binary Transmitting.

in part1, I have shown a simple way to transmit data over laser. it depend originally on time, such that if we transmit 1 the laser light up for 200ms and if 3 the laser light up for 400ms, then the receiver measure the time of the pulse, and finally print the number sent on LCD.

here I made some improvement, I only send the numbers 0 and 1, depinding on the ASSCI representation of the data sent.

in this way, you can send any char you want using 2 arduinos, laser and LDR. and you can display the data on an LCD.

all the details about the connection of the components, the way and the basic idea are in part one .

i just want to show here the new idea and how it works :)

Step 1: Send Part.

the sending part has the same idea of the old method, but here it send only the numbers 1\0. it get the char to be sent through the serial monitor using serial.read then it turn it into ones and zeros.

NOW HOW TO DO SO.... when i did the project I was just a begginer, i had to think with the methods I learned in digital class. I came up with this way to send data!

and the full code is included in the attachments

<p>s_char = Serial.read(); //receive num from serial to resend<br>    s_int = s_char;</p><p> s_word += s_char; //s_word is a String type to store the sent word. fot testing things
    while (digit < 8)
    { s_BIN[digit] = s_int % 2; // store the bit in an array
      s_int = s_int / 2;
      digit++;
    }//this method is given in digital classes, to transfer decimal to binary
    for (int i = 0; i < 8; i++) // now here send the bit using laser
    { if (s_BIN[i] == 0) {
        digitalWrite(3, HIGH);
        delay(100);  //the specified time for 0
        digitalWrite(3, LOW);
        delay(100);
      }
      if (s_BIN[i] == 1) {
        digitalWrite(3, HIGH);
        delay(200);
        digitalWrite(3, LOW);
        delay(200);
      }

</p>

Step 2: Receiver Part.

in the receiver part the same method is used, but here to decode the result and get the char sent. after the char is done receiving it the char is displayed on the LCD.

and the final code is attached and it contain some notes :) .

this method has some problems, it's slow and requiers mathmatics operations that make it slower and costy on the arduino uC .... HOWEVER, it works fine some how .

the next part; and the final progress i made in this project so far ; is much better and faster. I Learned to use timers and Bitwise math, and this could push the project to limits :) i will post it next time :) .

hope you like it, thanks for reading .

Comments

About This Instructable

1,578views

17favorites

License:

Bio: motaz bany-amer!! jordan 2/7/1994 Yarmouk university - jordan work at Genotronex lab, IEEE YU Robotics Team, YES yarmouk engineering students, hijjawy art engineers. =-=-=-=-=-=-=-=-=-=-=-=-=-=-= facebookhttps ... More »
More by Motaz Bany-Amer:Arduino: Pushing the Limits || Power-plugin timer.Arduino: pushing the limits || Arduino Timers.Using tft itead 2.8 arduino UNO sheild on MEGA
Add instructable to: