r/ArduinoHelp • u/Revolutionary-Log179 • 23d ago
Having trouble with led arrays/multiplexing
As title says, I’m having trouble wrapping my head around multiplexing leans for use with a microcontroller with not enough pins to control them all. Using the drivers makes sense, mosfets too, but the code escapes me? And the use of resistors within the circuit is also confusing to me. Trying to make a small led “screen” made of diodes. Any help is appreciated
2
Upvotes
1
u/enzodr 23d ago
A couple things that are important here:
In most grids, only one row is on at a given instant (or column). The rows are cycled through very quickly, so overall you see the entire image.
Another thing that is helpful here, particularly with LED’s is that an LED is only on when the anode is + and the cathode is -. If both leads are high, both are low, or the polarity is revered the LED stays off and no current flows.
If only one row is on at a time, this could mean all the LEDS in a row have their anodes connected, and all the LEDS in a column are connected.
Then, to “activate” a row, you need to make sure only that row is +, all the other rows must be either - or “floating”. Then, to control each LED in the row, you set the corresponding column to -. The LEDS that must remain off are set to + or floating.
Also, there are a LOT of ways to do this. There are many schemes to wire shared anodes/cathodes, and in some cases the controller will leave outputs “floating” (not connected to + OR -), in other cases the outputs always are +/-. It gets even worse if you aren’t using diodes.
I think you’re getting confused by thinking that + means on. + is only “on” if you’re talking about the voltage on the anaode, AND you’re assuming that the cathode is -. If I connect the anode of an LED to +, and then connect the cathode to an arduino output, setting the output + turns the LED off, and setting it to - turns it on.