How to Make a Simple Motion-Activated LED Night Light For Your Dark Hallway
Introduction
Having a dark hallway at night can be inconvenient and even dangerous if you're trying to navigate through it. Installing a regular night light can help, but it means the light is on constantly, which can be annoying if you don't need it at the moment. A motion-activated night light solves this problem beautifully - it will turn on automatically when you walk by, lighting up the space temporarily so you can pass through safely.
Making a motion-activated night light is a simple electronics project that's perfect for beginners. With just a few common components, you can build a useful gadget for your home in less than an hour. In this article, I'll walk you through a step-by-step guide on how to make a motion-activated LED night light for your dark hallway.
What You'll Need
To build the motion-activated night light, you'll need the following components:
-
Arduino Uno - This is the microcontroller board that will control the night light circuit. The Arduino will monitor the motion sensor and turn the LED on when triggered.
-
PIR motion sensor - This infrared sensor detects motion in its range, allowing the Arduino to turn the light on when needed. Get one with a good viewing range for your hallway.
-
LED - Get a bright LED that will illuminate your hallway. Pick a color you like.
-
220 ohm resistor - Limits current through the LED to prevent damage.
-
Jumper wires - For making connections between components.
-
Breadboard - Allows you to easily prototype circuits before soldering.
-
9V battery & cable - Powers the Arduino. You can also use a 9V wall adapter.
-
Light enclosure - A case to mount the finished circuit in. You can 3D print or buy one.
Circuit Design
Here is how to connect the components together:
-
Connect the LED through the 220 ohm resistor to Arduino pin 11.
-
Connect the PIR motion sensor to +5V and GND.
-
Connect the PIR output to Arduino pin 2.
-
Power the Arduino with a 9V battery through the barrel jack or Vin pin.
This circuit will light up the LED when motion is detected by the sensor. The resistor protects the LED from excess current.
Arduino Code
The Arduino code monitors the PIR sensor and turns the LED on when triggered. Here are the key points:
-
Set pin 2 as input for the sensor and pin 11 as output for the LED
-
In loop(), read the sensor state. If triggered, turn LED on for 5 seconds.
-
Use delays after activating the LED, so it doesn't strobe on/off rapidly.
-
Make sure to initialize pins in setup() before using them in loop().
There are many example sketches online for reference. The code can be tweaked to adjust light duration, trigger threshold, etc.
Construction
Follow these steps to build the night light:
-
Prototype the circuit on a breadboard first to test it out.
-
Once working, solder the components together on a prototyping board or stripboard.
-
Mount the Arduino, PIR sensor, and circuit board inside a plastic enclosure case.
-
Drill holes for the LED, motion sensor, and power cable to fit through.
-
Optionally, 3D print or build a custom enclosure that directs the light where needed.
-
Power the project with a 9V wall adapter plugged into the barrel jack.
-
Mount the enclosed night light on the wall of your hallway with hardware or double-sided tape.
Usage Tips
Here are some tips for optimal use of your new motion-activated night light:
-
Place the light high enough to clearly illuminate the hallway but away from other light sources that could trigger it unintentionally.
-
Adjust the PIR sensor orientation so it best covers the area you walk through.
-
Set the LED brightness and duration to suit your needs. A short bright burst is ideal.
-
Use the fresnel lens on most PIR sensors to adjust the detection range as needed.
-
Make sure no obstructions block the sensor's line of sight for motion detection.
-
For total darkness, add some black tape to dim ambient light entering the light enclosure.
Customization Options
There's many ways to make this project your own:
-
Use multiple colored LEDs to get creative mood lighting effects.
-
Add an ultrasonic sensor instead of PIR for touchless control.
-
Power it with an 18650 lithium battery for a portable version.
-
Connect it to WiFi and control via smartphone by adding an ESP8266 board.
-
Improve the enclosure with laser cut acrylic panels and intricate designs.
-
Create different housings for unique mounting situations.
-
Experiment with LED strip lighting for wider coverage.
-
Connect several units to light up a large area.
So that's it! With these instructions, you should now have the knowledge to build your own useful motion-activated LED night light. Let your creativity run wild to make it look awesome too. No more stubbing toes in the dark hallway!