A light that turns on only when somebody is nearby can save energy, can save you the hassle of searching for a lightswitch in the dark, or can also alert you to the presence of an unwanted visitor. A PIR sensor is an infrared motion detector and it is easily connected to a PolyBlock which, in Timer Mode, can turn a light on automatically for a specified period of time when somebody is within range.
The PIR sensor works by comparing the outputs of its two internal infrared sensors. With no motion within the sensor's range, these two internal sensors settle to an "off value". When a person (or other large infrared-producing body) comes within range, the values the two infrared sensors record changes from the off value, and the PIR interprets this as motion. The PIR sensor outputs a Logical "1" or 5V on its output for a second or two after the motion stops. This is a weak digital signal so by itself it couldn't run a light (or anything, really bigger than a small LED) . We could connect it to a Switch Box, and thence to a large lamp, but this wouldn't help much either, since the PIR signal is only on for a few seconds after it detects movement. We'd like our light to be on for much longer.
STEP BY STEP
Step 1 - Connect the Power Supply
First we need to choose a light and an appropriate power supply. The main determining factor here is how much power the light is going to need. The +V connections will be determined by the voltage of the fan - i.e. a 12V light will require a 12V power supply. A smaller light that runs on 9V, for example, would make it possible to use a standard 9V battery as the power supply. Be sure to power the PIR sensor from the 5V connector on the PolyBlock, not +V. Note that an AC (110V) household light would definitely not work directly with this set up and would certainly damage any connected devices.
Depending on your choice of light, you'll need to choose an appropriate power supply, as mentioned above. With your power supply selected, connect the +V (positive) from the power supply to +V on the PolyBlock and the 0V (ground/negative) from the power supply to 0V on the PolyBlock (Fig. 1.1). You may need to strip 1/8" insulation off the wires from your power supply.The PIR sensor has three wires coming out of it. The red wire goes to 5V on the PolyBlock, the black wire goes to 0V, and the yellow wire should be connected to I2 (Input 2). Set the PolyBlock to the Timer Function by manipulating the Function Switch to 0010. I2 on a Poly Block set to the Timer Function corresponds to the Sustain Trigger input. This means that as soon as the PIR is triggered, the light will turn on but the timer will not start counting down until the PIR is inactive. The length of the timer will determine the amount of time that the light remains on after nobody is in range of the PIR sensor.
Step 3 - Prepare the Light
Because halogen lights create electrical noise on the lines that power them, if we use them, it is important to filter the power going to them with a capacitor. The capacitor needs to go between the two wires going to the light and should be around 0.1uF and be rated to work with at least the +V voltage you're using.
To do this, we need to make one solder connection from the positive lead of the capacitor to the +V line going to the light, and another from the negative lead of the capacitor to the 0V (ground) line to the light. Solder a short length of wire (appropriately colored - black or red) onto each of the leads of the capacitor and then use these wires to make the connection with the appropriate wires from the light. Heatshrink any exposed solder joints to prevent unwanted shorts and to add a little physical support.
Step 4 - Connect the Light
Assuming the chosen light is not going to draw more than 2A of current, it can be connected directly to the PolyBlock. If your light draws more than 2A of current, you can add a Switch Block to increase the allowed amperage. Connect the positive lead from the light to the +V connector on the Poly Block and the negative lead to the S0 (Switch 0) connector (Fig. 4.1). To connect a household lamp to a standard power outlet, please see the AC Switch Block. Again, be sure that your power supply provides the correct +V for the light you've chosen.
Step 5 - Power Up
With the power supply still unplugged, double check all of the power connections to make sure all the 12V's, 5V's, and 0V's are properly connected. Once you're confident everything is where it should be, plug in the power.
Step 6 - Calibrate the PolyBlock
As described in the Timer function reference for the PolyBlock, the onboard trimpot can be used to adjust the amount of time that the light will stay on once the PIR is triggered. This can range from anywhere from a few milliseconds to almost 20 minutes. Start with the trimpot turned all the way counter-clockwise. This will give you the shortest timer period possible. Gradually turn the trimpot clockwise to adjust the length of the timer as desired.
Reference
http://www.makingthings.com/teleo/teleo/cookbook/nightlight/index.htm#step1
No comments:
Post a Comment