So how does this work? Well basic math tells us when we have n binary bits we can represent 2^n states. If our output pin could only be in the high or low state, with one pin we would only have 2 states (1 LED that is on or off). With tri-state MCU outputs we can represent 3^n states with n pins. In the circuit diagram above when the pin output is high, the bottom LED will light up. When it is low, the top LED will light up, and when it is high-Z, both LEDs will be off. Vcc is less than 2x the forward voltage of the LEDs, so they don't light up for high-Z.
Below is a video demonstrating the technique on a breadboard. Gracieplexing starts getting complicated when you have more than one pin, and so far I haven't figured a way to control 7 LEDs with 2 pins without adding a couple transistors to the circuit. Even without using transistors, you can still control more LEDs than with Charlieplexing, and I'll go over the details of Gracieplexing with more pins in part 2.
No comments:
Post a Comment