PIR Motion Sensor Automation: The Best Tutorial
Everyone fantasies a home where all the appliances and devices work on their own without having the need for a user to intervene. This is a small step towards achieving that. Wouldn’t it be great when you no longer have to use a switch to turn ON a lamp when you walk into a room , or better yet when you forget to turn it OFF , it automatically turns OFF by itself when you leave the room? Or even if you want to make a burglar alarm using a PIR motion sensor.Using this easy tutorial and some very cheap and simple components you will be able to make the lamps, fans or other appliances in your room activated automatically when you normally walk into the room. Follow this simple PIR motion sensor hacking tutorial to get started. Have fun with this DIY hacking tutorial!
What are the stuff required to do this project?
- PIR Motion Sensor like this : PIR Motion Sensor.
- BC547 Transistor like this : BC547.
- A 5V relay like this : Relay 5V.
- A 7805 Voltage Regulator.
- A 1N4001 diode.
- Solder dot prototyping board.
- Two Pin Screw Connector.
- 9V battery.
So how does it work?
Here, we are using a PIR motion sensor. PIR stands for Passive InfraRed. This motion sensor consists of a fresnel lens, a infrared detector and supporting detection circuitry. The lens on the sensor focuses any infrared radiation/wavelengths present around it towards the infrared detector. Our bodies generate infrared heat and as a result this gets picked up by the motion sensor. The sensor outputs a 5V signal for a period of one minute as soon as it detects us.It offers a tentative range of detection of about 6-7 m and is highly sensitive. The output from the sensor (5V) is used to trigger a transistor BC547. The transistor then switches on a 5V relay. The relay correspondingly switches your appliance ON.
Step 1 : Assembling the PIR motion sensor and other components
Use a solder dot prototype board like above to assemble and solder the components. Or make your own PCB using the schematic given below. First of all solder the 7805 voltage regulator to the board. Next, solder a 9V battery connector’s wires to the pins of the voltage regulator as shown in the schematic. To find the pinout for the PIR motion sensor look at the picture on the top of the page , or check for markings on it : Vcc(+) , Gnd (-) and output signal (Out). Connect the PIR motion sensor’s Vcc and Gnd to 7805’s output. Connect the BC547 (pin out – Collector, Base , Emitter) collector to one end of the relay coil. The base to the output signal of the PIR motion sensor. And the emitter to the Gnd. The other end of the relay’s coil is connected to the input voltage (9V). Connect a 1N4001 diode with its cathode on the Vcc and the anode on the emitter of the BC547. The diode is used to protect the transistor by preventing any reverse voltage from the relay. Finally connect a two pin screw connector near the relay. The pins of the connector are soldered to the NO (normally open) terminals of the 5V relay.
Step 2 : Hooking the PIR motion sensor to an appliance
Depending on what you wish to control using the PIR motion sensor may it be a light bulb , fan , music player ,etc , split one of its input AC terminal wires. While ensuring the other line is connected to AC neutral. At one terminal of the screw connector on the board, connect an AC power line. At the other terminal connect the wire (you just split ) for the appliance you wish to control.
Power the board using a 9V battery. You will see that whenever you are within 6-7 m of the radius of the PIR motion sensor , the light or whatever appliance you connected to the board turns ON. The board switches OFF after about a minute when your no longer near the radius of vision of the PIR motion sensor. Depending on the PIR motion sensor you posses, it might have the capability to adjust the sensitivity or delay time for switching, adjust it correspondingly till it reaches the sweet spot.
You can even connect this PIR motion sensor to an arduino. Write code for the arduino checking whether 5V output is coming from the PIR motion sensor and correspondingly do actions. Using an arduino you will be able to do more complicated tasks like adding extra variables of time, etc. You will be even able to make burglar alarm/securiy systems using the PIR motion sensor . Let your imagination go wild with this DIY hacking tutorial for a PIR motion sensor.
In this video I am demonstrating how the PIR motion sensor can be used to automate the lights near your dressing table. It detects my presence and switches the lights on the dressing table ON. It stays ON for about a minute and then switches OFF when it no longer detects my presence. This sensor has a very high sensitivity, hence it detects the presence of a person immediately with minimal delay. The PIR motion sensor in action :