Controlling a 3W RGB LED with an Arduino
This project is pretty special to me, ever since I saw some sweet videos on YouTube a couple years ago demonstrating a bright RGB LED slowly morphing and fading between brilliant, vibrant colors, I knew I wanted to integrate something like it into a project someday. That project will be forth-coming, but I actually thought the RGB LED driver that I cooked up is worthy of its own blog post, so here we go!
Hooking up the RGB LED to an Arduino
The Arduino is a wonderful little platform for controlling devices and circuits using simple, elegant C code, but its not meant for directly powering large loads. And by large, I mean more than 50mA, which is the maximum current output rating for each pin of the Arduino. The RGB LED I wanted to use could consume about 350 mA per channel, so obviously something more involved was needed. The schematic and parts list can be found below.
Parts list:
3W RGB LED from SparkFun
ULN2003 Darlington transistor array
2W power resistors to sink current (8.2ohm for red, 3.8ohm for green and blue)
5V / 1A power supply
DC barrel jack adapter
Download the source code to test each LED in turn
I decided to implement this circuit as a shield for my Arduino, so I can easily stack it on top of the Arduino and save some space. Take a look!
Lessons learned
First of all I learned that although we’re using two different power supplies (one for the Arduino and one for the LEDs themselves), the PWM signal from the Arduino needs a path to ground that is common with the LEDs. Otherwise it is not actually flowing anywhere and thus not completing a circuit. That caused me a couple of days of head-scratching, until Dr. Trantham in physics pointed out the problem. Soldered a wire from the ground of the LEDs power supply to one of the ground pins of my Arduino and everything started working perfectly!
Putting the lamp through its paces
3W is a pretty good amount of power for an LED. Enough, actually, to cause some spots to develop in your eyes even when you catch a glimpse of these LEDs in your peripheral vision! You are definitely going to want to put a diffuser over your LED in order to make it a little more safe to look at, and also because it looks awesome. How awesome? See for yourself!