Talk To Your Raspberry Pi Over a Laser Beam!

This quick little project lets you send data from your PC to your raspberry pi, over a laser!

We will however need a few components that may not be in our usual junk-box. So let’s take a quick look at these, and discuss which of their parameters are important to our project.

First up, we need:

A PIN Photo-Diode


For this project, you’ll want to select a photo-diode that has a fast rise time, a low capacitance; and lastly, one that is sensitive to the wave-length of light emitted by your laser.

Photo-diodes only generate a very tiny current when light falls on them; the current produced is typically in the low single-digit micro-amperes range. This tiny current will take some time to charge even the smallest capacitance. So if the diode’s capacitance is large, you’ll need more current; and hence more photons falling onto the sensor, to achieve the same bandwidth.

I used the SFH203P photo-diode, which has a cost of about $1-$2. I bought mine from RS Components.

The SFH203P features:

  • Fast rise-time of 5 nanoseconds
  • 11pF of capacitance
  • Suitable for use with 400nm to 1100nm wavelength light

An Operational Amplifier

A fast photo-diode is of no use without a fast op-amp to go with it. The key parameters to looks for here are a high slew rate, low input capacitance and low input bias current.

A high slew-rate allows our op-amp to output nice, sharp, square-waves. While a low input current prevents our amplifier from stealing current from our photo-diode. Both in conjunction help keep our bandwidth high.

I selected the CLC2007ISO8, they cost about $1.50. Again I bought from RS Components.

The CLC2007ISO8 features:

  • A slew rate of 220V/μs
  • Input bias current of 1.4 μA
  • Input capacitance of 0.5pF

A Laser Diode


Surprisingly, no steep requirements here: the absolute cheapest laser-diode I could find on ebay worked fine for me. The photo on the right shows what it looked like. It also came with an inbuilt resistor sized for 3.3V operation.

The laser wasn’t supplied with any specifications; however, in testing, I found my bandwidth was limited by my op-amp, rather than the laser-diode. So, no problem using this cheap one.

The only downside I ran into with this cheap product was the collimation is quite poor; so my range was limited by the beam spreading out.

The laser modules were 5 for $2 on eBay.

A USB to TTL Serial Adapter

The USB to TTL adapter will be used to control the laser-diode to send pulses to the receiver.

The FT232R chip in my adapter can supply about 24mA at maximum, my diode uses less than this, so I did the lazy thing and simply soldered the TX pin to the diode’s anode, and ground pin to the laser-diode’s cathode.

The USB-TTL adapter was about $3 from eBay.

The Receiver Circuit

This circuit is called a transimpedance amplifier. It converts the tiny current produced by the photo-diode into an output voltage.

To get the maximum performance possible, care should be taken to minimize stray capacitance on the inverting input. Traces should be kept short, and if possible, avoid running them in parallel with any other trace.

R1, R2, C1 and C2 form a simple voltage divider, creating a virtual-ground at half the supply voltage.

The op-amp in this circuit always adjusts its output to keep an equal voltage on both inputs.

When light falls on the photo-diode, a small current is generated which lowers the voltage seen on the inverting input (The ‘-‘ input).

In response, the op-amp increases its output voltage in an attempt to equalize the input voltage.

As the op-amp’s output current has to flow through feedback resistor R3, the larger R3 is, the higher the output voltage required to produce a current equal to the photo-diode’s current.

Because the non-inverting input (the ‘+’ input) is fixed to 1/2 the supply voltage. The output voltage will vary from half the supply voltage up to almost the full supply voltage.

This is the reason we run the circuit on 6.6V. Half of 6.6V gives us a 3.3V TTL level compatible with the raspberry pi. If we had wanted a 5V TTL level output, we could have increase the supply to 10V.

Connecting It All Together

The output of the receiver should be connected to the RX pin of the Raspberry Pi (Pin 10 on the Raspberry Pi 3) and the virtual ground should be connected to the Raspberry Pi’s ground (Pin 6). Double check that these pins match your Raspberry Pi version.

To make the raspberry pi’s UART device work correctly, you will probably need to follow my instructions or read the official documentation

The transmitter can be plugged into any PC with a USB port.

You can now carefully aim the laser at the photo-diode, and you should be able to transmit data from one machine to the other.

I’d recommend trying the lowest baud rate first, then work your way up until you run into errors. I managed to get a baud-rate of 921,600 bps before I started getting any communication errors. Pretty fast!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s