# 74HC595 Rows/Columns to drive LED matrix

Let's say we have one 74HC595 and we want to light 16 leds (common anode) connected as a 4x4 matrix exactly as in the following picture : So, 4 first outputs to controls 4 rows. The remaining 4 output to controls 4 columns.

From what I understand at this moment:

In the picture, there is a NPN transistor on the 4 columns to allow more current than what the 595 can sink.

Let's say only ROW1 is active, and all columns are active (LED1,LED2,LED3,LED4). Column 1, Column 2, Column 3 and Column 4 on the 595 will indicates a very low current, just the current set at the base of each transistor by the base current limiting resistor.

However, at ROW1, would it indicates at the 595 the sum of each led current of this row? So 80mA, if we assume each led at 20mA ?

If it's the case, in my case, there is much more 595 and much more leds and I don't want to operate near/over the 595 maximum current (75mA), would I simply add appropriate PNP transistors + base resistors to each ROW to reduce the current of each 595 rows pins ?

I want to keep the 74HC595 IC and low-cost single transistors. I know there are shift registers with higher current capacity and transistors-arrays IC that saves wires and resistors. Also that I can reduce the current of each led with higher resistors to keep it under 75mA, but I would like to understand how to properly work with a matrix arrangement that needs more than what the 595 can work with, using these simple components only.

In other words, is 4 PNP for rows and 4 NPN for columns, the best way to handle >= 75mA on a single row ?

• Not an answer, but a question: Have you considered the idea that you will be multiplexing your LEDs and, if you want them to appear to be ON with an apparent average of 20mA current, that you may have to drive them each with significantly more than 20mA when their column is active? – jonk Aug 31 '16 at 5:46
• Yes, you are right, I would need to drive them with an higher current to get an average of 20mA. But my real problem for now is really that my desired setup is 4 rows of 4 rgb leds each, so (4 columns * 3 colors * 20mA) 240mA per row if I understand correctly... Same thing if I select only one column at a time, I still have 1 RGB led to light ( 4 rows * 3 colors * 20 mA) 240mA per column. – Simon Ampleman Aug 31 '16 at 6:10
• I've done this before, that is if I'm getting where you are going. I used drivers on both sides. Current sources on one side to set the current (your rows, for example) and switches on the other side (your columns.) To reduce needed overhead voltages (may want that) then the current sink/source issue becomes still more interesting. These were settable systems, so I could adjust the peak current for each color, as well, and would PWM (+ scan) down from there. I also used separate power supply rails so that blue didn't use the same voltage as red, to save still more dissipation problems. – jonk Aug 31 '16 at 6:19
• The setup you have is good enough to get you going. You need to drive ONLY one column at the time. The transistor can probably sink enough current. You will not need 20 mA in each LED to get going. Start with 2-3 mA and go from there. Most LEDs light up quite well at 1 mA, even if they are rated for 20 mA. RGB LEDs? Not sure I understand how you like to fit them? – Bernie Nor Aug 31 '16 at 7:13

You can do it the way you suggest, however you should move the resistors to the NPN collectors, and you will need PNP (or emitter-follower NPN) transistors on each row output.

To get a rough idea of the current required- if 5mA is enough for the LED to be bright enough when supplied with DC you will have to supply 20mA for 1:4 multiplexing, and each row driver will have to source 80mA with a 25% duty cycle. Each column driver will have to sink 20mA with 100% duty cycle.

You are proposing to do the multiplexing on a row basis, where 0 to 4 of the LEDs in a row are on at the same time. As you point out, the current required from the '595 ROW pins becomes excessive. I don't know which LEDs you are using, but a rough estimate is that each takes 15mA, so you have to source 60mA from the '595 (which is well beyond its specification). With this arrangement you also have another problem. Since you have a single current limit resistor per row (R1 for ROW1, etc) as you turn on more LEDs in the row the current through each LED will drop, as will the brightness of each LED.

The correct way to do multiplexing of this type is to do it on a column basis. Only one column will be on at any time, with any number of LEDs in that column turned on. Each ROW pin only has to source enough current for 1 LED, which the '595 is just capable of doing. The combined LED current for the column of up to 60mA is handled by the column transistor (T1, etc). You also have 1 current limit resistor per LED (R1, etc), so the LEDs have constant brightness.

• Thank you for your answer. However, in a column basis, there's something I still don't understand and a simulation in circuits.io also shows a current problem on the 595. Each ROW pin,as you mentionned, will source enough current for 1 LED. In my example, there is 4 rows, so if all rows are ON, it's 80mA total on the 595 (I used 20mA for each LED). 75mA is the absolute maximum of the 595. By adding a new row, it would become 100mA total on the 595 and so on. So, I am back with my initial question, it seems to need a PNP transistor to source each rows current. Am I right? – Simon Ampleman Aug 31 '16 at 11:25

Simon, your calculations are incorrect. The 220 ohm resistor on each 595 output limits current drawn to about 10 mA, no matter how many column LEDs are turned on. I'm assuming that a LED drops about 2.5 v when lit.

As Steve G has noted, turning on another column will simply share that 10 mA between two LEDs - and perhaps not evenly. So your HC595 is safe from overcurrent, but multiple columns will cause dimming. Likely not what you wanted. Be aware that internal Rds of HC595 adds about 40 ohms to each 220 ohm.

You have probably worked this out already but this is what I propose you configure your LED matrix. Each LED has a resistor therefore guaranteeing each LED get the same current regardless of how many are on. Of course in this configuration the rows have reverse logic to the columns.

In other words, is 4 PNP for rows and 4 NPN for columns, the best way to handle >= 75mA on a single row ?

I would say yes in my opinion but others might have different suggestions that are just as valid. 