transistor selection?

I'm building a circuit based on the 74HC595 shift register and I believe I've run into a problem with the current available from this device. The code appears to work as desired thus far, so I'm hesitant to change to another device such as a TPIC6595 and I'd like to make this one work. To that end, I believe that I can use a set of transistors on the output side of the shift register to drive the LEDs.

The LEDs are 20 ma (2v forward voltage) each segment and there are two sets of 7-segment displays, which indicates 280 ma total current draw. I can confirm that the rest of the circuit fails when the LED displays are connected and works when bypassed/disconnected. Voltage is 5v for the LED but can be 12v, as the 5v is coming from a voltage regulator drawing from 12v anyway. The LED modules are common cathode.

I've not picked a transistor because I'm lost when it comes to the calculations I've been presented. I believe that I should have an NPN type transistor, so I used that in the schematic above and I hope I've referenced the wiring connections properly. The resistor value for the LED is a little high but not by much I hope. Some of the research I've been doing suggest that I need a resistor between the base and the 74HC595 pin, some suggest that no resistor is needed.

I would appreciate a confirmation that the circuit is correct. If so, I would also appreciate a confirmation that a resistor is not needed between the shift register and transistor or if one is needed, what value to use. What transistor should I use in this circuit? I've found a 2N3904 listed as one option during my research, but it was not specified for a circuit of this type, more like a generic solution. I'm okay with generic.

  1. The 75HC595 is rated at 70mA total current, so if you use all 8 outputs to drive LEDs then you are limited to 9mA per LED to avoid overloading the device.

  2. However, in practice most ICs tolerate overloading for short periods, so I suspect the problem you are seeing is due to lack of decoupling capacitors. Connect a 0.1uF ceramic capacitor between Vcc and Gnd of each 595, as close to the chip as possible.

  3. Yes you do need a resistor between the 595 output and the base of the transistor. If your LEDs are 20mA then I suggest 2K2.

  4. As shown you have the LED connected the wrong way round. The cathode needs to be connected to the collector of the transistor, and the anode to the +ve supply through the 220 ohm resistor. Or you can connect the resistor between the cathode and the collector instead.

  5. 2n3904 is adequate for switching 20mA.

PS - alternatively, a single ULN2803 chip can replace 8 transistors and their base resistors. You still need the 220 ohm LED series resistors.

THe drawing as shown is incorrect you need a 2K2 to 4K7 resistor from register to base. The selection of a transistor is solely dependent on it's purpose and Gain for low current < 100 mA the 2N3904 or BC547 or a 2N2222 is fine, for more current a "Logic Level Mosfet is to be desired they with suitable heatsinking can handle Very Large currents faultlessly. If using a Mosfet a "Gate" resistor of 1K to 2K2 ohms is fine as the gate draws no current except the short time it takes to charge the gate capacitor and is there as much to lower switching noise on the 5V source as much as anything else.

Doc

Thank you for a quick and concise reply.

The spec sheet I found for the 74HC595 indicated 9ma per output, so that's close to the 70ma figure you've provided. The duty load is high enough that I would not use the expression "short period" in this example.

Apparently, I got one part of the math correct, as I had calculated 2.15k and the nearest resistor to that is 2.2k as you suggest.

I used a free program called fritzing http://fritzing.org/ to create the schematic and hoped it would place things properly. Because the LED module is common cathode, I may be on the wrong track? I have to be able to connect anodes to the transistors. Does that mean a PNP transistor instead? If so, is there an equivalent to the 2N3904 and by extension an equivalent to the ULN2803?

I've just found that sparkfun sells a common anode version of the 7-segment module I'm using, at a reasonable price. It appears that it would be simpler for me to re-wire for the other display and use the answers presented here, than to try to chase down an equivalent transistor array or build in all those individual transistors.

You're futzing with too many parts there.

I agree, it's a lot of parts. The code I have is comprised from others' work, not my own, as I lack a solid enough understanding of programming to create from scratch. As such, I have to rely on that which works in programming with that which works in hardware/electronics.

I'd love to use the circuit you created/presented here, but then I'd have to begin again with new code. That may result in more unanswered questions than I have now.

So use the 2nd schematic and the Common Anode LEDs. Then code stays the same, a '1' shifted turns on a LED.

I've just ordered some TPIC6B595s and some common anode seven segment display modules.
I'm should be able to determine pinouts for the shift register on the new device.

Since I'd have to order transistors or transistor arrays and probably would have had to buy common anode display modules, this way is clearly simpler. Since I'll have to use current limiting resistors on the LED segments, I can size them for 12v and not worry about a voltage regulator either.

Getting simpler with each step.

thanks

There you go.

In view of the new hardware, I've been tracking pin-to-pin from the 74HC595 to the TPIC6B595 to ensure an easy swap on the board. Using others' arduino projects published to the 'net, I've been able to identify the pinouts to match to my current code. I'd really appreciate a confirmation of the correct connections.

The obvious ones such as the 8 data pins, data in and the data overflow are identified, as well as ground and +5v.

74HC595						TPIC6B595
OE (13)	output enable input			G (9)		Held to ground
MR (10) master reset				SRCLR (8)	+5v
SHCP (11) shift register clock input		SRCK (13)	clock pin on UNO  *
STCP (12) storage register clock input		RCK (12)	latch pin on UNO  *

The * items are the ones of which I'm uncertain, but confirmation of the other two would be heart-warming too. Thanks!

Storage Register clock, which moves data from the shift register to the output latch, is normally connected to SS.

I'm not sure what SS represents. There's no label of that nature on the TPIC, nor a corresponding connection from the old 74HC595.

The arduino code uses latch pin and clock pin for terms. What are the equivalent labels for the TPIC?

Does this help?

Yes, it confirms that I've grounded the correct pins and held high the appropriate ones. SH_CLK and SCK remain ambiguous to me. One of them is considered latch, while the other is probably clock in the code I've seen and in the code I have.

A quick Google search presents this bit of code:

//Pin to clear the register
const int clearPin = 7;
//Pin connected to latch pin (RCK) of TPIC6B595
const int latchPin = 8;
//Pin connected to clock pin (SRCK) of TPIC6B595
const int clockPin = 12;
////Pin connected to Data in (SER IN) of TPIC6B595
const int dataPin = 11;

but the original poster modified the code later and removed references to latch and clock, so I'm hoping that the references are still valid. In the process, I learned that I'll need a 100nf capacitor between ground and +5v, which probably saves me grief down the line.

Yes, the cap on the chip's +5 pin will help with stable operation.

Are you using SPI.transfer() to send data to the chip, or shiftout()?

shiftOut(), with local code written by another no-longer-active-on-the-forum arduino user. I think he was not able to get the canned shiftOut() to work as he wished, so he wrote his own. Some of my research referenced SPI and I pretty much ignored those posts, as they were not applicable and would have thrown a bigger wrench in the works than a new shift register and common anode led module.