Using a light sensor, some wire, and LEDs you can easily create an automatic night light that will turn on when you turn off the lights.

Project Steps

These are the parts and tools you will need.

Connect the ground pin on the Arduino Uno to the ground rail on the breadboard. This is usually the first step in any project I do just so I can draw ground from any part of the rail.

Plug in your LDR Light Sensor into pin F 51 and F 53. Then connect a 10k resistor to G 51 and and G 46. Then a short wire from the ground rail to H 46. Then take a wire from the 5v pin on the Arduino to G 53. Then take a wire from digital pin 7 on the Arduino to H 51.

Now take a wire from the ground rail to I 40. Put a 330 resistor into H 40 and H 34. Take a wire from digital pin 1 on the Arduino to H 33. Since LEDs have positive and negative you will need to plug the longer end of you LED into G 33 and the shorter into G 34.

Repeat the process with another LED but this time use digital pin 2 instead of digital pin 1.

And repeat it again but use digital pin 3.

Now plug the red wire of the battery clip into the Vin of the Arduino and plug the black wire into the GND pin on the Arduino.

The Arduino code for the night light can be found in the PDF file above. Copy and paste it into the Arduino IDE, then upload it.

Now your lights should turn on when the light sensor senses no light.


You can take this project further by adding code to slowly fade the LEDs on and off in different patterns, or by adding a timer to fade the night light off after a set period of time.