This Instructable will show you how to construct A Passive Infrared Sensor (PIR sensor) to Turn On and Turn off lights. The PIR sensor gets activated when light radiating from objects are present in its field of view. This Signal gets passed onto the Microcontroller which has a logic to trigger the power relay and after 10 mins it will turn off the lights if it does not see any movement. This delay can be further adjusted in the Arduino sketch. First, I will show how to assemble the Relay board then we will assemble a PIR Sensor with Arduino Nano and wire them up. Please read the disclaimer before we get started.
Disclaimer and Warning:
If you perform any of the steps in this instructable, you assume all risk for the outcome. Working with high voltage can be extremely dangerous. If you are not qualified and don't have experience with Electrical, Electronics and high voltage please do not try this instructable. I cannot be held responsible in any way.
Please pay special attention to all connections and always use Good quality wires and components. Stay away from cheap, fake ones. Do not overload the Relays more than they are capable of. Test the power relays make sure they are not shorted before adding it to any Circuitry. Wear safety mask, gloves, goggles to protect you while soldering and work in a well ventilated air circulated environment.
Please Check your Relay for faults (before connecting to Mains voltage). This test ensures you don't have a short between the mains supply and the Micro-controller Inputs.
Turn your Multimeter to Continuity mode. Please make sure the multimeter battery is good. Put one lead of multimeter to one pin of relay on the main side and other pin to Micro-controller Inputs (Vcc, Gnd and In). ** Make sure it does not beep **. If it beeps, that means you have a faulty Relay. You can upgrade to more reliable high quality power relays like Omron, Fujitsu, Panasonic. They are not very expensive and can be brought directly from Mouser Electronics.
After you have tested the Board and good, lets proceed to the next step.
Separate the relay enclosure from Microcontroller and PIR circuit. This ensures proper safety and can also help re-purpose the relay switch for other projects. Drill and Assemble the Relay board using Nylon screws/nuts and stand offs as shown in the pictures. Do not use metal screws as they are good conductors of electricity. High quality Nylon nuts/screws can be bought from many US based online stores.
The blue electrical switch box has 2 slots to the left and right for wires to come in, take a screwdriver, bend it a little and push the wire. Don't break the open slots and it will lock the wire in place later.
The Step shows the Picture of live hot socket. Follow the Small blade of wire carefully this wire is hot and should be connected to the Relay carefully. Mark it Hot. If you are using other wire types, Please pay attention to check the Hot vs Neutral vs GND wire. Since I am using a lighter grade wire for connecting the lamp, both wires are white , in which case follow short blade of wire and connect as shown in the next step to the Relay.
Connect wires to Relay as shown. Make sure you peel off the wires, twist and solder the wires trim it to fit the Relay terminal and zip tie them. On the right hand size connect the Microcontroller wires and supply wires and zip tie them up too as shown in the picture. Get the Wires out for the microcontroller and close the face plate.
I get my project enclosures from Container store. Its a great place for any type of enclosures. This is a plastic enclosure approx 2 inches square in size. For demo sake I am using Transparent box.
The Mini USB is used to modify/troubleshoot programs to the microcontroller.
Connect the Arduino board via USB and load this sketch.