RGB LED Lamp

Introduction: RGB LED Lamp

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

Step 1: Code

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
}

Step 2: Explain

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.

Step 3: Building Up Arduino

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

Be the First to Share

    Recommendations

    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Tinkercad Student Design Contest

      Tinkercad Student Design Contest
    • Space Contest

      Space Contest

    2 Comments

    0
    Penolopy Bulnick
    Penolopy Bulnick

    1 year ago

    Thanks for sharing how you did your little lamp :)

    0
    evan20050827
    evan20050827

    Reply 1 year ago

    Thanks!