# Toggle transistors with an shiftregister to light up an LED

First of all I'm quit new to electrical engineering. I had it 3 years in class but I didn't do well.

So here is what I plan. I got some shift-registers (74HC595) Which I'll set with an arduino mega 2560. With this I'd like to light up an LED. First I thought I could do it without any other circuit by just adding the right resistor to the 5V lane of the register.

simulate this circuit – Schematic created using CircuitLab

But I noticed that the register can handle up to 700mW so it wouldn't be possible and I think that the idea overall is bad. So I decided to add transistors to the circuit.(2N3904)

simulate this circuit

So my question is, if I need a resistor in front of the Base of the transistor? If so what value or let me know how to calculate it so I can answer it myself for the secont transistor. (see second question down here)

And I got one more question to it. I'd also like to disable LED's by disabling the mass with an transistor. Can I just do it as shown above?

(To mention this here. I'll use it to light up 75LEDs (25RGB) in 5 Layers. By disabling the mass of a layer I can set one layer of leds at once. This will be mulitplexed to handle each led)

Update: So in total it should be something like this to handle more then one LED:

simulate this circuit

Since i got kathod LEDs it should need to be like this:

Calculation should be simmelar right?

Assuming your RGB LEDs are common anode, you will need 5 PNP transistors for level control and 75 NPN transistors for LED control.

For PNP it has to handle maximum 75 LEDs and for NPN it has to handle maximum 5 LEDs. For PNP I recommend using Darlington transistors.

To saturate PNP, $V_B<V_E$ and $V_B<V_C$. And to saturate NPN, $V_B>V_E$ and $V_B>V_C$.

simulate this circuit – Schematic created using CircuitLab

In saturation region, transistor amplifies base current, so there is no need to pass high current to base-emitter. Thus, you can use base resistor. In fact, you should, because of current limit of shift register and transistor.

For minimum base resistor value:

$$R_{R2}=\frac{V_{CC}-V_{Q1_{be}}}{(V_{CC}-V_{Q1_{ce}}-V_{D1}-V_{Q2_{ce}})/R_{R1}/h_{fe}*2*75}$$ $$R_{R3}=\frac{V_{CC}-V_{Q2_{be}}}{(V_{CC}-V_{Q1_{ce}}-V_{D1}-V_{Q2_{ce}})/R_{R1}/h_{fe}*2*5}$$

Refer to transistor's datasheet for $V_{be}$(Base−Emitter Saturation Voltage), $V_{ce}$(Collector−Emitter Saturation Voltage), $h_{fe}$(DC Current Gain). (There may be voltage drop in shift register, but it's not significant, so I omitted it from calculation.)

To be safe, use minimum $h_{fe}$ and maximum $V_{be}~and~V_{ce}$.

Also, there is high-power shift register. You might want to consider it.

• Thanks for the answer. Since I'll have more than one led at a the same line I need to be able to disable them separate. So I have 5 LEDs on QA but just d1 can light up. I'll demultiplex them like this so I can handle the 125rgb LEDs in 5 steps.(5x5x5 rgb led cube) I am sorry that this was unclear. could you give an example for the calculation? Vcc will be 5v and Vbe would be 5V without a resistor. – BennX Oct 6 '14 at 14:51
• I'd be thankful to see one example calculation for exactly the R2. Do I take the Vbe sat and Vce sat values? Which Hfe do I tske there are more than one at the sheet. – BennX Oct 6 '14 at 14:59
• I thinks you mean multiplexing. Multiplexing is getting multiple output from less output, while demultiplexing is getting less input from multiple input. You have to consider every situation, and since it's 'minimum' base resistor value, it will be minimum @all diodes turned on. WIP – ylem Oct 6 '14 at 15:25
• Yes you Are Right i mean multiplexing. Thanks for the correcting. – BennX Oct 6 '14 at 15:29
• What multiplexing method(how many shift register) are you going to use? – ylem Oct 6 '14 at 15:38