
A street light that's off in the day and dims itself at night. It only goes to full brightness when the PIR sensor sees someone on the road. On a quiet lane most of the night is spent at 20 to 40 %, so it uses much less energy than a lamp left at 100 %, and the LEDs last longer too.
| Time | Brightness |
|---|---|
| Day | Off. Motion is ignored. |
| First 4 hours after dusk | 40 % |
| Late night | 20 % |
| Motion detected | 100 % for 60 s after the last movement, then a slow 3 s fade back |
| TEST button | 100 % for 30 s, day or night, for maintenance checks |
Day and night come from an LDR, with two filters so the lamp doesn't flicker on and off:
Brightness is mapped through a squared curve, so 20 % actually looks like 20 % to the eye.
| File | What it is |
|---|---|
firmware/smart_street_light/smart_street_light.ino | Firmware |
firmware/build/smart_street_light.hex | Real-time build |
firmware/build/smart_street_light_sim_x10.hex | Timers 10x faster, for Proteus |
test/sim_test.c | Automatic bench test (simavr) |
ARDUINO UNO, TORCH_LDR (or LDR) with a 10k RES to GND, BUTTON, IRLZ44N (or IRF540), a LAMP or LED string with a 12 V BATTERY, and a LOGICSTATE to stand in for the PIR output.images/wiring.png. The LDR goes from +5 V to A0, and the 10k from A0 to GND. D9 drives the MOSFET gate through 100 Ω, with 10k from gate to GND. The lamp sits between +12 V and the drain, and the source goes to GND.firmware/build/smart_street_light_sim_x10.hex and run it.Save it as proteus/smart-street-light.pdsprj and commit it.
Use a constant-current LED driver with a PWM or 0-10 V dim input. Don't switch an LED module directly with a MOSFET at mains level. The Arduino PWM (490 Hz on D9) can drive the driver's dim input through an optocoupler. Fit the PIR in a hood so it only sees the road, not swaying trees.
The test covers the day, ignoring motion and short shadows, dusk at 40 %, headlights at night, motion to 100 % with hold and fade, the late-night 20 % level, dawn confirmation and the TEST button.