Arduino Mood Lamp

3,323

9

3

Introduction: Arduino Mood Lamp

Hello Instructables Users!!! This is a simple, fun, and useful project for arduino beginners. You will be building the lamp and then uploading the code to make the lamp light up to a color of your liking. The color is smooth and lights up the area of your room you put it in.

Step 1: Step 1: Needed Parts

These are the parts needed to build the lamp:

1.) Jumper wires

2.) 120k Ohm resistor

3.) The LED color of your choice

4.) LDR (photo light resistor)

5.) Arduino Uno

6.) Breadboard

Step 2: Step 2: Building the Lamp

The following photo above is a schematic to build your mood lamp

Step 3: Step 3: Coding the Arduino

Copy and Paste the following code to use for your lamp:

void setup(){
pinMode(redLed,OUTPUT); pinMode(greenLed,OUTPUT); pinMode(blueLed,OUTPUT); digitalWrite(redLed,HIGH); digitalWrite(greenLed,LOW); digitalWrite(blueLed,LOW); }

void loop(){ for (int y=0; y<=3; y++) { if (y=1){ for (int x=0;x<=255;x++){ RGB[0]=255-x; RGB[1]=0; RGB[2]=0+x; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } if (y=2){ for (int x=0;x<=255;x++){ RGB[0]=0; RGB[1]=0+x; RGB[2]=255-x; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } if (y=3){ for (int x=0;x<=255;x++){ RGB[0]=0+x; RGB[1]=255-x; RGB[2]=0; analogWrite(redLed,RGB[0]); analogWrite(greenLed,RGB[1]); analogWrite(blueLed,RGB[2]); delay(delaymood); } } } }

Step 4: Step 4: Final Result

The final outcome of the lamp is a smooth color added to your room for light!

First Time Author Contest 2016

Participated in the
First Time Author Contest 2016

Robotics Contest 2016

Participated in the
Robotics Contest 2016

Be the First to Share

    Recommendations

    • The 1000th Contest

      The 1000th Contest
    • Battery Powered Contest

      Battery Powered Contest
    • Hand Tools Only Challenge

      Hand Tools Only Challenge

    3 Discussions

    0
    __dan__
    __dan__

    3 years ago

    The LDR related code is missing in the Arduino sketch!

    Seems like you just copied parts of the code from the original "Arduino Mood Lamp" instructable by ricardouvina! (https://www.instructables.com/id/Mood-Lamp-with-Arduino/)

    You have also copied and used the schematics and photos/images from the original author and made screenshots of his video!

    Can you please share any code, schematics, photos and videos of your own working mood lamp?

    Please be fair and honest and give credits to the original author (ricardouvina) and include a link to the original instructable if you knock off any source code, schematics, images and videos!

    The original author (ricardouvina) spend a lot of time and effort on his project. He did a great job and deserves better!

    Arduino Mood Lamp Instructable - Original and Knock Off.jpg
    0
    You_know_me
    You_know_me

    3 years ago

    Can you please describe a bit more about how you made that tall lamp shade of yours ? It looks rather interesting!

    0
    seamster
    seamster

    4 years ago

    Looks good! :)