74LS164P shift register, in sinking configuration?

Hello,

Wondering if anyone can give me insight on this one. I'm playing around with a shift reg, HD74LS164P. Datasheet is at HD74LS164P Datasheet(PDF) - Renesas Technology Corp

I followed this example to get an idea for how it works: http://www.instructables.com/id/The-74HC164-Shift-Register-and-your-Arduino/step5/Project-1pt-2-2-Wire-bargraph-LED-display-con/. Wired up the arduino according to instructions: A is always at +5, B to a digital output pin, clear always at +5, clock to another digital pin. 3 LEDs through 100 ohm resistors on the first output pins, rest are not connected (don't know if it's relevant to have NC output pins or not?).

I hook up the breadboard to 2 button cells, with data and clock unplugged. All the LEDs light up.

I move it to the Arduino. Connect clock and data, connect 5V from the arduino board. I run the first example sketch. Nothing happens. From what I read it's supposed to alternate on and off and leave the LEDs fixed at that state. When uploading the sketch all the LEDs turn on (I suppose it's while the sketch starts executing), then they turn off and stay off.

I tried the second example.. same thing. Momentarily all LEDs on, then off and nothing happens. The shift is supposed to be visible with the 100ms delay the sketch has, I tried increasing to 500ms in case I was missing something, nothing.

Any ideas?

Have you connected the ground to the arduino ground ?

Yep, when I use the board I'm taking the +5V from the arduino board, so ground is going to the GND pin on the board as well.

Got it... put in 8 LEDs and now it works. Although I don't think a missing 2 LEDs would make the IC go haywire, probably I had something wired wrong and when I put the new LEDs in the wires hooked up right. 8)

Ok, here's the next one. I have my 74LS164P which I use to control a series of indicator LEDs. Nothing fancy, just on and off LEDs. LEDs currently in common anode configuration with a single resistor (330 ohm), so I have the problem that as I light more LEDs, they get dim. That part seems easy enough: use a resistor for each LED, say 100 ohm.

But the 74LS164 datasheet says max recommended output current is 8 mA. So two questions:

  1. How can I be powering a LED at full bright with no problems, which consumes about 20 mA from what I hear, off a 8 mA pin? Is the 74LS164 going to burn out eventually?

  2. Say I wanted to light all 8 LEDs at once, which in theory would exceed the allowed power dissipation of the IC (20mA x 8 x 5V = 800 mW vs 400 mW max on datasheet). Aside from switching the LEDs on and off real fast, what do I do? I heard one solution is to use the IC in "sinking" configuration, can that work on the 74LS164? From what I've read in sinking config your LEDs come first in the circuit and are switched to ground through the IC. But this IC provides voltage and not ground on output pins, so how would a sinking configuration be? Anyone got a napkin diagram?

Or did I just happen to pick a wuss of a shift register that can't do 8 LEDs, and need to switch to a heavier one?

did I just happen to pick a wuss of a shift register that can't do 8 LEDs,

Yes.

and need to switch to a heavier one?

Depends. You can put a npn on each output line to buffer; or you can switch to a beefier one.

TPIC6x595 is good for sinking higher currents; i.e., connect to cathode end of LED, anode to +5, with current limit resistor as well sized for your LED Vf.
Check them out at avnet.com and TI.com
6595
6A595
6B595 << I use this one a lot.
6C595
6D595 << this one with 100mA/pin drive would be fine for 20mA LEDs as well.

which consumes about 20 mA from what I hear

An LED only consumes what you let it consume, this is determined by the resistor. At 8mA it will be perfectly bright enough.

At 8mA it will be perfectly bright enough.

Might be OK outdoors in UK , but might not cut it in real sunshine :slight_smile:

But the brightness of available ( economical ) LEDs seems to double every few months so it is getting less of an issue .

:grin: Found myself an LED display (A-503GA) from an old PC chasis, only it's common anode: http://www.datasheetdir.com/A-503GA+LEDs

So in order to drive it with a shift register, the shift needs to work in sinking mode.

Can this be done with a 74LS164P? How would the hardware part go? Just invert the current direction and LEDs, so that the current flows into the IC output pins?

DS for the 74LS: HD74LS164P Datasheet(PDF) - Renesas Technology Corp

Found myself an LCD display (A-503GA) from an old PC chasis, only it's common anode:

An LCD does not have a common anode or common anything else for that matter.

How would the hardware part go? Just invert the current direction and LEDs, so that the current flows into the IC output pins?

No just wire it between +5V and the shift register pin to sink current through it.

Grumpy_Mike:
An LCD does not have a common anode or common anything else for that matter.

My bad... LED, not LCD.

Grumpy_Mike:
No just wire it between +5V and the shift register pin to sink current through it.

So I would understand one of those shift registers alternates its shift pins between GND and +5V so current can flow either way?

Yes that is right. :slight_smile:

Grumpy_Mike:
Yes that is right. :slight_smile:

Getting that one right after a week of misbehaving circuits just made my day XD

How would the hardware part go? Just invert the current direction and LEDs, so that the current flows into the IC output pins?

No just wire it between +5V and the shift register pin to sink current through it.

So when the pin is low it's always shorted to ground?

74HC164 sinking current.jpg

Not "shorted", but connected via transistor.

See figure 6 on page 5.

See figure 27 on page 48.

cool, thanks, the diagram makes it easy to understand:

DOC Circuit Description
Figure 6 shows a simplified output stage of a typical logic circuit. When the input is low, the n-channel transistor (Qn) turns off and the p-channel transistor (Qp) turns on and begins to conduct, and the output voltage VO is pulled high. Conversely, when the input is high, Qp turns off, Qn begins to conduct, and VO is pulled low. This action is similar to an inverter, and several of these inverting stages typically are cascaded in series to form a buffer/driver.

Simplified Totem-Pole Output Stage.jpg