How to Make a Simple Arduino Night Light for Your Bedroom in Just 10 Minutes
Making a night light with an Arduino is a fun and easy electronics project that you can complete in just 10 minutes! With just a few electronic components, you can build your own custom night light to comfort you as you drift off to sleep.
What You'll Need
To make your Arduino night light, you'll need just a few components:
-
Arduino Uno board - The brains of your night light. This microcontroller board allows you to program and control your circuit.
-
LEDs - These will provide the light for your night light. I used a strip of RGB LEDs so I could change the color.
-
220 ohm resistor - This limits the current to your LEDs so they don't burn out.
-
Breadboard - Allows you to easily connect your components.
-
Jumper wires - Connects everything together.
-
USB cable - Provides power to your Arduino.
-
Light diffuser - I used a plastic cup to diffuse the LED light.
Circuit Diagram
Here is the simple circuit diagram showing how everything needs to be connected:
The LEDs are connected through the resistor to pin 3 on the Arduino. Power and ground are connected to the rails on the breadboard.
Setting up the Circuit
To build the circuit:
- Insert the LED strip into the diffuser cup or enclosure.
- Connect the 220 ohm resistor to a row on the breadboard.
- Connect the resistor to the positive (+) leg of the LED strip.
- Insert the Arduino's pin 3 into the same row as the resistor. This will control the LEDs.
- Connect the negative (-) leg of the LED strip to ground on the Arduino.
- Connect Arduino 5V and GND to power the rails on the breadboard.
Be sure to double check your connections match the circuit diagram before powering on your Arduino!
Uploading the Arduino Sketch
To program the Arduino:
- Download the Arduino IDE software on your computer.
- Connect your Arduino to your computer with the USB cable.
- Copy and paste the following code into a new sketch:
```c++
void setup() {
pinMode(3, OUTPUT); // Set pin 3 as an output
}
void loop() {
analogWrite(3, 255); // Turn LEDs on full brightness
delay(5000); // Wait 5 seconds
analogWrite(3, 0); // Turn LEDs off
delay(5000); // Wait 5 seconds
}
```
- Upload the code to your Arduino.
This simple sketch turns the LEDs on full brightness for 5 seconds, then off for 5 seconds, repeatedly.
Customizing Your Night Light
Once you have the basic operation working, you can customize your night light in lots of ways:
-
Change LED colors - Use RGB LEDs and modify the code to cycle through different colors.
-
Adjust the brightness - Use
analogWrite
to set different brightness levels. -
Create fading effects - Slowly ramp the brightness up and down for cool effects.
-
Add a photoresistor to detect ambient light and only turn on at night.
-
Control with a switch - Add a switch to manually turn the light on and off.
The possibilities are endless! Make the night light uniquely yours by customizing both the hardware circuits and software code.
Conclusion
Building your own Arduino night light is a fun, straightforward beginner electronics project. In just 10 minutes, you can create a custom night light from easy-to-find components. With just an Arduino, LEDs, resistor, and a few wires, you'll be on your way to lighting up your bedroom in no time!