Run LEDs through shift register basic electricity

What I have
So I have 444 led cube

Each layer is connected (anodes) and each column is connected (cathodes).
Meaning I have 4 anodes and 16 cathodes that i use to control all of my LEDs.

What is the problem
My shift register can deliver about 6mA to a leg without voltage drop and 75 total (for 8 Leds) but as you understand I need 160mA for 8 LEDs.

My solution
I have 2N2222A transistor. If I'll connect the output of the register to the base of the transistor and put 20 transistors, 4 for the anodes and 16 for the cathodes, the current will flow through them.

Does it make any sense ? do I need the transistors in both ends (on the anodes and on the cathodes) ?

Just to clarify,
None of the anode or the cathode are connect to the ground, both are controlled through pins the come from the shift register

Your description of what you propose is not clear. If you connect the shift register output to a transistor's base it needs to go through a resistor. You will have to invert the logic of what you send to the shift register.

You could do with posting a schematic of proper help.

There are shift register chips available with high current outputs. That's what you want. For instance TPIC6C595N

For instance TPIC6C595N

Note that this is a sink output only, you can not source current with one.

The problem is very simple.
let's forget about the cube and simplify the problem

I have a single led.
I want to control it through a shift register.
The anode of the LED connected to pin1 of the shift register and the cathode to pin2 of the shift register (through a resistor).

Everything should work great when there is a voltage difference between pin1 and pin2.

Unfortunately the shift register can't provide the needed current (20mA).

Question:
How to solve this problem, assuming I have plenty of 2N2222A transistors ?

BTW,
I can't buy a better shift register or other electronics (I know there are better with larger max current)

let's forget about the cube and simplify the problem

But that will over simplify the answer.

But still:-

How to solve this problem, assuming I have plenty of 2N2222A transistors ?

You can't because while a 2N2222A can sink lots of current it can not be used to source current because to do this correctly you will need a PNP transistor.

Grumpy_Mike

I feel a bit stupid here, maybe I didn't understood correctly how to use transistors.

I looked at a transistor as a switch, you put voltage in the base, and the transistor closes the circuit.
I thought I can put the same transistor type as the source and the sink.

Can you clarify what I'm misunderstood ?

Can you clarify what I'm misunderstood ?

There are two configuration you can use a transistor in ( actually three but only two are of interest here ).

  1. Common emitter - The emitter is in the ground and the collector goes from the load to a +ve power. This arrangement is used for sinking current. A small voltage ( > 0.7V ) is enough to turn on the transistor. This configuration can have a voltage gain of typically 100 to 300 and even greater.

  2. Common collector - The collector is connected to the +ve power and the emitter is connected to the load and the other end of the load to the ground. This can be used for sourcing current. BUT the voltage on the emitter can never be more than 0.7V LESS than the voltage on the base ( Vbe). This configuration is often called an emitter follower because the voltage on the emitter follows the voltage on the base. This configuration has a voltage gain of one.

In order to correctly source current you must have a common emitter configuration using a PNP ( sometimes called an upside down transistor ) because the emitter must be connected to the +ve power and the collector to the load.

There is also a saturation voltage ( V sat) associated with a turned on transistor and this can be anything from 0.6V to 2V depending on the current and the transistor's design ( type ). Couple the V sat and the Vbe using a Common collector to source current is going to cost you a significant voltage drop.

This link might help you:-

Thank you for your answer,

But still something is not right.
I understand that the 2n2222a should be used a source and the base should be connected to the ground.

I took the 2n2222a transistor and connected it like this :

And the LED turned on.

Isn't that the opposite of what should work ?

Isn't that the opposite of what should work ?

No that is exactly what should happen. That is an emitter follower configuration( Number 2 ). Measure the voltage on the emitter and you will find it is your battery voltage minus 0.7V + what ever the Vsat is.
Note the lack of a base resistor is fine in this specific configuration. Do you understand why?

If you have a PNP transistor ( and emitter and collector swapped over ) then the LED would be off.

Grumpy_Mike:
That is an emitter follower configuration( Number 2 ). Measure the voltage on the emitter and you will find it is your battery voltage minus 0.7V + what ever the Vsat is.

No, it is actually battery voltage minus 0.7V. :roll_eyes:


All this mucking about is understandable if you wish to upgrade the design to a 6 by 6 by 6 or an 8 by 8 by 8 or so, but if you only want 4 by 4 by 4 you use a MAX7219 and it is completely solved.

Saturation voltages can/should be a lot less than 0.6 -- 2V! 0.1--0.25V is common for small transistors.
2V is definitely not in the saturation region anyway.

MarkT:
Saturation voltages can/should be a lot less than 0.6 -- 2V!

Look at the circuit given.

Grumpy_Mike:
No that is exactly what should happen. That is an emitter follower configuration( Number 2 ). Measure the voltage on the emitter and you will find it is your battery voltage minus 0.7V + what ever the Vsat is.
Note the lack of a base resistor is fine in this specific configuration. Do you understand why?

If you have a PNP transistor ( and emitter and collector swapped over ) then the LED would be off.

I'm sorry to say that i still don't understand, you said: "In order to correctly source current you must have a common emitter configuration using a PNP"

But In the diagram I've connected a NPN transistor and I'm sourcing using him.
Isn't that the opposite ?

But In the diagram I've connected a NPN transistor and I'm sourcing using him.

Yes BUT you are not using a common emitter configuration are you? ( rhetorical question mark ). Your circuit is a common collector circuit.

I am assuming that base signal is going to come from a piece of logic like a shift register. You will only get 4.5 to 4.8V from that then subtract the Vbe and the Vsat and you are sourcing much less than 4V.

Grumpy_Mike:
Yes BUT you are not using a common emitter configuration are you? ( rhetorical question mark ). Your circuit is a common collector circuit.

I am assuming that base signal is going to come from a piece of logic like a shift register. You will only get 4.5 to 4.8V from that then subtract the Vbe and the Vsat and you are sourcing much less than 4V.

I hope you are not frustrated with answering me :slight_smile:

So you are saying that it is possible to source and drain with a NPN transistor but I will have some limitation.
And the limitation is that I won't get more voltage then I provide to the base minus Vbe and minus Vsat.
Did i understood you correctly ?

If that is the case, let's assume that 4V is enough for me for today, will it solve my current (Amper) problem ?
Will sourcing and draining using NPN transistor allows me controlling a led from a shift register and pushing 20mA ?

Mean while in the last several (frustrating hours) I was able to source and drain using NPN transistors.

Will sourcing and draining using NPN transistor allows me controlling a led from a shift register and pushing 20mA ?

Do not call it draining current no one does, the proper word is "sinking" current. While you might think it conveys the same meaning in electronics it does not. The word "drain" is the name given to one of the connections of a FET.

Given you are using red LEDs then there will probably be enough voltage to source and sink an LED. However as I said before that is a simplified answer for a simplified condition. Note you will need a base resistor for the sinking transistor but not one for the sourcing one.

I must add that sourcing current with a common collector circuit using an NPN transistor is an example of bad design and I would not be impressed by anyone I saw using such a configuration. Time after time we tell beginners here not to use it. Just because something functions does not mean that it is a viable design that can be used in any other situation other than the one specific one you found it to work in with the exact components you were using.

"I must add that sourcing current with a common collector circuit using an NPN transistor is an example of bad design and I would not be impressed by anyone I saw using such a configuration."

But that's what a pass transistor is all about, that was voltage regulation before voltage regulator ICs.
V_out shouldn't be so close to V_in.
Any other objections?

Grumpy_Mike

Thank you for your answer.
It was important for me to understand this issues. I can't say that I fully understand but with time I will. One can never understand anything fully till he tried it by himself.

How would you suggest to solve my problem with the 444 Led (I would like to make it bigger with time to 555)
Someone suggested the : TPIC6C595N but you said it can't source current, only sink.
Do you have another suggestion ?
Or should I buy PNP transistors, I saw some chips called "darlington arrays" which might be simplier to source current.

Thanks.

But that's what a pass transistor is all about, that was voltage regulation before voltage regulator ICs.

With a voltage regulator you are generally working with a much greater overhead. In other words you can afford to loose much more in terms of voltage.

V_out shouldn't be so close to V_in.

But when driving from a shift register it is, and it needs to be.

Any other objections?

Yes, a logic high from logic like a shift register is specified only to have a minimum value of around 3.5V, if you get a low logic value then you have a very much reduced voltage from an NPN sourced circuit. Using a PNP transistor you get voltage gain of much greater than one, giving you the maximum voltage possible on the current source supply.

Or should I buy PNP transistors,

That would be my advice.

One can never understand anything fully till he tried it by himself.

That is only half the story. As I said while you might get away with it for one circuit the design is not robust. You make a thousand of them and it is likely that some will not work. You publish the design and other people use that design with different transistors or even a different batch of the same transistor will not be successful.

While you might only care about getting one circuit going, if you use the right design principals then what you make next stands a much better chance of working because you are using the correct and robust way of doing things. But that is your choice and of course this is my advice.

When I worked for a company that made set top boxes, my design for my first box was more reliable, that is there were less returns after two years, by a factor of ten times compared with any other design they had built over the previous ten years. So I like to think I know what I am talking about.