Introduction: Home Automation: Build a Motion Sensing Light Switch in Less Than $3
Getting up in the night and visiting bathroom in the dark is a task. Struggling to find the right switch to switch on the lights. And here in India if you leave the Light switched on then even God can't save you from the mother's wrath. This is the first time I've built a circuit which is not just a concept.
Actually all my instructables will be of things which I will use in my day to day life. This one is a beginner level project with only soldering kill required.
You can follow the steps written or alternately watch the embedded video.
Step 1: Collect the Parts.
Let's list the parts required for this build.
- PIR sensor. (Cost Rs. 135 / $ 2 amazon link) PIR sensor analysis change in infrared rays emitted by human body to set output pin high. We'll use this to trigger a relay to switch on/off.
- 5v Relay Switch. (Cost Rs. 42 / $.63 amazon link). Relay is used to trigger an AC load with a DC signal.
- General purpose NPN transistor (BC547/548, Salvaged it from a circuit.). The signal out from the PIR sensor is 3.3v and the relay needs 5v so we need the transistor to help trigger the relay.
- Diode is put across the coil pins of the relay so as to stop induced current in the relay coil to damage the circuit.
- Perfboard.(Cost Rs. 18.5 / $.28 amazon link). To put all these components together.
- To be able to run the circuit on 5v DC I broke open an old Nokia Charger and used it to power the circuit.
- Miscellaneous items (Soldering iron, solder, flux, project box, breadboard etc.)
Step 2: Testing the Setup on Breadboard First.
- Connect VCC of PIR module with +5V.
- Ground of the PIR module with ground of the power supply.
- The Output pin or the middle pin will connect to the base or the middle pin of the transistor.
- The emitter of the transistor (the right most pin of the transistor with the flat side facing you) is connected with ground.
- The LED is used to check whether the circuit is working or not. The LED with 100 ohm limiting resistor is connected in series with the collector (the leftmost pin of the transistor) and 5v.
- After everything is connected we will observe the LED switching on and then switching off. The sensor takes about 30 seconds to settle down, after that you can check the circuit with passing your hand in front of it.
- There are two settings L and H( pic 1 top right) on the PIR module. I put it on H setting i.e. re-trigger mode which means it will stay on while anyone is moving in front of the sensor. In L setting it will switch on and off alternately.
Step 3: Put It All Together.
Put it all together on a perfboard according to the schematic shown.
Caution: While working with AC be very careful. You can get a shock, burn down your house or even die. Switch off the mains before connecting it together.
Great Indian Jugadu
Participated in the
Beyond the Comfort Zone Contest