Intro: PIR Energy Save Light Switch
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.
Step 1: Parts Required
- Arduino Nano (1) - Adafruit/Amazon
- PIR Sensor (1) - Adafruit/Amazon
- Relay Board (1) - 10A 125V - Amazon
- Power Cord (1) - Medium to Heavy grade - Lowes/Home depot
- Blue Electrical Switch box (1) - Lowes or Home depot
- White plate switch box cover (1) - it comes with screws
- Enclosure to hold PIR Sensor and Arduino Nano - Container Store
- Drills/Step Drills
- Dremel Circular Sander
- Connecting Cables
- Zip Ties
- Nylon Screws and Nuts - eBay
- Nylon PCB Stand offs - eBay
- Soldering Iron
- Wire Cutter
- Safety goggles
- Safety mask
- Safety gloves
- Small Filing set
Step 2: Check Your Relay for Faults and Shorts
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.
Step 3: Build Relay Switching Enclosure
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.
Step 4: Preparing the Wire
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.
Step 5: Connect Wires to the Relay Board
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.
Step 6: Installing PIR Sensor
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.
- Mark the top cover of the Box, stick a Painters tape and drill a hole
- Use a step drill to enlarge the hole.
- Use Dremel to sand off and make the hole right size.
- On the 2 sides of the box, make 2 holes for Mini USB and Wires for Relay control.
- File the holes till they get to required shape and sizes.
The Mini USB is used to modify/troubleshoot programs to the microcontroller.
Step 7: PIR Box Top Cover Ready
The PIR Sensor top cover is ready. Now its time to wire the PIR sensor to the Arduino board.
Step 8: Wiring PIR to Arduino Board
Remove 3 connection pins on the PIR sensor and solder 3 small wires. These wires will connect to
Connect Arduino D2 to PIR Output (Center pin)
Connect Arduino +5V or 3.3V to PIR Vcc pin
Connect Arduino GND to PIR ground pin
Step 9: Connect Relay Board to Arduino
Connect Arduino D5 to Relay Signal In
Connect +5V to +5V or Vcc pin of Relay
Connect Arduino GND to GND pin of Relay
Step 10: Close the PIR Enclosure
Use a little bit of hot glue to secure the Arduino Board and PIR Sensor and close the PIR Enclosure. I am using Blue one as top cover and used white one for Demo purposes.
All the best in making the enclosure.
Please be safe and careful.
Step 11: Load the Arduino Program
Connect the Arduino board via USB and load this sketch.
Step 12: Enjoy Your Project
Enjoy your Creation. Please be careful to monitor at all times when this unit is ON. Keep this project away from children. Turn off if you are going out or leaving out of town. Be safe.