Arduino Forum

Using Arduino => LEDs and Multiplexing => Topic started by: mmelendeze on Jan 04, 2013, 05:51 am

Title: 74LS164P shift register, in sinking configuration?
Post by: mmelendeze on Jan 04, 2013, 05:51 am
Hello,

Wondering if anyone can give me insight on this one. I'm playing around with a shift reg, HD74LS164P. Datasheet is at http://www.alldatasheet.com/datasheet-pdf/pdf/246762/RENESAS/HD74LS164P.html (http://www.alldatasheet.com/datasheet-pdf/pdf/246762/RENESAS/HD74LS164P.html)

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/ (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?
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: John_Smith on Jan 04, 2013, 06:10 am
Have you connected the ground to the arduino ground ?
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: mmelendeze on Jan 04, 2013, 06:24 am
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.
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: mmelendeze on Jan 04, 2013, 06:57 am
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)
Title: 74LS164P, can it go in sinking configuration?
Post by: mmelendeze on Jan 04, 2013, 07:02 pm
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?
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: dhenry on Jan 04, 2013, 07:48 pm
Quote
did I just happen to pick a wuss of a shift register that can't do 8 LEDs,


Yes.

Quote
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.
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: CrossRoads on Jan 04, 2013, 09:47 pm
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.
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: Grumpy_Mike on Jan 04, 2013, 11:12 pm
Quote
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.
Title: Re: Help with 74LS164P, LEDs and Arduino
Post by: John_Smith on Jan 04, 2013, 11:42 pm
Quote
At 8mA it will be perfectly bright enough.


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

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

Title: Re: 74LS164P, in sinking configuration?
Post by: mmelendeze on Jan 09, 2013, 08:09 pm
:smiley-mr-green: Found myself an LED display (A-503GA) from an old PC chasis, only it's common anode: http://www.datasheetdir.com/A-503GA+LEDs (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: http://www.alldatasheet.com/datasheet-pdf/pdf/246762/RENESAS/HD74LS164P.html (http://www.alldatasheet.com/datasheet-pdf/pdf/246762/RENESAS/HD74LS164P.html)
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: Grumpy_Mike on Jan 09, 2013, 11:25 pm
Quote
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.

Quote
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.
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: mmelendeze on Jan 09, 2013, 11:28 pm

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


My bad... LED, not LCD.

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?
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: Grumpy_Mike on Jan 09, 2013, 11:30 pm
Yes that is right.  :)
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: mmelendeze on Jan 09, 2013, 11:32 pm

Yes that is right.  :)


Getting that one right after a week of misbehaving circuits just made my day  XD
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: naut on May 30, 2013, 01:03 am
Quote

Quote
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?

Title: Re: 74LS164P shift register, in sinking configuration?
Post by: CrossRoads on May 30, 2013, 02:41 am
Not "shorted", but connected via transistor.

http://www.ti.com/lit/an/scea009b/scea009b.pdf

See figure 6 on page 5.

http://www.ti.com/lit/an/szza036b/szza036b.pdf

See figure 27 on page 48.
Title: Re: 74LS164P shift register, in sinking configuration?
Post by: naut on May 30, 2013, 03:04 pm
cool, thanks, the diagram makes it easy to understand:

Quote
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.