Arduino RGB LED Spinning Night Light

Posted July 6th, 2010 by Natalia and filed in Arduino, Project

Arduino RGB LED Night LightThis 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:

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:

  1. Arduino RGB LED Control for the Spinning Night Light
  2. Arduino RGB LED Spinning Night Light: Assembly
  3. Controlling a Seven-Segment Display Using Arduino Part 4
  4. Controlling a Seven-Segment Display Using Arduino Part 3

3 Responses to “Arduino RGB LED Spinning Night Light”

  1. [...] 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 [...]

  2. [...] the previous post if you need to see the sketch for the Arduino RGB LED night light [...]

  3. [...] 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 [...]

Leave a Reply