Go Down

Topic: Issues Charlieplexing RGB LEDs with an Arduino Uno (Read 4543 times) previous topic - next topic



I am trying to charlieplex 10 RGB LEDs on my Arduino Uno. I only want one LED on at a time, either red or green, so I only need 20 total (5 pins). I got charlieplexing to work using 10 normal LEDs and four pins. The RGB LEDs are common cathode, and I charlieplexed them as such:

LED #    Red, 5V   Red, GND   Green, 5V   Green, GND
1 pin2pin1pin3pin1
2 pin4pin1pin5pin1
3 pin1pin2pin3pin2
4 pin4pin2pin5pin2
5 pin1pin3pin2pin3
6 pin4pin3pin5pin3
7 pin1pin4pin2pin4
8 pin3pin4pin5pin4
9 pin1pin5pin2pin5
10 pin3pin5pin4pin5

so the common cathode is set to ground, and resistors are used between the individual anodes and the 5V output.

For example, I should be able to turn on LED #3 to be green by setting pin 3 to a high output, pin 2 to a low output, and pins 1, 4, and 5 to input (high impedance). Unfortunately, other LEDs light up when I run the code (see attached). When I set LED #3 to light green, the LEDS that share pin 2 or 3 also light up (but not as brightly). So I also get LED #1 green, LED #8 red, LED #10 red, and LED #4 seems to try to light both.

What could be my issue? I did solder together my LEDs, so there could be issues there as well. However, this issue happens when I try to light any of the LEDs. Is there anything in the code that I am missing? Is this not a good application for charlieplexing? Any advice is welcome. Please ask questions if I have not been clear or detailed enough. Thanks,



Its impossible for me to make sense of your description, but the closest issue that I could make sense of is that you are using the cathode connected to ground. This isnt how charlieplexing works. You need to be able to change polarity, to light up the other LED.

With 4 CC RGB LEDs, you can bend the leads into a square shape, and solder them together, turning each additional one 90 degrees. This puts one cathode on each lead, and one red, one blue, and one green also on one lead. If you rotate all your contacts 90 degrees, it lights up the LED above or below (depending on which direction you rotate.)

My text description is probably just as difficult for you to understand as yours was for me to understand, so here are a couple links to webpages that might help you understand better.

here are a couple websites about charlieplexing 64 RGB LEDs


Feb 27, 2013, 11:17 pm Last Edit: Feb 27, 2013, 11:19 pm by tmd3 Reason: 1
Your code looks OK to me.  I suspect that there's something wrong with the wiring, or that the LEDs aren't compatible for charlieplexing.

Can you post a schematic?  For your edification and ours, you needn't draw a schematic with 20 LEDs.  Please consider showing us what your circuit would look like if you were driving six LEDs with three pins - it'll be easier to draw, and easier to analyze.

Also, please tell us the forward voltage of the red and green LEDs. Get it from the the datasheet for your RGBs, if you have one.  If not, then please hook up a spare RGB in a breadboard with a resistor in series - maybe 200 to 330 - and measure the forward voltage of the red and green LEDs.  If you don't have a spare, then light a red LED in the array and measure across it, and then light a green one and measure across that one, too.  Report the results.  For charlieplexing to work well, it's important that the forward voltage of the LEDs be reasonably uniform.


Thanks for the replies. My sentence after the table was not clear.

Attached is a simple schematic for 3 RGB LEDs (6 total - R and G for each). Sorry for the poor quality, all I had access to was the Google Drawing tool.

The LEDs are from SparkFun (https://www.sparkfun.com/products/105) so the forward voltage of green is 3.2 volts, and the forward voltage for red is 2.0 volts. Is this what the issue could be coming from? Thanks for the help.


That schematic helps a lot. It looks correct to me, have you tried hooking up 5v and ground to your circuit without the microcontroller to confirm that the LEDs light up?


OK, I fixed my problem. I think the issue was that the LEDs would light at a lower current. For example, in my schematic, lighting green LED #1 means pin 1 to ground, pin 3 to 5v. The problem was this also connected the series connection of red LED #1 and green LED #2 (1 to 2, 2 to 3 instead of just 1 to 3 for green LED #1). The current would be low enough that the LEDs would light up as less voltage would be dropping over the resistors (correct me if I am wrong, this is my hypothesis).

I solved my problem by adding 300 ohm resistors to each pin, so the voltage would be lower all around. The LED I want to light stays on (albeit not at bright) and the issue LEDs don't light. This may not be the most eloquent solution, but it is easy and effective given my current implementation. Thanks for all your help!


Go Up