Introduction: Arduino Night Watchman Light

When you leave your house for extended periods, you may want to make it seem as if someone is at home switching lights on and off in the evening. Contrary to a preset scheduled timer (or one which sleeps) and can easily be detected from outside, this DIY Arduino based timer uses light intensity to detect low light levels and randomly turn lights on and off all through the night making it seem as if there was someone present in the house.


Disclaimer: I receive commissions from purchases related to the links on this page.

1x Electrolytic Capacitor capacitance 100µF; voltage 16V

1x Keyes Relay

1x Arduino Mega 2560 (Rev3)

1x KY-018 Photoresistor

All the components can be found on BangGood by clicking on this link

Step 1: Arduino Night Watchman - Wiring Diagram

Step 2: Arduino Night Watchman - Code

The code was written using the standard Arduino IDE and contains comments for each section.

You can also get it from my GitHub

Arduino Night Watchman Code

How does it work ?

//Sample the ambient light

//Only operate at night

//Create a schedule to turn on the lights randomly between 45 - 90 minutes for a period of 2 - 7 minutes

//Repeat untill morning

Step 3: Arduino Night Watchman - the Actual Physical Setup

Could be cleaner, but it does the job.

Happy building :)