APPURT

  • Archive
  • RSS

Arduino IR RGB Led Control



There is an abundance of inexpesive, mains powered, relatively high powered, RGB Led lamps available from China on Ebay ready for a quick hack. I picked up a ES 3W Lamp for a few pounds and a rather powerful 10W RGB Lamp for less than £15. 

They are controlled by simple 24 button remotes using NEC IR protocol so it makes it easy to control these lamps using Ken Shirrifs IRremote Library for the Arduino.

Unfortunately it’s not possible to control individual RGB values for the lamps but the limited colours can be selected using the appropriate command on the remote. 

Even the standard functions on the remote such as Flash or Strobe have odd behaviour. Using the Arduino makes it easy to sequence colour changes or send commands to trigger the RGB lamp based on an action.

By using lamps of different protocols it will also mean you can have multiple channels allowing you to control two (or more) separate lamps with the Arduino simultaneously.

The basic setup is straightforward hook up a 38khz IR emitter of your choice with a current limiting resistor in series to Pin 3 (a requirement of the IRremote library for PWM)

 

I packaged up the mappings into a little library so I could easily reuse them in my projects. I decided not to wrap the IRremote library if others prefer to use a different NEC IR library it’s simple enough to parse the HEX values. 

Some basic code below shows how you can get the RGB lamp to strobe in a specific colour as well as a simple ping-pong fade effect using the Darker and Brighter button functions.

Set it up by including the libraries and initialising both.

#include <IRremote.h>
#include <RgbIrLed.h>

//Initialise IRremote
IRsend irsend;

//Type 0 is IR remote APA1616 24 Button Remote
RgbIrLed rgbled(0);

Then in your loop you’re pretty much ready to start using the two libraries to control the

void loop()
{
irsend.sendNEC(rgbled.On, 32);
delay(50); //Some latency in the RGB lamps so wait between sending commands
irsend.sendNEC(rgbled.Red, 32);
delay(500); //Delay by half a second in on state;
irsend.sendNEC(rgbled.On, 32);
delay(500); //Delay by half a second in off state;
}

I’ve mapped two Remotes the APA 1616 and the LED618 both are marked on the remote and most Ebay listing you should be able to see the markings of the remote to know which one to buy. 

The unmarked 12 coloured buttons have been mapped with the prefix B for Button R for Red column and then the distance away from Red so the last button in the Red row is BR4 (which happens to be yellow). The colours aren’t really consistent enough to name. All other buttons have been mapped to their respective functions with names. 

 

1. Download the RGB IR Library including an example from my Git.

2. Grab the IRremote from Git too.

  • 7 months ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

About

Avatar Experiments from Alistair Allan

Pages

  • About Appurt

Twitter

loading tweets…

Top

  • RSS
  • Random
  • Archive
  • Mobile

Appurt 2012.