Arduino and RGB LED Lighting

I was over in Maplin a few days ago and picked up their Flexible RGB Strip Lighting Kit [A99KU]. Only problem, when I got it home and hooked it up, I got a strip of LEDs that did not respond to the remote and were flashing out of control! Bummer.. Oh well I thought I’d take it apart and see if I could see what was up..

Maplin's Flexible RGB Strip Lighting Kit (A99KU)

Maplin’s Flexible RGB Strip Lighting Kit (A99KU)

It looks like the MCU has been flashed with the wrong code.. hard to say, but the rest of the circuit looks fine.

Oh well, the Maplin I got this in is a little far away to bother returning it, and anyway all I really wanted was the PSU and LED strip.  Sounds like the ideal way to get into Arduino RGB Led lighting (the dog on the street seems to be doing it!). Time to see how this control board is done..

The circuit diagram in Marko CAD (complete with notes!)

The circuit diagram in Marko CAD (complete with notes!)

The MCU looks like it a ELAN EM78P1535, again hard to say as there are no markings on the top of the chip, but a quick google search with the pins I could see lead me to this. For example the power goes in on pin 4 and GND is pin 11, ruling out Atmel or PIC. Crystal (while not populated on the PCB) would go to pins 5 and 6.

So time to rip off the MCP and EEPROM and attach some small jumper wire to the points of interest:

Hacked LED driver board

Hacked LED driver board

The pins I need are the three FET gate pins, a ground connection and the IR remote data pin. Arduino time!

Found a simple RGB serial decoder that uses PWM to drive the LEDS over at TodBot.com, that worked as a test.

Arduino, driver and RGB LED strip

Arduino, driver and RGB LED strip

Next to see if I could decode the IR signal from the remote. As with most things Arduino someone has done a IR decoder library, I used Ken Shirriff’s IR Library for this. Uploading and running the IRrecvDemo example code revealed that the remote talked a NEC protocol. Some time spent with this and I have a map of all the key codes.

Remote control key code map

Remote control key code map

Then a little code to use the IR library to decode the keys and then adjust the PWM signals.  The only problem with this is the IR library uses one of the timers that I need for the PWM. I have my RGB leds on pins 9,10 and 11.  Pins 9 and 10 use Timer1, pin 11 uses Timer2 and the IR library uses Timer2 also, so at the moment I can’t adjust the blue without effecting the IR decoder.. Need to look into this!  Any way here is the final project code running on my PC:

RGB control software

RGB control software

Update (21:45): Moved the code to an Arduino Mega.. used a different timer and it’s working really nice now!