Wire a $15 sensor to any porch fixture and you have hands-free light in less than an hour. A 9-foot cord, wire nuts and a ½-inch knockout are all you need for the majority of US outdoor boxes.
In this handy guide, we list the exact parts sold at Home Depot and Lowe’s, show the three-wire hook-up and provide placement tips that prevent false trips from swaying palms and passing dogs.
Your Project Blueprint

A hallway LED system that flips on only when feet pass by needs three clear roles: eye, light, and brain. Choose each component once and everything else aligns.
Sensor Choice
Take the SR501 PIR white dome. It has a 120° wide cone that surveys the entire hall with no aiming. It has two tiny brass screws. The left one sets the range and the right one sets how long it stays awake.
Solder a 3-pin header so jumper wires snap in quick. The pinout is VCC 5 V, GND, OUT. If the sensor stares at a busy stairway, twist the left screw a quarter turn counterclockwise to reduce the range and prevent false triggers.
Have a spare PIR on the shelf. At $2 a pop, swapping is quicker than debugging.
Light Selection
Decide first job: soft white glow for midnight snack runs or bright flood for security. We used a 12 v WS2812B strip with sixty LEDs per meter to get smooth light with no hotspots.
A 30 cm strip draws around 200 mA and matches to your supply so nothing melts. Peel backing, press on to MDF lid for 10 seconds, bond holds. Trim just at copper pads identified with a scissor icon and employ wire cutters whilst watching the arrow denoting data flow direction.
Power Source
Take apart an old 12 V 1 A wall wart and follow the brown (live) and blue (neutral) wires. For bigger halls with long strips, step it up.
One maker upgraded from a 20 A supply that browned out to a 70 A brick feeding energy every five meters to prevent color shift. Throw a toggle switch on top so you can kill electricity quickly.
Tape-mark the DC barrel ’12 V IN’ to prevent house guests from shoving 9 V batteries in by accident.
|
Part |
Rating |
Notes |
|---|---|---|
|
Wall adapter |
12 V 70 A |
Needed for full-length strip |
|
Toggle switch |
3 A 250 V |
Mount in lid |
|
PIR sensor |
5 V logic |
Draws <50 µA idle |
Smart Integration
Drop in an Arduino Pro Mini for sunrise-to-sunset logic: run its 5 V pin straight to PIR VCC. Customize the NeoPixel library so movement on digital pin 2 rouses the board, the lights fade up and then after thirty seconds of stillness, everything falls asleep again.
Use the interrupt pin so the CPU naps between checks and conserves watts. Load code through the FTDI board at 5 V and 57,600 baud. Save the sketch on the Cloud so next year’s hallway hack is a copy-paste affair.
Gather Your DIY Toolkit

Print the free .dxf box plan on plain letter paper, spray-adhesive it to 3 mm MDF and cut the four walls with a coping saw. A 20 tpi blade leaves a kerf that matches the tab slots, so corners square up without filler. Sand the edges on 120 grit taped to the bench.
Two quick swipes per side prevent the plywood skin from splintering when you snap the pieces together later. Dump all the vital nuts and bolts into a vacant tuna can prior to beginning. The BC547, 10 kΩ resistor, 1N4007 diode and the tiny PIR board just love to roll off the desk and under the couch.
A five-ounce can is just wide enough that the relay fits flat and deep enough that the screw terminals do not snag the rim. Wrap the LED strip in anti-static foil the instant you open the anti-tam bag. Last winter a reader in Pasadena sacrificed one half of a strip to a 200 V snap from a wool sweater.
The SMD chips turned black dots and declined to illuminate. Fold the foil over twice, stick on a post-it note that says ’12 V test done’ and you don’t have to wonder later if the strip is still good.
Core Electronics
Solder the 10 kΩ resistor between PIR OUT and BC547 base. This resistor limits base current to 0.5 mA, so the PIR stays cool and the transistor never saturates too hard. Trim the leads to 4 mm, bend them into little hooks and tack the joint in less than three seconds.
Long iron time pushes the resistor value higher. Insert the BC547 into the breadboard with the flat side facing the resistor. The pin order is emitter, base, collector from left to right when looking at the flat face.
If you plug it backwards, the collector ends up on the wrong strip and the relay will chatter like a Geiger counter. I find that a dot of white-out on the board next to the emitter row saves me from flipping the part six times.
Wire the emitter to GND and collector to the relay coil. The 5 V logic now switches 12 V safely. A diode across the coil clamps the back-spike and the transistor lives a long life. Hot-glue the relay to the MDF floor as long as warm.
Once cooled, the bond withstands slamming screen doors and skateboard bumps.
Lighting Components
Measure the LED strip to the lid and cut 5 mm short so the end caps close flush. Tin copper pads first by dabbing solder, then melt again as you feed the red 12 V and black GND leads. Pre-tinning prevents cold joints that look shiny but fracture a week later.
Slide 2:1 Heat-shrink over each joint and shrink with a lighter waved underneath, not in the flame. I can’t envision the sleeve is tight enough for porch rain. Quick test: Hook a 12 V drill battery to the strip.
If every LED glows the same warm white, you’re safe to screw the lid shut.
Essential Tools
Carry a mini terminal driver kit. PH0 and 2mm flat fit every PIR and relay screw sold in America. Needle-nose pliers bend the BC547 legs 90° so the transistor sits flat. Flat legs don’t pop out when you move the board.
A $9 multimeter in diode mode will read 0.7V from base to emitter. Anything else means the part is fried or you bought a fake. Clip leads end up in a baby-food jar with a magnet glued to the lid. There are no more blood-draws from stepping on sharp tails.
Safety Gear
Before you touch the Arduino Pro Mini, strap on an anti-static wrist band. The chip dies at 50 V and your finger is a 1 kV thundercloud on dry LA days. Safety glasses prevent flying SMD resistors from stabbing your eyeballs when you snip the LED strip.
Kill the 12 V wall supply at the outlet before you yank bare wires. Spark scars on knuckles take weeks to fade. Park a 1 lb CO2 extinguisher on the bench. Relay sparks are rare and Murphy loves rookies.
Assemble Your Motion Sensor Light
Place the MDF box base on the bench, label side down. Mark four pilot holes 5 mm in from each corner. This keeps screws clear of the edge grain and prevents splits when you cinch the board. A 1 mm bit should do the trick. The thin hole still gives the screw lots to bite.
Place the PIR sensor on the lid. Align the dome such that it protrudes 3 mm above the surface. This small space provides the fresnel lens with its complete 7 m sweep across a typical garage. Hand-tighten the nylon nut underneath. Over-torque cracks the plastic ear.
Drill a 4 mm port through the back wall for the LED strip wires. File the hole with a mini round file, rotating it until the edge feels glass-smooth. Any burr will cut the red wire’s jacket and short 12 V to the box down the road.
Lay your paper sketch next to the components. With all the parts sitting where the sketch says, hot-glue sparingly. Once the blob cools, errors require a chisel and fresh MDF.
1. Map The Circuit
Sketch the path on scrap cardboard: PIR OUT pin goes to a 1 kΩ resistor and then to the BC547 base. The collector pin clicks the relay coil. The LED strip feeds from the relay NO terminal.
Use a red sharpie for 12 V, a yellow sharpie for 5 V, and a black sharpie for ground. The color stripes keep fingers out of wrong holes when the light fades. Dab the strip’s anode side with a silver marker so polarity never flips.
Take a phone picture of the breadboard before you transition to perfboard. One loose jumper at dusk burns ten minutes of guesswork.
2. Mount The Brains
Glue the relay dead-center. Its contacts stay 10 mm clear of walls so air moves. A scrap of craft foam under the Arduino Pro Mini raises the reset button from bare metal.
Point the PIR dome at the door, 3 ft high—pets walk under, people walk through. Two M2 screws and washers secure that DC socket, so a strong tug on the cable won’t dislodge the box.
3. Wire The Sensor
Strip 5 mm on each PIR lead, twist, tin with a hot iron for 4 seconds, and solder wicks into strands and slides into terminals like butter. Run one black jumper from PIR GND to a single ground rail.
Star grounding ends ghost triggers. Hold the white signal wire two finger widths from the fat red 12 V line. Together, they cause flicker via crosstalk. Once screws are tightened, give each wire a two-pound pull.
Anything that slips now breaks later inside a closed box.
4. Connect The Lights
Connect the LED positive to the relay NO pin. The lights remain dark until motion flips the contact closed. Bridge the relay COM to the 12 V rail with 6 inches of 22 AWG red wire.
Fat copper drops virtually no voltage at one amp. Slip colored heat-shrink over joints: red for energy, black for ground, and blue for signal. This makes tracing easy in tight spaces.
Zip-tie the cable tail to the box wall so door slams never yank the copper pads off the flex PCB.
5. Final Power-Up
Plug supply in, toggle switch up. PIR red LED blinks once at boot and settles after a thirty-second warm-up, as per spec sheet. Wave across lens — relay clicks and white strip floods within two heartbeats.
If silence greets you, kill electricity and test transistor collector with a meter. It should rest at 12 V idle and drop near zero when ON. When the test passes, drive four corner screws home and label lid Motion Closet Light 12 V.
Program The Controller

The eight-bit AVR RISC chip on the Pro Mini waits for three things: 5 V from a wall wart, a clean sketch, and your timing rules. Get those right and the lamp lights when feet fly out of bed, then shuts off when the room settles.
Logic Flow
-
Build a tiny state machine: IDLE to MOTION to LED ON to DELAY to IDLE.
-
Add a re-trigger flag so new motion inside the 30 second window keeps the light alive. There is no blink-show in the hall.
-
Read an LDR A0 if the analog value is greater than 204, which is 80 percent.
-
Skip the relay, saving daytime juice.
-
Save ‘onTime’ in EEPROM. Twist a pot later and the new value sticks without an additional USB cable.
The code below parks the PIR motion sensor on pin 2 interrupt, drives the motion activated LED strip kit or relay on pin 9, and prints “Motion” at 9600 baud for real-time monitoring of kitchen movement.
#include <EEPROM.h> volatile bool flag = false; byte onSec = EEPROM.read(0); if(onSec > 60) onSec = 30;
void setup() { pinMode(2, INPUT); pinMode(9, OUTPUT); attachInterrupt(0, flip, RISING); Serial.begin(9600); }
} } void flip(){flag = true;} void loop(){ static byte state = 0; unsigned long start; if(state==0 && flag && analogRead(A0)<204){
state = 1; start = millis(); digitalWrite(9,HIGH); Serial.println(F("Motion")); flag = false;
} if(state==1 && millis()-start > onSec*1000){
digitalWrite(9,LOW); state = 0;
} }
Code Upload
Press reset on the Pro Mini until the IDE bar turns orange, release. The bootloader snatches the stream and you escape the dreaded “not in sync.” Switch green and yellow one time if it doesn’t. Rookie TX/RX mix-ups burn more time than bad code.
Three quick blinks equal handshake done, so yank the FTDI and feed the board straight 5 V on VCC. Your fixture now thinks for itself.
Sensitivity Tuning
Turn the SR501 range screw a 1/2-turn clockwise for a long LA hallway. Turn the screw counter-clockwise to 5 seconds inside a pantry so bulbs lie between chiptime snack raids.
If a stairwell fires too high, slap electrical tape across the top third of the dome. This blocks upward drift but maintains peripheral vision to feet.
Walk-test after dusk with the pot. Tape the farthest place you can reach with blue painter tape, then nudge the pot until that spot is three meters out. Clean on, clean off.
Smart Placement Strategy
Hang the lamp at 6.5 feet. A sixteen-inch tall cat walks underneath the PIR cone and never triggers it. Tilt the sensor eye down 15 degrees. It detects leg heat first and discounts the ceiling fan draft.
Don’t place the lens toward windows. Sunset heat can fool the sensor and fry the LEDs all day. In an L-shaped hallway, position a pair so their coverage areas overlap by three feet. Not a blind spot remains dim!
Indoor Zones
Stick the LED strip beneath the closet shelf lip, stick the sensor on the side wall. The light pops on when the door opens two inches. Inside the pantry, mount the unit on the inner frame.
It activates only when a torso enters, not when a person strolls by the door. Ceiling-mount the box in the hall and set a twenty-second hold. Kids make it to the bedroom before fade-out.
For a bathroom nightlight, choose a half-watt warm-white strip and attach a light sensor so daytime motion is ignored.
Outdoor Areas
Paint the MDF box with two brush coats of outdoor polyurethane. Drill a 1/8 inch hole in the bottom so rain drains. Under the stair eave, screw the sensor to the trim and run a twelve-volt battery with a five-watt panel.
The rig stays dry and never needs new cells. In the garage, connect the motion strip to the main light circuit via a 10-amp relay. The LEDs support the bulb when the door rolls up.
Across the driveway, point your PIR lens sideways. A car’s horizontal roll trips earlier than head-on movement.
Pet Considerations
Raise the lamp to five feet. A dog’s warmth stays at two feet and falls outside the focused beam. Turn the sensitivity screw to its lowest setting.
A thirty-pound cat still bypasses, but a man activates it. Slip a black PVC pipe hood around the dome. It slices the view to a ten-degree tunnel.
Program a five-second grace. If motion ceases quickly, the chip disregards the tail wag and leaves the light off.
Troubleshoot Like A Pro
Most boards die from dumb stuff; check these motion sensors first.
- Kill electricity, wait ten seconds, and reapply. Half the faults clear.
- Check the lens for spiderwebs. One strand flips the PIR high.
- Meter the source. A 12 V wall wart might sag to 9 V under load.
- Replace the BC547 with a new one. Transistors fail silently.
- Phone camera in night mode reveals a weak red glimmer if the eye still breathes.
- Voltage divider with LDR should swing from 0 to 5 volts, not from 0 to 1.
False Triggers
Hot air from the attic vent wafts across the Fresnel lens. The chip believes a person passed by. Move the lamp six inches east and the ghost ceases.
A 100 µF capacitor across VCC and GND sips the 200 ms dip when the fridge kicks, slaying another batch of phantom trips. Twist the white signal wire with its own ground and the pair cancels the buzz from a two-amp phone brick on the same stud.
The sensitivity pot has an eighth turn to the left until your porch light stops welcoming raccoons. Dab white paint so you don’t forget that sweet spot.
No Activation
Wave a hand and the PIR OUT pin will bounce from 0V to 3.3V. If it rests flat, then it’s the pyro chip that fried. Jumper 5 V direct to relay coil.
A neat click signifies the load side is alive. No click means a burnt coil. Drag a magnifier across the board and search for a hairline break on the transistor base trace.
Even a micron gap silences the gate. A 12 V pack that reads 9.8 V under bulb load sustains logic but renders the LED strip black. Exchange or charge before you ghost hunt.
Flickering Lights
Loose neutral in the relay terminal increases resistance and the 12 V strip strobes like a disco. Fatten hookup wire from 24 AWG to 20 AWG.
Skinny cords lose a full volt on a ten-foot run and whites flicker like candles. Code can help: set a 2000 ms debounce so rapid pulses collapse into one steady ON.
|
Cause |
Quick Fix |
|---|---|
|
Loose neutral screw |
Re-seat and torque 5 lb-in |
|
EMI from charger |
Twist signal/ground pair |
|
Skinny wire voltage drop |
Swap to 20 AWG copper |
|
No debounce in code |
Add 2 s delay before off |
Conclusion
You rigged a light that turns on when you pass. That little box on the wall now watches your every move and slashes your electric bill. Give yourself a little pat on the back, then adjust the angle or timer if the pooch still trips it. Take a picture, tag the neighbors, and exchange tips across the fence. Prepare for round two. Pick up a second kit this weekend and brighten the side yard.
Frequently Asked Questions
Do I need a permit to install DIY motion sensor lights in Los Angeles?
Almost all battery and low-voltage kits don’t require a permit. Hard-wired 120 V ones do. Pull an LADBS ‘over-the-counter’ electrical permit if you add a new box or switch.
Will the sensor trigger every time a possum walks by?
Turn the sensitivity down to 25 to 30 percent and tilt the lens 5 to 7 degrees toward the ground. That bypasses little animals but still grabs humans.
Can I mount the light on stucco without cracking it?
Yes. Drill a 1/8 inch pilot hole, then insert 1 ½ inch plastic anchors. The hole distributes pressure and prevents stucco from popping.
How long do batteries last in wireless kits?
Three good AA lithiums last something like 8 to 10 months at 10 triggers a night. L.A. Heat fries alkalines, so make it lithium.
My light stays on all night—what’s the fastest fix?
Position your hand to cover the sensor. If it remains illuminated, it is in manual “override” operation. Flip the wall switch off for five seconds, then back on to reset to auto.
Is dusk-to-dawn mode worth it in SoCal?
That is, except you want walkway glow all night. It kills batteries quicker and adds 30¢ a month to your bill, which is tiny, but motion-only saves more.

