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
shows how there are now nine possible combinations of the three microcontroller ports: the six available when using Charlieplexing to drive one LED at a time and three new combinations to drive two LEDs at a time. The microcontroller port grounds the transistorâs base. This action fixes a junction-drop voltage at the emitter and collects and sinks all the LED currents to ground without overconstraining the microcontroller port, which has to sink only the transistorâs base current plus 0.7V per resistor. Each of the other ports set to the battery voltage needs to source only one LED current.
For more details : Chipiplexing efficiently drives multiple LEDs using few microcontroller ports