“Chipiplexing” efficiently drives multiple LEDs using few microcontroller ports
Actual microcontrollers have powerful bidirectional I/O ports, and you can use different techniques to fully exploit such capabilities. Recent Design Ideas described the “Charlieplexing” method as an effective way to drive M=N×(N–1) LEDs using only N bidirectional I/O ports and N resistors (reference 1 and reference 2). Unfortunately, using Charlieplexing allows you to drive only one LED at a time, so, when using a large number of LEDs, only a tiny slice of time is available to multiplex each LED: TDRIVE=T/M, where T is the PWM excitation period. As a consequence, to obtain a given average current and bright LEDs, you must excite them with a current M times higher, and you can’t usually obtain such peak currents from the microcontroller port.
This Design Idea describes “Chipiplexing,” a method in which you need to add only N cheap, bipolar transistors. This circuit uses PNP types, but you can also use NPN devices. (The term Chipiplexing comes from my nickname, Chipi.) The benefits pay the additional cost because you can simultaneously drive N–1 LEDs, thereby reducing peak currents N–1 times.
Figure 1 With Chipiplexing, you need to add only N cheap, bipolar transistors to simultaneously drive two LEDs.
Figure 1 shows the approach for N=3 and M=6, but you can use the same criteria for different values of N; in this case, you can simultaneously drive two LEDs. The current-limiting resistors connect in parallel with the base and emitter of the added PNP transistors, and all the collectors connect to ground. If you set one of the microcontroller ports to zero, or ground, the respective PNP transistor has a grounded base, and its emitter is at a fixed voltage—typically, 0.7V. You can excite every LED whose cathode connects to this emitter through the remaining ports. If you set the port to one, the battery voltage, the LED turns on; if you set the port to high impedance, the LED turns off.