Laser Modem with an Arduino Microcontroller
Submitted by esalazar on Mon, 08/11/2008 - 7:03pm.
Serial data transition from a Arduino controller using a standard red laser, photo transistor and an instrumentation amplifier.
This started when I ordered an IR led and phototransistor pair from Spark Fun along with some spare ATMega168 microcontrollers. I first experimented using the IR led to transmit 2400 baud serial to the phototransistor. I programmed my Arduino Diecimila with the sample serial program altering the baud rate and allowing it to run in a continuous loop.
At this moment I wondered if I could use a laser to extend my range. I happened to have a small laser that I pulled from a cheap laser level. I pulled out the laser and wired it where the IR led was minus the resistor. I then pointed the laser at the phototransistor and noticed it instantly reacted. In fact I had to turn the gain on the amplifier way down to use the signal. To test my range I wired my ATMega168 to a 9v battery and mounted the laster in a small vise a few feet away. After adjusting the gain I was able to transmit data easily. Attached is a video along with the final schematic I used.
This started when I ordered an IR led and phototransistor pair from Spark Fun along with some spare ATMega168 microcontrollers. I first experimented using the IR led to transmit 2400 baud serial to the phototransistor. I programmed my Arduino Diecimila with the sample serial program altering the baud rate and allowing it to run in a continuous loop.
diff ~/arduino-0011/examples/Communication/ASCIITable/ASCIITable.pde laserModem.pdeAfter programing the Arduino, I took out the ATMega168 and wried it into a breadboard along with a 16mhz crystal and 5 volt regulator. For the receiver I used the phototransistor wired into two logic gates of a inverting Hex Schmitt trigger. I used the Schmitt trigger to act as a buffer and ensure only proper logic level enter the USB to serial converter on the Diecimila board. While the first test was successful, I was was not able to place the led more than an inch away from the phototransistor. To allow for more range I used an AD620AN instrumentation amplifier IC. For control I wired the gain pins of the amplifier into a small 10k potentiometer. After adjusting the gain I was able to get about a foot of range with reliable data transfer. Any further and there was too much noise in the signal.
6c6
< Serial.begin(9600);
---
> Serial.begin(2400);
38,40c38,39
< while(true) {
< continue;
< }
---
> number = 0;
>
45c44
< delay(100); // allow some time for the Serial data to be sent
---
> delay(10); // allow some time for the Serial data to be sent
At this moment I wondered if I could use a laser to extend my range. I happened to have a small laser that I pulled from a cheap laser level. I pulled out the laser and wired it where the IR led was minus the resistor. I then pointed the laser at the phototransistor and noticed it instantly reacted. In fact I had to turn the gain on the amplifier way down to use the signal. To test my range I wired my ATMega168 to a 9v battery and mounted the laster in a small vise a few feet away. After adjusting the gain I was able to transmit data easily. Attached is a video along with the final schematic I used.



what kind of bitrates do you think you could get out of it? maybe even bidirectional and full duplex?
Well done Evan! Impressive data-rate (2.5kbits is my guess) for a hack (I use the term with the utmost respect!). .... Also, what does the binary number after each line in the transmission mean?
Take care,
Chris
Very interesting article. Thanks
"This started when I ordered an IR led and phototransistor pair from Spark Fun along with some spare ATMega168 microcontrollers. I first experimented using the IR led to transmit 2400 baud serial to the phototransistor. I programmed my Arduino Diecimila with the sample serial program altering the baud rate and allowing it to run in a continuous loop."
Thanks for the information
"After programing the Arduino, I took out the ATMega168 and wried it into a breadboard"
That's an interesting twist to do it. never though about using the arduino to programm a sketch before moving the ATMega into a project. very hands on.