History
While working at Parallax, I would often have customers call in about using a PIR sensor as a motion activated light or to activate some other device when motion is detected. Sometimes I would get customers that didn’t have any interest in microcontrollers, but still need the light or device to come on for some time and then turn itself off. So for those who want the equivalent of a motion activated light using a PIR sensor and parts, this tutorial is for you.
The 555 Timer
The first integrated circuit I ever used was the 555 timer, readily available at Radio Shack back in the day. This IC made it very easy to blink an LED or create a shut-off timer. You can even use it to create sounds. However, as a timer it can be used to activate something for a period of time, then turn it back off. The 555 Timer IC is undoubtedly one of the classic integrated circuits used for many years in many projects.
Combined with a PIR sensor, a couple of transistors and a relay board, you can easily turn on a relay when motion is detected and have it turn off after a certain amount of time, set by the values of R1 and C1. With the values listed in the schematic, the delay time is approximately 2 minutes. This can be increased / decreased by altering the values of R1 / C1, or you could replace R1 with a 1 M potentiometer and have an adjustable delay time that is easier to set.
The delay time starts from the last trigger of the PIR. In other words, the circuit is re-triggerable. If the PIR senses motion during the delay the countdown is reset just like most commercial motion activated systems. The entire circuit runs from a single 5VDC power supply if you use the Single Relay Board (#27115) and 5VDC and 12VDC if you use the original Dual Relay Board (discontinued). I modified my system to run from a single 5VDC supply by putting 5V relays onto my Dual Relay Board.
In Figure 1, I was prototyping these circuits using a Board of Education on a Li-Ion power pack. This was my go-to setup for prototyping on the BASIC Stamp 2, however, in this case I am merely using the power and breadboard and not the BASIC Stamp Module.
Figure 2 shows the Single Relay Board Schematic. You can download a PDF of this schematic and a PDF of the Dual Relay Board schematic from the Resources below.
Theory of Operation
When the PIR Sensor detects motion Q1’s collector, which is normally pulled high by R2 is biased and pulls the 555 TRIG pin low starting the timing cycle. At the same time Q2 is biased clearing the charge on C1. C1 begins to charge via R1 until the threshold voltage is reached. Any time the PIR is re-triggered C1 is cleared again allowing the timing cycle to effectively start over. Once the timing cycle is complete the 555 OUT goes high which can be used to trigger the input on either Relay Board. This circuit works with any 5V PIR sensor that outputs a HIGH when motion is sensed.
Resources
Relay Driver Circuits – Tutorial
Discuss this tutorial on Savage///Chats
PIR Triggered Relay Circuits by Chris Savage is licensed under CC BY 4.0
PLEASE FEEL FREE TO LEAVE YOUR COMMENTS, QUESTIONS, SUGGESTIONS OR FEEDBACK ON THIS POST.
Leave a Reply
You must be logged in to post a comment.