LED matrix - how to use 74HC595 for LED cathodes

it's clear for me how to use this shift register for a row of leds attached to anodes of LED's, but when wiring / coding the matrix I also need to connect specific cathodes to the ground, so, how do I do that? Is it even possible without any extra chip?

If you drive all anodes at once, then you need a shift register that can sink more current, sinking one group of LEDs cathodes at time.
TPIC6B595 is good for that.
Or ULN2803 as a buffer for 8 arduino pins, or the output of a 2nd 74HC595 shift register.

or the output of a 2nd 74HC595 shift register

Yes, I forgot to mention I want to use separate 74HC595 for the cathodes.
How do I make it work to "sink" current? (not sure if this is the right term)

Source current - high voltage from a pin (5V)
Sink current - low voltage from a pin (0V)

Okay, so how exactly do I get 0V on specific shift register pins? (Same 74HC595)

Arvis:
Okay, so how exactly do I get 0V on specific shift register pins? (Same 74HC595)

With the 75HC595, pins source current, so it's wired as shift register pin > resistor > LED > ground.

With shift registers such as the TPIC6B595N, pins sink current, so it's wired as, VCC > resistor > LED > shift register pin.

I hope this helps

By the way, you can obtain samples quantities of the TPIC6B595N from TI for free.

Yeah I got that! But is there a way I can make 74HC595 SINK current? Got plenty of these chips, so why wait until another chips arrive if I could use more of these right away.

Arvis:
Yeah I got that! But is there a way I can make 74HC595 SINK current? Got plenty of these chips, so why wait until another chips arrive if I could use more of these right away.

According to the folks on this old thread it can:

http://forums.parallax.com/showthread.php/88908-Question-on-74HC595-Shift-Register

If it wasn't possible I would have suggested some general purpose NPN transistors.

I read that topic earlier, but still didn't quite understand how to make it sink current.

In short, what do I have to change in this circuit for that led in the middle (where red and blue wire crosses) light up?
(so left shift register pins can sink current or do nothing and bottom register pins can source current or do nothing)

DO NOT PUT CAPS on the ST_CP line. That will damage the Arduino output pin.
The cap should only be from Vcc to Gnd.

If you shift a 1 to the shift register, it sources current (P-channel MOSFET to +5 turns on, drives the pin high)
If you shift a 0 to the shift register, it sinks current (N-channel MOSFET to Gnd turns on, pulls the pin low)

If OE pin is high, neither transistor turns on, output is floating.

LED needs 1 on anode and 0 on cathode to turn on.
If it has 0/0, or 1/1, or 0/1, the LED will not turn on.

74HC595 has 70mA Max current capability across all 8 pins.
If you plan to have a left shift register output sink current for up to 8 LEDs at once, size the current limit resistors for 8-9mA max.

Thanks, now I know how!

Just little something more...

  1. Are you sure about that capacitor part? Because That part of the circuit is taken from here: http://arduino.cc/en/Tutorial/ShiftOut

  2. Can i damage LED by having 1 at cathode and 0 at anode?

  3. Can I use shift register outputs together with npn transistors (as switches) to increase the amount of current I can supply to LEDs?

In your diagram, the left hand 74HC595 will sink current when its outputs are logic 0. However, the 74HC595 is most definitely not suitable for that circuit. The reason is that each pin needs to be able to sink the current for 8 LEDs at once. With a 25mA pin current limit (even if though you will only drive one pin low at a time), that means only 3mA per LED, which is not enough for multiplexed LEDs. You need to use a TPIC6B595 instead.

A 74HC595 is OK for the lower shift register in your diagram if you choose the series resistors to limit the LED current to 9mA or less (to keep within the chip Vcc current rating of 70mA).

Arvis:

  1. Are you sure about that capacitor part? Because That part of the circuit is taken from here: http://arduino.cc/en/Tutorial/ShiftOut

  2. Can i damage LED by having 1 at cathode and 0 at anode?

  3. Can I use shift register outputs together with npn transistors (as switches) to increase the amount of current I can supply to LEDs?

  1. Crossroads is right (as always), that capacitor should not be there.

  2. No, provided that the voltage levels are not more than the reverse voltage rating of the LEDs (which is normally at least 5V).

  3. Yes, that would be an alternative to using a TPIC6B595 for the left hand shift register.

Great, thanks! However it's confusing that the cap which shouldn't be there is in the tutorial on the official website... :slight_smile:

  1. Capacitor - Yes, we have been trying to get that cap removed for 2+ years now. Do Not Install it. Put a 0.1uF cap from Vcc pin to Gnd.

  2. No, LEDs are fine with Cathode at 5V, anode at 0V

  3. Yes, NPN transistor at output of left hand shift register, or ULN2803 transisor array, or TPIC6B595, which is like having 74HC595/ULN2803 as one part.

To supply more current to the anodes, you need part like this at the output of the shift register
http://micrel.com/_PDF/mic2981.pdf
http://www.digikey.com/product-detail/en/MIC2981%2F82YN/576-1158-ND/771627
I haven't come across a part like this combined with a shift registers, that would be really useful.

Alright, thanks!

Another option for the Anode drives:

turn off the cathode, set up the anodes, turn on a cathode.

I guess I'll try it with transistor switches :slight_smile:

2 more questions:

  1. So 0.1uF cap between Vcc and GND can be non-polar too, right?

  2. Why does the shift register still work if GND pin is pretty much floating? (It's only connected to OE pin of itself, but not the actual ground)

  1. Yes, 0.1uF just plain old ceramic caps.

  2. Gnd pin needs to be connected to Arduino Gnd, otherwise sporadic operation will be seen.