Hey guys,
I've been planning to build a project where I need to control four 20 segment led bar graphs, and I've been considering my options for how to control them with my Arduino Pro Mini. Multiplexing is one obvious solution, but dividing the array up into 8 10 segment sections would still require 18 pins, which is too many. Other solutions I've looked at are leaving out a few of the led's on each end, shift registers, and charlieplexing. None of which are particularly appealing to me, for various reasons. Charlieplexing got me thinking though.
I was looking at this graphic in the Wikipedia article about it:
And I wondered... why use two pins to control two leds?
Why not do this?
So I looked up whether that was possible, and I found this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1249317220
Which says you can indeed use this method to turn one led on, or the other, but if you want to turn both off, you need a diode. But that only applies to one pin connected through two leds to Vcc and Ground.
Now, at this point, I must admit, I've reached the limits of my knowledge of circuits, but this is the idea that came to me: If you can do the above... if you can indpendently control two led's from one pin, could you use this to reduce the number of pins needed to drive an array?
What I'm imaginging is an array where every other row has the led's reversed, like so:
(-+)(-+)
(+-)(+-)
The idea being to connect rows 1 and 2 to pin 1, and colums 1 and 2 to pins 2 and 3.
Setting pin 1 high would then give the led's in row 1 the potential to light, while the leds in row 2 would not conduct. (I am indexing here with 1,1 in the lower left corner because I am designing a vu meter, btw.) Then, setting pin 2 low would cause led 1,1 to light, while setting pin 3 low would cause led 1,2 to light.
Of course there is the issue of what happens when you expand this out. What if there were four leds in each column? Then you would have two leds in each columnt that would be set high or low. But this is where the charlieplexing comes in. There's that third state. Could you set all the unused pins to an input state perhaps to make this work?
What do you think? Would this allow me to multiplex a 20 x 4 matrix of leds with just 14 pins, or a 10x8 matrix with just 13, instead of the 18 or 24 pins which would normally be required? And without a bunch of extra diodes? What I like about this idea is that the wiring would be really simple, and I don't think there'd be issues with leds burning out if the code crashes.
Ofcourse that assumes this would work at all. And I have no idea if it would.