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
Seventeen Sneaky Secret Hides
Teardrop Camper Trailer
A Maker Wedding
Dad Builds Son an Iron Man Arc Reactor
What to do with an 800 Lb Eucalyptus Slab
10 Things to Connect to Your Raspberry Pi
Bringing a Classic Marklin Z-Scale Model Railroad to Life With Arduino
// What's Shared
A better way to slice a pumpkin
DIY Nerf Darts
100 Dollar Store Organization Ideas for Craft Rooms and Beyond
In the Maker Shed: Minty Boost USB Charger
Mad’s Mouse House
Lace Princess Crowns
I Have a (Puzzling) Dream
Play the Rings of a Tree Trunk Like a Record
// Most Commented
Plastic Bags into Plastic Blocks: Revisited
10 Hot New Boards to Watch
Why the Maker Movement is Here to Stay
MAKE Asks: Roadside Hacks
DIY Hacks & How To’s: Convert From Battery Power to AC
Ten Tips for Hand Saws and Blades
How To Make Your Own Laundry Detergent
What to do with an 800 Lb Eucalyptus Slab