Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

Arduino-Controlled Night Light

Make a night light that automatically goes on when you turn off the lights.

Arduino-Controlled Night Light

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.

Steps

Step #1:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light

These are the parts and tools you will need.

Step #2:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light

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.

Step #3:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light

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.

Step #4:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light

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.

Step #5:

PrevNext
Arduino-Controlled Night Light

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

Step #6:

PrevNext
Arduino-Controlled Night Light

And repeat it again but use digital pin 3.

Step #7:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light

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.

Step #8:

PrevNext
Arduino-Controlled Night LightArduino-Controlled Night LightArduino-Controlled Night Light
  • 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.

Conclusion

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.


blog comments powered by Disqus

Featured Products from the MakerShed

Follow

Get every new post delivered to your Inbox.

Join 25,535 other followers