Hi, I have finded this article about the support of 6 leds that can be handled using ONLY two command wires on a 3V tension
(this look something like guga-plexing but extended to handle 6 leds with 2 pins vs "only" 4 leds for 2 pins with guga-plexing)
I have tested it and it this work
(only manually tested in 3V on a breadboard, not yet tested with an Arduino and/or 5V)
In this article, it use two transistors = 1x NPN BC547 + 1x PNP BC557 and five resistors = 3x 150 ohms + 2x 10K ohms but I have personally used 3x 100 ohms resistors instead 3x 150 ohms resistors
(in 5V , I think to use something like 200/220 ohms resistors instead 100/150 ohms resistors => it's good ?)
Note that this handle "only" one led in the same time on the group of 6 leds ... but this is already not bad at all for only 2 wires to command
Note too that the order of leds colors seem to have an influence on the quality of ligthing
(the best result that I have find seem me to be 2x blue leds for the classic charlie-plexing side, 2x red leds for the BC557 side, and 2 green leds for the BC547 side ... but it's only my subjective/limited point of view, betters RGB combinaisons are certainly possibles)
I want to expend the used method for to can handle many more leds with 3 or 4 wires for example
=> It is possible and is the good formula numLeds = (numPins) * (numPins+1), cf. (3) * (3+1) = 12 leds with 3 wires and (4) * (4+1) = 20 leds with 4 wires ???
(note that this is perhaps numLeds = 3 * numPins or 2 * (numPins +1), no idea about the real formula ... if the fomula exist )
You can replace the transistors by a third I/O pin. This gives the same 6 states for a single LED each, if any one pin is high, one low, and one Z. This scheme can be extended to any number of pins with one high, one low and all others Z. The valid combinations for N pins are N*(N-1). I leave it up to you to replace pins by transistors for any N>3.
But I like good the win of one I/O pin on the control side
This is already a 1/3 I/O pins win compared to a standard charlieplexing ... and this only with the basic scheme of a 3 pins charlieplexed scheme = 6 leds
=> 6 leds with ONLY 2 I/O pins seem me better than gugaplexing than can "only" handle 4 leds with 2 I/O pins ... and above all very better than standard charlieplexing that can only handle 2 leds with 2 I/O pins ...
==> what I want is something like the gugaplexing scheme with 3 I/O pins but I don't find a scheme of it using 3 I/O pins (founded for 2 I/O pins and 4 I/O pins but not for 3 I/O pins)
(of course extended if possible using the "Jnenabadji-plexing" )
[something like handling at least 12 leds, or more if possible, with only 3 I/O pins]
It's for me me a win in the sens that this economize one I/O pin on the control side
This need of course a lot of transistors/resistors, something like 2 or 3 pairs of BC547/BC557 and the same proportion of 100/150 ohms and 10K resistors but I think that this can be handled for 3 I/O pins
(this is perhaps too complex for > 4 i/o pins but can perhaps to be handled for 3 i/o lines, no ?)
I have already begin to work with a MCP23017 16 I/O expander but found it relatively very expensive
(the complete board at 23.99 euros from https://www.amazon.fr/gp/product/B07QL8PNZ8/ref=ppx_yo_dt_b_asin_title_o04_s00?ie=UTF8&psc=1 )
=> the chip only version is very very less expensive at MC Hobby, cf. only 2.34 euros the chip, BUT the reception time is VERY VERY more slow and I haven't yet recept it ... )
I have too begin to to play with a 74HC595N demultiplexer but it can only handle 8 leds with 3 I/O pins
(It can handle 16 leds if I chain two 74HC595N but it only handle the tri-state logic in a global fashion, cf. for alls pins in the same time, not independently for each pin]
I have begin to work with the MCP23017 but I only handle individuals mcp.pinMode() and mcp.digitalWrite() calls for each channel for the instant, not yet the very more globals and efficients mcp.portMode() and mcp.writePort() calls
(but it's on the way, I hope to can handle them before the end of this week)
what is your final goal?
Basically if you use a LED driver instead of a port expander and wire your LEDs in a Matrix than it it should be easy to find an alternative:
I2C: HT16K33 ---> one IC for 128 LEDs in a matrix, up to 8 ICs on the bus
(nearly) SPI: MAX7219 --> one IC for 64 LEDs in a matrix (and only one resistor for all LEDs), possible to daisy chain these ICs
and instead of a pure port expander, see the this alternative:
I2C: SX1509 --> one IC for 16 LEDs on discrete pins, but also PWM, pulsing LEDs, keyboard matrix ...