Most of us are aware that charlieplexing can drive a large number of LEDs from a relatively small number of I/O pins, but [David Johnson-Davies] demonstrates adding another dimension to that method to create individually controlled PWM outputs as well. His ATtiny85 has twelve LEDs, each with individually-set brightness levels, and uses only four of the five I/O pins on the device.
Each LED can be assigned a brightness between 0 (fully off) and 63 (fully on). The PWM is done by using one of the timers in the ATtiny85 to generate a periodic interrupt, and the ISR for the interrupt takes care of setting the necessary ratios of on and off times for each charlieplexed output. The result? Twelve flicker-free LEDs with individually addressable brightness levels, using an 8-pin microcontroller and just a few passive components on a tiny breadboard. There’s even one I/O pin left on the ATtiny85, for accepting commands or reading a sensor.
[David] really wrings a lot out of the ATtiny series of microcontrollers with his compact projects, like his Tiny Function Generator (which recently got an update.) He also demonstrated that while charlieplexing is usually used with LEDs, charlieplexing can be used with switches just as easily.