Arduino Encoded and Modulated Laser and Infrared Serial Communication

license

Introduction: Arduino Encoded and Modulated Laser and Infrared Serial Communication

HobbyTransform

By HobbyTransform My Site Follow

More by the author:

Arduino OLED 128X64 IIC Serial Display: Printing Text and Moving Images

MPU6050: Arduino 6 Axis Accelerometer + Gyro - GY 521 Test & 3D Simulation

RC Multi Channel Arduino Proportional Transmitter / Receiver With Button Trimmers

About: Hi, this page is about robotics, electronics, embedded systems, drones, RC and other cool DIY stuff. I aim to manufacture robots & electronics. To see the projects I am developing, visit my github: https:/… More About HobbyTransform »

Hey there! Do you want to learn how to communicate wirelessly between two computers using lasers / LED's and photo-receivers? Need to send a signal that is robust to noise? Here is the solution for you.

This is an arduino library which enables you to use a simple laser or LED to transmit characters between two arduinos (transmitter arduino with the laser to receiver arduino with a photodiode). Each byte of data is encoded (but not encrypted) to add some robustness to noise during the transmission and then modulated. I originally wrote this as part of a netduino robotics project for uni, but I've since modified it to work with an arduino. I've tested it and it works with an LED also, but the range is slightly better with the laser.

If you want to learn how the code works, read step 1. If you just want to test that it works or incorporate it into one of your projects, skip to step 2.

What you need can be found on eBay:

Step 1: How It Works (In Chronological Order):

1. Hamming(7,4) Encoding:

2. Manchester Modulation:

3. Transmission:

The 44-bit data is sent via the laser or LED, 1's are on and 0's are off

4. Manchester De-Modulation:

The 44-bit signal is received by the photo-detector and manchester-demodulated (reverse algorithm of modulation) to reconstruct the 16-bit encoded signal

5. Hamming Decoding:

The 16-bit demodulated signal is then hamming decoded to reproduce the original byte

6. Printing Message:

The byte is then printed on the serial window

Step 2: Install the Library

The library I wrote, LumenWire, can be found on my github repository here. Download it to your computer, you won't need the README.md file though. Just add the HT_LumenWire folder to your libraries folder in the arduino folder on your two computers.

If you come across bugs in the code or have simple recommendations on how to improve the performance or add extra functionality / features, you're more than welcome to let me know in the comments section. Thanks!

Step 3: Test the Setup:

  1. open the arduino application
  2. open File -> Examples -> HT_LumenWire and select either the photoreceiver or transmitter examples
  3. plug in the arduino and select the appropriate COM port, then upload the transmitter / receiver sketches to their respective arduinos
  4. connect the laser as follows: laser VCC pin to pin 6, - pin to ground
  5. connect the photodiode as follows: photodiode signal on pin 7, power pins as normal
  6. open the serial window (spyglass symbol in the IDE) on both computers
  7. point the laser or LED to the photodiode
  8. enter a character or phrase in the serial window on the computer doing the transmitting and press enter to send
  9. you should receive the message on the receiver serial window automatically

Now that you've verified the setup works, what you can do with it is up to your imagination. Do you want to further refine or modify the library to add extra features? Are you planning to incorporate it into a bigger project? Have fun.

If you enjoyed this instructable or found it educational, why not stay tuned for future projects by following me on Instructables and on Facebook / Twitter / Google+.

If you enjoyed this instructable and would like to see more like this, please consider supporting me by purchasing your materials for this project through the affiliate links in the materials section or donating below:

Bitcoin: 1Mqe7et24Lz4DY1RUN4iAQVHkvJsdFArKR

Ethereum: 0x6d8248db1cdea6a783cb6b41ae67bb8e6144f479

Litecoin: LW6PWESqsr8xHw6EJ9WLbsQsAyTvPnwnxJ

Dash: Xemv7jud697v8tQmKfNFoMxfkd17ZayH2t

Your support is greatly appreciated! Happy DIY'ing!