Arduino RGB LED Spinning Night Light | Part 1

by fargasch75

in Arduino, Project

Your ads will be inserted here by

Easy AdSense.

Please go to the plugin admin page to paste your ad code.

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, 255-i);
    analogWrite(GREEN, i);
    analogWrite(BLUE, 0);
    delay(50);
  }

  // fade from magenta to aqua
  for (int i = 0; i < 256; i++) {
    analogWrite(RED, i);
    analogWrite(GREEN, 255-i);
    analogWrite(BLUE, 0);
    delay(50);
  }

}

{ 2 comments… read them below or add one }

Sophie Wilson

the great thing about LED light is that they do not generate lots of heat;`:

Reply

Genesis Alexander

the soldering iron that i use is employing a ceramic heating element;-.

Reply

Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: