Make: Projects
Arduino-Controlled Night Light
Make a night light that automatically goes on when you turn off the lights.
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
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.






























Hey, where is the arduino code for this project? There is no pdf file here
Here is some simple code if you wish for a single LED. Just a simple if/else statement. I connected my LDR to the analogue input and had the serial print just to have a look at what sort figures I was getting. You can then make the if/else statement a lot more complicated from this.
int led =7;
int ldr= A0;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue= analogRead(A0);
float voltage= sensorValue * (5.0 /1023.0);
if (voltage>=3.0)
{
digitalWrite(led, LOW);
}
else
{
digitalWrite(led, HIGH);
}
Serial.println(voltage);
}
// What's Trending
Raspberry Pi Design Contest
Maker Faire: Day Two
Seventeen Sneaky Secret Hides
10 Things to Connect to Your Raspberry Pi
Maker Faire: Day One
47 Raspberry Pi Projects to Inspire Your Next Build
I Have a (Puzzling) Dream
// What's Shared
A better way to slice a pumpkin
DIY Nerf Darts
In the Maker Shed: Minty Boost USB Charger
100 Dollar Store Organization Ideas for Craft Rooms and Beyond
Mad’s Mouse House
Lace Princess Crowns
I Have a (Puzzling) Dream
Play the Rings of a Tree Trunk Like a Record
// Most Commented
DIY Hacks & How To’s: Get Emergency Power from a Phone Line
Resin Casting: Going from CAD to Engineering-Grade Plastic Parts
Ten Tips for Screws and Screwdrivers
Ten Tips for Better Measurement
Makers on TV: Big Brain Theory
Arduino Announces New Wireless Linux Board
Grow: A Portable CNC Router System
Tool Review: BioLite CampStove