RGB LED - Common Cathode or Common Anode?
05 March 2012 at 9:25 pm
One of this things I initially found odd about electronics is how it’s not really about the 5V plus and ground, but rather the difference between plus/minus. Some components like diodes and electrolytic capacitors will only allow power to flow one way, so direction matters when you’re ordering your RGB LEDs.
For my cube project, I’ve gotten some nice, diffused 10mm RGB LEDs but I didn’t really pay attention when I ordered them, so when I started playing around tonight I was fumbling with what to apply to wich LED leg. So for future reference - here’s the rule:
- A RGB Common Anode LED should have it’s longest leg (leg 2) connected to the 5V pin on your Arduino (Current sink)
- A RGB Common Cathode LED should have it’s longest leg (leg 2) connected to the ground pin on your Arduino (Current source)
In both cases, you’ll connect the R, G and B legs of the LED to IO pins on your Arduino through some suitable resistor (200-330 Ohm) to not burn out the LED. So when should you get what version? Your Arduino can drive a couple of RGB LEDs, but you only have 7 PWM channels and you can’t draw more than 40mA from each of these. If you want to drive more LEDs using for example shiftout, you’ll need custom driver chips like the TPIC6B595N (that I’ve used before). This chip can only SINK power, so you should use it with Common Anode LEDs. In other words, a little research may be required.