Using Garage Door Safety Beams as Generic Photo Interrupter Sensors

This is a post I revived out of the dead archives of the old website that got lost in the transfer over to the new site.  I am posting this in response to an inquiry about how garage door safety beam sensors work.  The image pictured to the left was a fun little home project I did with my sone, as I’ve been trying to get him more interested in electronics and exploring all the fun and cool things that can be created. I suggested how cool it would be to build an intrusion alarm for his bedroom door so he knows if someone has trespassed into his room! I told him about garage door safety beams and how they are like an invisible laser beam that, when broken, cause the motor to reverse and raise the door to safety.  Or in this case, can be used to trigger an alarm.



It turns out these safety beam sensors, when supplied with 12 volts DC through a modest resistance (1k ohm), will rest at about 5V DC when the beam is blocked. When the beam is not blocked the 5V line is pulled to ground for about 400uS. This repeats at a frequency of about 150Hz. The images to the right were captured on a Rigol DS1052E and is what the actual signal looks like on an o-scope:

So I used the pulseIn() function to make the Arduino to look for a ‘low’ pulse and timeout if no ‘low’ pulse is received within 10mS (the period of a 150Hz signal, plus some buffer). With the parameters, the function call looks like this:

pulseIn(10, LOW, 10000);

The pulseIn() function returns zero if no pulse is found within the timeout period. This makes detecting a blocked safety beam easy, in that as soon as the pulse train stops, a zero is returned and
the alarm is activated with the Arduino tone library. In addition to the audible alarm, I also used pin 13 to activate the on-board LED. Pin 13 can then also be used to switch a relay, or……you name it.

Below is a connection diagram of the actual setup. Additionally, if you’re interested in trying this for yourself, you can obtain the Arduino code, or sketch, here.

An improvement would be to add a zener diode to protect the Arduino input pin the safety beam is connected to prevent damage in case the safety beam sensor fails, or in case the voltage varies
significantly form one sensor to the next. After all, I only tested/used one. Here is the diagram showing the added zener diode:

Leave a comment

Your email address will not be published. Required fields are marked *