Convert project to Charlieplexing

I am trying to see if it is possible to convert my project to Charlieplexing. As you can see I have 6 pods of 4 LEDs coded to chase—24 LEDs total. In the current setup, I have 2 LEDs connected per pin to make it work, of course with each having a resistor. This is working perfectly, however, I would like FEWER wires and therefore am contemplating using Charlieplexing, but I do not know if it is feasible. I have so far Charlieplexed 4 and 6 LEDs, but I am unsure of how to proceed and if is possible to control the "6 pods of 4 LEDs" individually as in my current setup with Charlieplexing. Or, would Charlieplexing be over-complicating the project? I am open to alternate ways that will work and be less wires. ANY direction would be greatly appreciated and I am willing to learn.

Video of current setup:

Code of current setup:


//initializing a variable for digital pin 2 to 13
int led1 = 2;
int led2 = 3;
int led3 = 4;
int led4 = 5;
int led5 = 6;
int led6 = 7;
int led7 = 8;
int led8 = 9;
int led9 = 10;
int led10 = 11;
int led11 = 12;
int led12 = 13;

void setup() {
 pinMode(led1, OUTPUT);
 pinMode(led2, OUTPUT);
 pinMode(led3, OUTPUT);
 pinMode(led4, OUTPUT);
 pinMode(led5, OUTPUT);
 pinMode(led6, OUTPUT);
 pinMode(led7, OUTPUT);
 pinMode(led8, OUTPUT);
 pinMode(led9, OUTPUT);
 pinMode(led10, OUTPUT);
 pinMode(led11, OUTPUT);
 pinMode(led12, OUTPUT);
}

void loop() {
digitalWrite(led1, HIGH);
digitalWrite(led5, HIGH);
digitalWrite(led9, HIGH);
 delay(75);
digitalWrite(led1, LOW);
digitalWrite(led5, LOW);
digitalWrite(led9, LOW);
 delay(75);
digitalWrite(led2, HIGH);
digitalWrite(led6, HIGH);
digitalWrite(led10, HIGH);
 delay(75);
digitalWrite(led2, LOW);
digitalWrite(led6, LOW);
digitalWrite(led10, LOW);
 delay(75);
digitalWrite(led3, HIGH);
digitalWrite(led7, HIGH);
digitalWrite(led11, HIGH);
 delay(75);
digitalWrite(led3, LOW);
digitalWrite(led7, LOW);
digitalWrite(led11, LOW);
 delay(75);
digitalWrite(led4, HIGH);
digitalWrite(led8, HIGH);
digitalWrite(led12, HIGH);
 delay(75);
digitalWrite(led4, LOW);
digitalWrite(led8, LOW);
digitalWrite(led12, LOW);
 delay(75);
 }


Wokwi of current setup:

You could get rid of at least half your code if you would use an array to store the ledpins...
Charlieplexing is certainly possible.
Maybe it is easier to start with normal multiplexing...

1 Like

Thank you for the array suggestion and for letting me know Charlieplexing will work. Now to figure the coding / wiring... I am willing to explore Multiplexing too.

Have you entertained the idea of using WS2812 leds instead? One strip of those and you only need power/ground/data pin

6 groups of 4 leds could be controlled with 10 outputs... so it does not really make a big gain...

I will definitely explore using WS2812's........ I suppose I could cut 6 strips of 4 (WS2812) LEDs and create my project. Although the spacing wouldn't be correct I don't think for mounting on a tube like I have my current project... Time to learn-up on these addressables.

I realize that and you are right. That is why I think something other than Charlie/Multiplexing such as WS2812 strips may be more appropriate... but I fear the LEDs may be too to large and too far apart as I need something on the order of prewired 3528s as shown in my first post.

You can also buy addressable leds per piece...

Yes, I have just found indiviual 3528 size ws2812b SMD LEDs on AliExpress. I am now trying to find individual PREWIRED or circle board mounted ones like these 5050s:


These in 3528 size would be perfect.

I think I found them...nice long leads on them too.....

Thank you to all who replied. I will stop posting for now.

They are also available as 4 legged standard led's.
Even prewired like christmas lights if you want.

Pretty awesome. I can't wait to try them. The prewired Christmas light ones are too big. If you come across 3528 package size (prewired), which is about 3mm x 2.5mm, that's what I need.

Without wires:
https://nl.aliexpress.com/item/4000720415203.html?

Removed extra stuff from link as suggested by @xfpd.

Thanks build, but those are too big.

This is what I need, but with wires attached:

They call them NeoPixels (TradeMarked name), but it is the same thing as WS2812s.

Found a LOT of 50 for under $6 and free shipping:

https://www.aliexpress.us/item/3256804397829959.html

Amazing.

You only need 5 wires.

Your code switches on/off pins in groups of 3, with 2 leds per pin. That's 4 groups of 6 LEDs that go on/off together.

You need 4 Arduino pins, 4 ordinary npn transistors (e.g. bc337), and 4 base resistors. Plus your 24 series resistors, which you can build into the lightbar.

As only 4 pins are needed, you won't benefit from charlieplexing.

1 Like

Thank you. In the back of my mind, I had thought that Transistors may help with this and I have a whole case of them. I will consider it. Especially since I only want a rotating/chasing pattern (1 pattern) and really don't need all the programming capability of addressable LEDs. Thank you.

So you are telling me that instead of using the 12 digital outputs with 2 LEDs per pin, I will only have to use 4 with your suggested transistor method?

1 Like

Please note that the 4 LEDs per group do not just go off and on - they chase in a loop. Just want to have that understanding as per the code.

I think that is right. I didn't make a timing diagram or look too closely at your code but if you can identify LEDs that are only on and off at the same time, those N LEDs coukd be driven by one poutpout pin signal and a transistor or MOSFET driver to handle the higher than a pin can handle by itself current.

On the other hand, or would it be the same one, full charlieplexing or multiplexing or output expander or going to neopixels would mean when you get creative, you will have anticipated that you might do, and be ready so each LED could be turned on or off or dim or red or blue and so forth independently.

a7

1 Like