Data transmission with LASER


Targets

Whenever operating with Lasers
it is absolutely necessary to
apply protective measures!
Never look into the beam!
Take care with reflecting surfaces!
We want to transmit data from one microcontroller to another. It could be Arduinos or any other type of hardware. Both of them should be located at fixed places.
To ease the adjustment of sender and receiver we want to transmit data by means of visible light. As a sender we are going to use a modulated LASER module. As a receiver a standard photodiode will be used. The protocol will be the standard three-wire RS-232 protocol (without handshaking).

How it was done

The cheap LASER modules run with some 3 volts, so when connected to an Arduino port better use a resistor of some 50 ohms.

The LASER module will be connected to TX (or sometimes called TxD ) output of the first microcontroller which is pin 1 on the Arduino board. It has to directed to the receiver.

Never look into the beam!

The picture shows sender and detector in a short distance.
Actually, if you adjust both properly the distance may be more than 10 meters.

The signal generated by the phototransistor has to be amplified in order to activate the digital RX (od RxD) input of the second controller which is pin 0 on the Arduino.

In this case, an old phototransistor T1 (BP 101) was used. You need an additional transistor T2 (BC 546, an opamp would do as well) to get a compatible signal. The collector of the transistor goes to the RX input.
But take care:
to program the Arduino we need the serial pins. So, two signals would meet at the RX input. Which one will win?

The easiest solution is moving the the second controller (the receiver) to a breadboard. There you can select whether the RX gets it's input from the USB interface or from the phototransistor simply by inserting a wire, a jumper or a switch.

Once you finished your project you don't need the switch any more. (But when are projects ever finished?)

It would be a good idea to replace the old transistors by newer types.

Final remarks

If you were using an LED instead of the LASER you had to use some lenses to focus the light to the detector.

Still, depending on your environment it might be neccesary to protect the receiver against ambient light using any kind of pipe, a spare ball pen would do.

When adjusting sender and receiver a piezo speaker connected to the collektor of T2 and ground might be helpful. So you have an audible control whether the signal reachs the receiver.

Bad news:
with the cheap LASER pointer moduls the maximum baudrate will be restricted to some 2400 baud.
When you check the net you will find Tomi Engdahl (1997!), who managed to transmit with a DOS program and hardware of some $80 getting a maximum baud rate of 9600.

Another limit is the phototransistor. When the data sheet give you rise and fall time of 8 μs the limit will be 62000 bits per second.

If you want to use the Serial terminal while the microprossors are communicating you have to use the same baudrate with the PC as setting the baud rate affects both sending and receiving.

You also can use two LASERs and two photodiodes to let the microcontrollers talk in both directions to have a full-duplex transmission.

Source:

No source is given as you just have to use the Serial.print, Serial.read, and Serail.avail commands.


contact: nji(at)gmx.de