Introduction
Having a motion-activated night light can be extremely convenient and helpful around the house. Not only does it provide illumination when needed, but it also helps conserve energy by only turning on when motion is detected. The best part is that with just a few simple components, you can build your own DIY motion-activated night light for under $15!
In this comprehensive guide, I'll walk you through everything you need to know to build your own motion-activated night light on a budget.
What You'll Need
The great thing about this project is that it requires just a few inexpensive components that are readily available. Here's what you'll need:
Hardware
-
Arduino Uno - This microcontroller board serves as the brains of the operation. It's inexpensive and easy to program. You can find it for around $5-10 on Amazon or eBay.
-
PIR motion sensor - This sensor detects motion and triggers the Arduino to turn on the light. They're very affordable, usually $1-2.
-
LED strip lights - For the light itself, flexible LED strip lights work perfectly. A 16.4 foot roll is about $10 on Amazon.
-
9V battery - To power the Arduino. Rechargeable 9V batteries are best for reducing waste and costs over time.
-
Jumper wires - For connecting the components together. You'll need both male-to-male and male-to-female.
-
Mini breadboard - To neatly mount the components. These are around $5.
Tools
- Soldering iron
- Wire cutters
- Hot glue gun
Circuit Design
Here is a simple diagram showing how to connect all the components:
The Arduino acts as the brains, taking input from the PIR sensor and controlling the LED light strip accordingly.
The PIR sensor has 3 pins:
- VCC - Connect to 5V out on the Arduino
- GND - Connect to GND on the Arduino
- Out - Connect to Pin 2 on the Arduino
The LED strip light also has 3 pins:
- VCC - Connect to 5V out on the Arduino
- GND - Connect to GND on the Arduino
- Data In - Connect to Pin 9 on the Arduino
That's all there is to the wiring!
Code
Of course, for this project you'll need to upload a sketch to the Arduino to allow it to detect motion and control the light.
Here is the full code:
```cpp
int pirPin = 2; //PIR Out pin connected to pin 2
int ledPin = 9; //LED Strip pin connected to pin 9
void setup() {
pinMode(pirPin, INPUT); //Set pirPin as an input
pinMode(ledPin, OUTPUT); //Set ledPin as an output
}
void loop(){
if(digitalRead(pirPin) == HIGH){ //If motion is detected
digitalWrite(ledPin, HIGH); //Turn on the LED Strip
}
else{
digitalWrite(ledPin, LOW); //Turn off the LED Strip
}
}
```
This code continuously checks for motion on the PIR sensor. When motion is detected, it sends HIGH to the LED strip to turn on. When no motion is detected, it sends LOW to turn the LED strip off.
Construction
For the physical construction:
-
Mount the Arduino, PIR sensor, and breadboard inside an enclosure, like a small project box. Hot glue works well for securing them in place.
-
Drill a hole in the enclosure for routing the PIR sensor wires through. This allows the sensor to detect outside motion while protected inside the box.
-
Cut and solder connections between the Arduino, PIR sensor, and LED light strip according to the circuit diagram. Use jumper wires to make these connections.
-
Hot glue the LED strip light along the bottom of the enclosure and route the wire through a small hole.
-
Close up the enclosure and power it up! Make sure everything is working by waving your hand in front of the PIR sensor.
And that's it - you now have a motion-activated LED night light for under $15! You can customize it by using different colored LED strips, placing it in different locations, and adjusting the sensitivity and timing in the code.
Usage Tips
Here are some tips for getting the most out of your DIY motion-activated night light:
-
Adjust sensor sensitivity - If it's turning on when it shouldn't, try angling the PIR sensor differently or adjusting the potentiometer on the sensor board.
-
Set auto shut-off timer - To conserve power, you can add a timed shut off to the code so it doesn't stay on all night. 10-15 minutes is ideal.
-
Use rechargeable battery - A 9V rechargeable battery will save money and reduce waste over time. Just recharge it when needed.
-
Mount it effectively - For the best motion detection, install your night light 3-5 feet off the ground and angle the sensor outward.
-
Pair with existing lights - Have it activate along with other lights for full illumination when needed.
Conclusion
Building your own motion-activated night light is an easy Arduino project that anyone can tackle in an afternoon. With just a few common components, you can create a fully customized and functional night light for under $15.
Not only is this project affordable, but it's also an excellent way to learn Arduino programming and practice your soldering skills. So grab your parts and tools, follow the instructions, and enjoy your new DIY motion-activated night light! Let me know in the comments if you build one.