Interfacing Arduino with IR Beams

Using an Arduino with a Piezo buzzer attached as an alarm system – connected to commercial IR beams. These beams are really cheap and give the advantage of being invisible at night. Also, there are two beams and the alarm only trips when both are triggered.


Wiring up the IR Beams

Wiring up the IR Beams is quite simple, I used comms cable which is wire with 4 cores. You can get this at any hardware store. The power for both receiver and transmitter I plugged into a 12v power supply I had lying around. This is a very common voltage for many products like routers, DVD players, old cameras and so on, you may just have one.

The receiver then needs two more wires for data. I have indicated where these are plugged into the screw terminals:

Connections. Black and White are connected to Arduino. Red and Green for power.


Here we have a piezo speaker, LED and IR beam connection. *edit: the IR Beam output black wire needs to be connected to +5v, not GND!

The IR beam connection functions like a switch, you can see a similar setup in the Arduino example for switch. *edit: the IR Beam output black wire needs to be connected to +5v, not GND! See final circuit below for correct connection.

The Nano is powered by microUSB cable.

The Code:

I have uploaded the code to Github here:


The beams were quite difficult to set up, I put them on poles dug into the garden. The transmitter has to point exactly at the receiver/trigger. They do have a system with LED’s to help with this but I had to enlist the help of a friend to line everything up. Once you are all connected, switch the beams on first, then the Arduino alarm. The LED should flash off and then on again.

Test it by crossing the beam. Weeep weeep weep you have an alarm system! Re-arm it by switching the Arduino off and on again.

One thing I like about the IR beams I bought (linked above) is that if the power is cut the alarm is triggered, so burglars can’t just cut your wire to bypass the alarm.

Of course it is a beam which means that criminals can still do the limbo and get under it, so next up: adding a motion sensor to the setup!

The Final Circuit:

The red and green wires go to power the beams, the black and white are to the beam sensor. Power can be provided either with a 12v battery, or a power supply.