Arduino RGB LED Spinning Night Light
This month’s project uses the Arduino to control a motor and an RGB LED to create an aquarium style spinning night light.
The initial idea was to recycle empty toilet paper tubes to serve as the lampshade, but it turns out the project looks much more attractive and colorful using white paper. (I haven’t given up on the idea of finding a use for the empty tubes, though. Suggestions are welcome.)
A simple DC motor is used to spin the lamp structure, and a jar lid serves as the base. There is (a lot of) room for improvement in the design of the lamp, but I’m a computer scientist and wanna-be crafter at best.
I intend to revisit these projects in the future, and make them stand alone using smaller Arduino boards and sporting a nicer finish (something worthy of showing guests). For now the purpose of these projects is solely educational (in a microcontroller programming way, not hand crafting).
In the upcoming posts we will explore the assembly of the night light, as well as the circuit and Arduino sketch that make the project work.
Parts list:
- Arduino Duemilanove
- Mini Breadboard
- DC Motor
- RGB LED
- 1N914 Diode

- 2N3904 Transistor

- 100 Ohm Resistor
- 147 Ohm Resistor
- 82 Ohm Resistor
- Soldering iron

- Solder

- Heat-shrink tubing

- Jumper Wires of assorted lengths
- White paper
- Jar lid
- Mounting tape
I have recorded a short video of the Arduino RGB LED Spinning Night Light in action.
And here is the Arduino sketch:
// www.TheElectronicsHobbyist.com/blog
// Natalia Fargasch Norman
// RGB LED night light using Arduino
// Arduino pins used for motor and LEDs
#define MOTOR 3
#define RED 9
#define GREEN 10
#define BLUE 11
// pins for motor and LEDs are outputs
void setup() {
pinMode(MOTOR, OUTPUT);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}
void loop() {
// set motor speed, between 0 and 255
analogWrite(MOTOR, 69);
// fade from aqua to magenta
for (int i = 0; i < 256; i++) {
analogWrite(RED, i);
analogWrite(GREEN, 255-i);
analogWrite(BLUE, 255);
delay(50);
}
// fade from magenta to aqua
for (int i = 0; i < 256; i++) {
analogWrite(RED, 255-i);
analogWrite(GREEN, i);
analogWrite(BLUE, 255);
delay(50);
}
}
You might also enjoy:
- Arduino RGB LED Control for the Spinning Night Light
- Arduino RGB LED Spinning Night Light: Assembly
- Controlling a Seven-Segment Display Using Arduino Part 4
- Controlling a Seven-Segment Display Using Arduino Part 3










[...] looking at the parts list for the Arduino RGB LED spinning night light you must have noticed that current limiting resistors of different values were used for the Red and [...]
[...] the previous post if you need to see the sketch for the Arduino RGB LED night light [...]
[...] This post was mentioned on Twitter by Arnon Katz, Natalia F. Norman. Natalia F. Norman said: New post: Arduino RGB LED Spinning Night Light http://goo.gl/fb/oCYYW #uncategorized [...]