I know this might not be the best place to post such a question but since I am working on a Bela I thought I'd post it here. I am trying to make a 8x8 LED matrix (actually a bigger one, but for now it would be easier to discuss this more simplified version) and I have gotten too confused about a few things concerning the current I need to source or sink as well as the brightness of the LEDs.
For multiplexing I am using two 74hc595 parallel out shift registers each connected to the 8 rows (anodes) and 8 columns (cathodes) respectively. In the case where I have a walking bit (0) for the cathodes, meaning I ground each column at a time and give 3.3v to the rows I need to light in that column, I need to sink the current for up to 8 LEDs in one pin. Since the 74hc595 can source/sink up to 25mA per pin and up to 70mA in total, it's not possible to sink the current for all 8 leds, neither can it source (to the rows) that current to 8 leds. For sinking the current I have found an IC, namely the ULN2803 darlington transistor array, which can sink up to 500mA per current. So that seems to be fine, considering each LED can handle up to ~20mA of "Continuous Forward Current".
Accordingly for sourcing current to the rows I could add a circuit consisting of an NPN transistor and a shunt regulator (tlv431) as explained in this video:
This circuit can allow me to provide constant current at each row.
On the other hand there is the problem of LED brightness that comes with multiplexing. Since each column would be on just for 1/8 of the time (1/8 duty cycle) that means I would need to provide more current than the 20mA given for Continuous Forward Current to perceive the same brightness, and from what I've understood I would need to give it about 8 times as much (~160mA). In the specs of an LED there is the "Peak Forward Current" which, depending on the LED, could be ~150mA, but a note says "1/10 Duty Cycle, 0.1ms Pulse Width." Since I am multiplexing using the gpio pins through the render function I can fill the storage register of a shift register in the time of one render (for 16 block size = 8 rising edges of the clock). This means that for 44100 sampling rate, 1 render runs with a frequency of 44100/16 = 2756.25Hz, or every ~0.36ms. So my pulse width would be 0.36ms 3-4 times more than specified, and also my duty cycle would be 1/8 instead of 1/10. That means that I shouldn't provide the peak current specified but something rather less (in order for the LED to be able to dissipate the heat). Even if it would be possible to provide 100mA to each LED, then the column should be able to sink up to 800mA even though the ULN2803 can sink up to 500mA.
Such are my considerations. Maybe someone has any idea about all this stuff?
Thanks in advance!