Charlieplex RGB LED Calculator





or
Hz

Charlieplexable LEDs

Type Count Refresh Rate
Individual LEDs/elements Hz
Common pin RGB LEDs Hz
Common pin RGB LEDs w/ PWM Hz

PWM RGB Charlieplex Matrix

Background / Why This Tool?

I've been wanting to make some LED jewelry and of course RGB LEDs.

Charlieplexing is great for getting heaps of LEDs on very few GPIO pins, but most RGB LEDs have a common pin.

I'd found a stack exchange answer that pointed out that yes you can charlieplex RGB LEDs that have a common pin, and how to do it.

I had started a spreadsheet to help calculate the number of RGB LEDs possible with this method.

The number of charlieplexable LEDs based on a given number of GPIO is n * (n-1), but for RGB you need all 3 elements on the same row or column. So for that its n * floor((n-1)/3).

Then I wanted a way to figure out how many of these I could do while still controlling brightness with PWM, where a subset of my GPIO pins were PWM capable. This is more complex. For any given RGB LED, either it's common pin or all 3 element pins need to be on a PWM pin. So that ends up being something like pwm * floor((gpio - 1) / 3) to count common pin PWM driven LEDs, plus floor((pwm) / 3) * (gpio - pwm) to count rest of the LEDs that can have the common pin driven by a non-PWM pin, with all 3 element pins on PWM.

Finally I had hand filled out a table in my spreadsheet that showed how the RGB LEDs could be arranged, mostly to sanity check myself, and didn't want to do that by hand again, so the tool will generate one showing where each RGB element can land.