-->
Page 1 of 1

Get more from outputs with tri-state charlieplexing.

PostPosted: Sat Oct 31, 2015 5:39 pm
by Barnabybear
Hi, working on a different project (none ESP related – Christmas lights) I needed to charlieplex some leds. I’ve not done this with tri-state devices before (ESP is a tri-state device); interestingly it effectively increases the number of output options (as long as you don’t need both at the same time).
So here’s how it works (the tri-state bit):
3.3V -> LED_1 -> GPIO -> LED_2 -> GND.
GPIO set as INPUT = Both Off.
GPIO set as OUTPUT & LOW = LED_1 On.
GPIO set as OUTPUT & HIGH = LED_2 On.
It hadn’t occurred to me that as an input the pin becomes high impedance to both 3.3V and GND.

With regard to charlieplexing: It's a way to control more single leds than you have GPIOs.
2 GPIOs = 2 leds (2)
3 GPIOs = 6 leds (4+2)
4 GPIOs = 12 leds (6+4+2)
5 GPIOs = 20 leds (8+6+4+2)
6 GPIOs = 30 leds (10+8+6+4+2)
7 GPIOs = 42 leds (12+10+8+6+4+2)
8 GPIOs = 56 leds (14+12+10+8+6+4+2)
Basicaly (n x n) - n
The Adruino min pro I'm using has 16 GOIOs which means I can contol 240 leds, that makes a nice chasing string.

Not the most exciting development, but I haven’t come across it before, so I thought I’d share.