RGB LED Lamp

by evan20050827 in Circuits > Arduino

571 Views, 0 Favorites, 0 Comments

RGB LED Lamp

Arduino RGB LED Lamp v2

This is a special lamp that helps you sleep well. I use the RGB LED to make this lamp, it's elegant if you add a cover.

Supplies

1x Arduino Leonardo

5x Wires

4x Clip wires

1x RGB LED

1x Paper

1x 100ohm resistor

Code

IMG_4172.jpg
IMG_4188.jpg
IMG_4173.jpg

The link for full codes: Arduino CC

//RGB LED lamp
//The color of LED changes in the order of red, orange, yellow, green, blue, dark blue, and then purple.
//The RGB LED is controlled by the color of red, green, and blue
//Pin 7 controls the brightness of the red
//Pin 6 controls the brightness of the green
//Pin 5 controls the brightness of the blue 
void setup(){  // put your setup code here, to run once:
}
void loop(){  // Main code
  analogWrite(7 , 255);  //改
  analogWrite(6 , 0);  //改
  analogWrite(5 , 0);  //改
  delay( 1000 ); // waits a few milliseconds
  //Red
  analogWrite(7 , 255);  //改
  analogWrite(6 , 120);  //改
  analogWrite(5 , 0);  //改
  delay( 1000 ); // waits a few milliseconds
  //Orange
  analogWrite(7 , 255);//改
  analogWrite(6 , 255);  //改
  analogWrite(5 , 0);  //改
  delay( 1000 ); // waits a few milliseconds
  //Yellow
  analogWrite(7 , 0);  //改
  analogWrite(6 , 255);  //改
  analogWrite(5 , 0);  //改
  delay( 1000 ); // waits a few milliseconds
  //Green
  analogWrite(7 , 0);  //改
  analogWrite(6 , 255);  //改
  analogWrite(5 , 255);  //改
  delay( 1000 ); // waits a few milliseconds
  //Blue
  analogWrite(7 , 0);  //改
  analogWrite(6 , 0);  //改
  analogWrite(5 , 255);  //改
  delay( 1000 ); // waits a few milliseconds
  //Dark Blue
  analogWrite(7 , 130);  //改
  analogWrite(6 , 0);  //改
  analogWrite(5 , 255);  //改
  delay( 1000 ); // waits a few milliseconds
  //Purple
}

Explain

IMG_4186.jpg
IMG_4174.jpg
IMG_4175.jpg

RGB LED is controlled by a negative polarity and three kinds of light: Red, Green, and Blue. These three colors are the primary colors of light. Different brightness for each color combined can make almost all kinds of color. I choose the colors of the rainbow: red, orange, yellow, green, blue, dark blue, and violet to be the colors of my lamp.

Building Up Arduino

Screenshot (25).png
IMG_4185.jpg

Build up the circuit like the image above.

  1. Three wires connect from D5, D6, and D7 to the RGB LED.
  2. A wire connects from GND to LED's negative polarity
  3. 4 clip wires connect to the RGB LED
  4. Upload the codes from Arduino app
  5. Make a paper shade cover on it

Here is a link for how to use a paper to make lamp cover:

https://www.youtube.com/watch?v=DCelEdIow2c

After all of that, you are finish!

Congrats!

Source: LED blinking