Subscribe to Arduino Academy and start learning today for FREE!

Remote Control Mood Lamp

I love RGB LED’s. One little module can produce a wide spectrum of colors just by varying the signal on the red, green and blue pins. I also love my TV remote, as I am a bit of a couch potato. What if I could change the mood of the room, with my TV remote?

I took an arduino, connected a RGB LED module that has the three dropping resistors on board, and connected a InfraRed (IR) receiver out of an old VCR. Radio shack sells these for about 80 cents. You could use three separate LED’s and 220 Ohm resistors, but the effect would not be the same. You could also get a RGB LED, and add the three resistors to it.

Become the Maker you were born to be. Try Arduino Academy for FREE!

I went a step further, and connected a LED to the output of the receiver chip so I would get a visual confirmation that the receiver saw a signal from the remote. That part isn’t necessary, so I left it off the schematic. If you want to implement, connect a 220 ohm resistor to the IR module signal pin. Connect the other end of the resistor to the short leg of an LED (color is your choice). Connect the long end of the LED to Arduino +5. The receiver outputs a LOW when it sees a IR signal.

I cut a small hole in a ping pong ball and placed it over the RGB LED (tape holds the module in place) to diffuse the light and make the whole ball glow with color.
I’m not detecting actual codes, just an IR signal, so this project will work with any remote you have laying around, and any button on the remote. It just cycles to the next color.
All 3 LED pins are connected to PWM pins, so you can add additional case statements, and change the pwm values with analogWrite to the pins, to create new and additional colors.
Code:

 

int ledcolor = 0;
int red = 9; //this sets the red led pin
int green = 10; //this sets the green led pin
int blue = 11; //this sets the blue led pin

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
pinMode(blue, OUTPUT);
}

void loop() {
if (ledcolor > 6){
ledcolor=0;
}
// put your main code here, to run repeatedly:
bool triggered = digitalRead(12);
if (triggered == LOW){

switch (ledcolor) {
case 0: //if ledcolor equals 0 then the led will turn red
digitalWrite(red, LOW);
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
analogWrite(red, 204);

break;
case 1: //if ledcolor equals 1 then the led will turn green
digitalWrite(red, LOW);
digitalWrite(green, HIGH);

break;
case 2: //if ledcolor equals 2 then the led will turn blue
digitalWrite(green, LOW);
digitalWrite(blue, HIGH);

break;
case 3: //if ledcolor equals 3 then the led will turn yellow
digitalWrite(blue, LOW);
analogWrite(red, 160);
digitalWrite(green, HIGH);
//delay(a);

break;
case 4: //if ledcolor equals 4 then the led will turn cyan
digitalWrite(red, LOW);
digitalWrite(green, LOW);
analogWrite(red, 168);
digitalWrite(blue, HIGH);

break;
case 5: //if ledcolor equals 5 then the led will turn magenta
digitalWrite(red, LOW);
digitalWrite(blue, LOW);
digitalWrite(green, HIGH);
digitalWrite(blue, HIGH);

break;
case 6: //if ledcolor equals 6 then the led will turn white
digitalWrite(green, LOW);
digitalWrite(blue, LOW);
analogWrite(red, 100);
digitalWrite(green, HIGH);
digitalWrite(blue, HIGH);

break;
}
++ledcolor;
delay(200);
}
}

Become the Maker you were born to be. Try Arduino Academy for FREE!

 

 

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Archives

0
Would love your thoughts, please comment.x
()
x