Wednesday, February 26, 2014

Using raw PIR motion sensor without arduino or microprocessor

If you happen to have a bathroom without a window like ours, you need to use the light even during daytime which is not convenient if you are a kid and can't reach the switch.

For this next mini project, I just want a simple way to turn on or off the light when my child gets in the bathroom to pee.  In my first arduino project, the PIR sensor has 3 pins (5V, ground and signal). When I bought another PIR sensor from the same store, I noticed that it has 2 more pins with the label "out".
SB00622A-2
 Looking at the spec sheet, I found out that the load pins will give out the same as the supply voltage when a motion is detected. But this is not the only difference.  This new PIR also has 2 potentiometers - one for the delay, which indicates how long the pulse signal will stay on when a motion is detected, and the other is the lux, that considers how bright the surrounding is before giving out a signal. Very useful if you only want motion to be detected at night. Considering the price is the same, this new sensor saves me a lot of parts!

So instead of using an arduino, or even the attiny85 microprocessor, we can use the PIR directly to turn on a light. The load part of this PIR can only give out 100mA of current but should be enough to power some LEDs.  To keep things simple and avoid messing around with high voltage wires, I am just using a cheap LED torch as the lamp.
LED torch
The torch is being powered by 2 x 3V coin cell but I am going to use 4 rechargeable AA batteries for power giving around 4.8 to 5V.  A white LED needs about 20mA, I was concerned that the 100mA output of the PIR won't be enough for 6 LEDs but after a quick try, things worked out well.
Raw PIR powering the lamp
The PIR only draws less than 1mA. A set of fully charged AA batteries lasted about 6 to 8 weeks but can last up to 3 months depending on your settings.  I set it at about 40 seconds delay and only gets triggered only when it is dark.  If you turn on the lights, the torch won't come on. The only glitch I noticed is that the PIR detects motion when you turn off the main light wasting a bit of the power from the battery.  Maybe the light bulb I'm using in the bathroom emits infrared light that is being sensed by the PIR. Not a big issue anyway.

EDIT: Now that I have built my 3D printer, I made a case for it.

6 comments:

  1. can i ask where did you connect the test pin?

    i bought the same sensor like yours but it does not react to movement. It just turned on the LED

    ReplyDelete
  2. Hi! Depending on when you want the sensor to turn on the light, you may need to adjust the potentiometers. One potentiometer is for the delay - how long you want the light to turn on after detecting a movement. Then the other potentiometer is for the lux. You can choose if it only turns on the light when it's dark to save power or you can choose to have it turn on the led even when it is bright.
    I hope it works for you. It works really well. =) Let me know if you need more help.

    ReplyDelete
  3. I adjusted the delay to 2S and the lux to both day and night detection. But still the LED was just ON the entire time. Though i got it working by connecting the LED to TEST pin but it only gives a very low current and voltage. It does not follow the 3V output as what was written on the spec. sheet. Thank you for your reply :D

    ReplyDelete
  4. Oh, I didn't use the test pin at all. The LEDs are connected to the load pins. On the sensor itself, it is labeled as "OUT". Please check out the video I just made. Maybe it can show where the wires are connected.

    Hope it helps...

    ReplyDelete
    Replies
    1. thank you sir it's now working! my mistake was connecting the -LOAD to the ground of the circuit!

      thank you so much for your help!

      Delete