You know how it goes - you wake up in the middle of the night to go to the bathroom, can't see anything, and knock something valuable over. Or, you come home late, the lights are already off, and you stub your toe trying to find the switch.
No longer! We've solved the problem of late-night lighting in a hands-free way that's stylish and won't disturb your roommates.
Like this Instructables? Check us out on Facebook!
Introducing the Automatic Hallway Runner Lights.
Total project time: 3 hours
To get started, you'll need the following parts:
- Breadboard for prototyping
- Soldering iron (and solder)
- Wire strippers/cutters
- Heat gun (or hairdryer, or lighter)
- Hot glue gun (to secure loose wires)
Step 1: Build the Circuit
Now that you have all your parts in hand, it's time to build the lighting controller! This circuit turns the runner lights on or off depending on the current light levels in the hallway (detected by the photocell) and the presence of a moving object (detected by the PIR sensor).
Step 1: Headers
We want to mout the arduino to the protoboard using two of the female header sockets. Align two of the headers so that pins D7 to TX and A2 to VIN will be connected to the board when the arduino is plugged in, then solder them in place. Next, take another 10-pin female header and cut it into two 2-pin sockets and one 3-pin socket. Install these three sockets; the photocell and LED strip both need two pins, and the PIR sensor needs the three-pin socket.
Step 2: Cables
We wanted the PIR sensor and photocell to be mounted pretty far away from the board and the LED strip - about 10 feet away! If you want everything near the PCB, you can skip this part.
We'll need to create two cables - one for the PIR sensor which has 3 wires, and one for the photocell with two wires. The photocell is easy - just cut a 10-foot length of our 2-conductor stranded wire. Strip one end and separate the leads before slipping some heat shrink tubing on for later. Then solder the two leads of the photocell, move the heat shrink over the solder joints, and heat it up to ensure a solid, insulated connection. For the other end, break off a 2-pin segment of the male header pins, strip the two conductors and solder each conductor to one of the pins. Add some some hot glue around the solder connection to ensure nothing will accidentally short these two leads.
It's a similar process to create a cable for the PIR sensor, but this time we want to use our 3-conductor stranded wire for each of the pins of the PIR sensor. Follow the same steps as before, but Instead of soldering the PIR sensor directly to the wire, cut a 3-pin female socket segment and solder this to the cable instead. The pins of our PIR sensor should fit nicely into this socket.
Step 3: Connections
Use your iron and some solid core wire to install and connect the remaining parts as indicated in the diagram.
Our PIR sensor's output pin reads 0V when no motion is detected and 5V when it senses a moving object. We could just feed this value straight into a digital input pin on the Arduino Nano, but we noticed that there was a large drop in power due to the 10'+ of wire we used to put the sensor in place. Instead, We hooked the sensor up to A6 and used analogRead() to check if the voltage is above or below a certain threshold.
The photocell is triggered in a similar way - combined with the resistor, it acts as a voltage divider. When there's a lot of ambient light, the photocell has low resistance and we see a low voltage; in the dark, we see close to 5V.
When we send a digital HIGH (5V) value on pin D3, that saturates our MOSFET and allows current to flow through the LED strip. The 100kOhm resistor attached to its gate acts as a pull-down, so that our LEDs actually turn off if the gate ends up floating.