Go Down

Topic: Me and my 74LS164 again, with ULN2003APG, why do LEDs light up? (Read 2070 times) previous topic - next topic

mmelendeze

Heh heh, me again with my 74LS164 register  :smiley-mr-green:

Brief recap: I'm trying to make good use of the pins on my Uno for controlling a whole lot of outputs, and came up with the idea of a shift register. Problem is, this 74LS164 has a really small current tolerance, which makes it useless for driving anything that's not a single LED.

Tried to find a suitable shift substitute locally with a higher current tolerance, but, no success. So I poked around to see what else they had, came up with a ULN2003APG darlington array. Which is pretty much what I had in mind from the start: an IC that was just a bunch of transistors which could be used for switching... the ULN2003APG having the advantage or being ideal for +5V CMOS, having limiting resistors built into the input pins, and clamp diodes on the outputs. And when they gave me the price tag (about $0.80), I was sold.

So here's a test circuit I built over the weekend:



Idea is simple: the output pins on the shift register drive the input pins on the array so the motors and LEDs run. Remember the ULN2003 has built in resistors (2.7k) on the input pins, that's why there's none on the register outputs, and it also has clamp diodes inside therefore there's none on the motor. For simplicity, I only drew two LEDs in the diagram, but on my setup I had 6 of them, plus a 12V 190 mA PC fan (actually drew more like 120 mA). R1 was simply calculated to keep the IC within the power tolerance, might need a little tuning depending on the motor draw.  R1 was a big 1.5W resistor since I had calculated there'd be a well over 1W going through there with everything running. Why a shared R? Didn't have space on my breadboard for so many resistors and pins and jumpers for the test :smiley-roll:

OUT8 on the shift was tied to ground through a 1.5k resistor, so it wouldn't float and drive the shift register crazy. COM was not connected to anything.

Ignore the LED part #. I have no idea what part # the LEDs my store carries are.

All grounds were tied together (5V, 12V, Arduino), +12V was coming from a 300 mA AC adapter, +5V was a tap from the 12V through a 7805, and the arduino was powered by USB.

And, it worked pretty well. Except for one thing. If I substituted O7 for a LED, there'd be a dim but noticeable glow in all the LEDs that were off. And the ones that were on would glow real nice and bright. If I took out O7 and put in the motor, the off LEDs started glowing brighter and if any were turned on, they wouldn't glow much brighter than the ones that were off.

In the end I did it the standard way (1 resistor per LED) but with only a few LEDs + motor, and that solved the problem. The LEDs that were off were totally dark with no glow, and when they were on they glowed wonderfully bright. I even got the shift register to blink them while the fan was running and everything, using the Shiftout function.

Only thing is, I'm still wondering why exactly the LEDs wouldn't turn off when I had a shared resistor. The brightness issue was clearly the motor's fault. But the turnoff issue? The 74LS164 had about 0.3V on the pins that were off, would that be a big enough current to open up the outputs on the array and make the LEDs glow? And if that's the case, why does switching to one resistor per LED solve the problem?

Grumpy_Mike

You have a 20R resistor in the ground, do not do this. It lifts the ground and allows the other inputs to bleed cirrent, that is why they were glowing.
Each LED NEEDS its own resistor, and ground on the buffer needs connecting to ground.

Go Up