Wireless Laser Communication With Arduino: a Prototype
by Diolante in Circuits > Arduino
830 Views, 4 Favorites, 0 Comments
Wireless Laser Communication With Arduino: a Prototype
This project is inspired on the concept of Free Space Optical Communications, that is not a new thing, but sure an interesting and promising one, that was even being used by NASA years ago (2014) with demonstrators like LLCD and later in this year with LCRD, also companies and other agencies as well.
Anyway you may ask, but why? Higher Bandwidth and Range! compared with Radio Frequency systems.
Back to the instructable, it is a simple attempt that went well using Arduino and some electronics, due to my room size and the quality of collimation lens, it was tested only in a 30 centimeters range, but achieved more than 40000 bits per second, it uses two lasers modules, one for data and other for clock signalling to trigger the read of a photodiode at the right moment.
Also you should check other similar instructables, like: this one and this.
Supplies
My approach involved the use of the following components:
For the Transmitter:
- 2x KY-008 5mW Red Laser Module 650nm
- 2x FQP33N10 Logic Level N-Channel MOSFET
- 2x Resistors 2.2 kΩ
- 1x Arduino Mega 2560
- 1x Breadboard
For the Receiver:
- 1x BPW34 Photodiode
- 1x LM358P Dual Op-Amp IC
- 1x 74HC14N Inverter Schmitt Trigger IC
- 2x 100nF (Code 104) Ceramic Capacitors
- 1x 120pF (Code 121) Ceramic Capacitor
- 1x 1000uF Electrolytic Capacitor
- 1x 47uF Electrolytic or Ceramic Capacitor
- 2x Resistors 47 kΩ
- 1x Arduino Mega 2560
- 1x Breadboard
Why those Components?
- The Schmitt Trigger prevents the incident light, that is not from the lasers, from triggering Arduino's interruption, without them even a small ambient light variation would trigger the interruption.
- The 120pF capacitors are very important, they act like a filter, preventing the high-frequency noise from trigger the IC, for low data rates (around 700 bits per second) they can be omitted.
- The 100nF capacitors are Decoupling Capacitors, is used to the deal with noise.
- The use of LM358 was not my first option, but due to my lack of some ICs, it is used, perhaps a transimpedance amplifier or other rail-to-rail Op Amp.
- The KY-008 is specifically picked, by the reason that from my tests, is the only low cost laser diode that can work with high-frequency on-off switching, anyway for low data rates (6000 bits per second), any diode may work.
- FQP33N10 is selected, because at the time, was the only one available, can be changed by IRLZs or others FQP, , and also may be omitted.
- The code relies on Arduino Mega architecture (Port Manipulation and Interrupt Pin were used), if using any other Arduino requires some code adaptations.
How It Works!
The way it works is very simple and intuitive, in this project, i transmit letters and/or word/phrase that have a know size, a letter have 8 bits that means 1 byte, thus with it in mind a:
Transmitter:
Converts what is going to be sent, from array of chars to bytes, and read each bit position and by a given value it turns the data laser on or off, and also turn on the clock laser to indicate that a bit must be read by the receiver.
Receiver:
By receiving a laser light strike in the clock photodiode, the receiver will then trigger an interrupt that will read what is in data photodiode, the lack of laser light striking the photodiode will mean Zero and a laser light strike, One. [watch the Schmitt Trigger, it will invert!]
The receiver will println at the serial monitor every time a byte is received.
Observation: Serial Monitor must be opened before starting the transmission, also reopening the Serial Monitor while the data is begin transmitted, it will occur a reset, and it will probably start printing gibberish. [Arduino Limitation]
Assemble the Transmitter Circuit!
The transmitter circuit is pretty straight forward, you have 2 MOSFETs to keep a good light, even when it is switching on and off states very fast.
Observation: Ignore the mechanical parts in the images, are used only to keep the wires in place =).
Assemble the Receiver Circuit!
First of, as i mentioned, it was tested in a small range of 30 centimeters, but it may work in greater distances, but first some adaptations shall be done, if using the LM358 you will need to change the relation between resistor/capacitor, since the capacitor is a low pass filter and the resistor is related with the gain of the Op-Amp, observing the f = 1/(2piRC) equation.
And the current setup is for fc = 33.8kHz, basically it can reach theoretically 67600 bits per second (2 bits = 1 Hz), however LM358 has a slow slew rate, making it very difficult to impossible, if greater data rates is required, this IC must be changed.
My calculations or analysis might be wrong, so if you see any mistakes, please tell me.
The Coding!
Here you have two files, one for the transmitter and the other for the receiver, (do not use the same COM Ports).
Prepare to Test!
To run do the following steps:
- Change your message and the size of the variable NUMBER_BYTES_PER_BLOCK (number of letters and spaces + 1), example: for "ABC" will be NUMBER_BYTES_PER_BLOCK = 3+1 = 4
- Upload sketch to Transmitter Arduino.
- In the Receiver code, change NUMBER_BYTES_PER_BLOCK to number of letters and spaces you are expecting to receive, without the need of sum +1.
- Check the lasers, and if needed, correct their trajectories to coincide with it corresponding photodiodes.
- Open Receiver Serial Monitor at 500000 bauds and at its right com port.
- Press the restart buttons at same time.
Now you are receiving messages using lasers!
How to Improve?!
As you already have seen, there is a lot of room for improvement, here some thoughts i have about:
- Better Photodiode housing.
- Implementation of an ACK Signal in the Receiver.
- Error Detection Algorithm or Hardware, like parity bit.
- PCB mount.
- Raspberry version.
Thanks for Reading!