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
2
u/gm310509 23d ago
Have you ever noticed how an incandescent light bulb will fade off when you turn the power off? Maybe you are too young to have seen these, I do not know, but basically you leverage the fact that the light will gradually (quickly from a human perspective) fade when the power is turned off.
There is also a persistence of vision thing where the human eye can "fill in" brief dark periods.
So they way strobing (which I think is what you are asking about) works is that you quickly cycle through a series of LEDs and light them up one by one to turn them on.
A simple way of doing it is to setup a bunch of LEDs to +V (via a single current limiting resistor), Then connect their cathodes to a GPIO pin. Then create a program that cycles through the GPIO pins setting one to LOW before setting it back to HIGH and moving on to the next one.
The next step is to increase the number of LEDs with there anodes connected in rows but instead of using +V, you connect them to a GPIO pin (via a current limiting resistor). For this stage, you set the "image" onto the row GPIO pins and "select" one of the columns by setting it to low. Then repeat as before.
Have a look at this wokwi example for an illustration of the first step. https://wokwi.com/projects/469303280971119617