Circuit Question - Transistor Related

Hi Everyone

Newbie here, and this is my first post. I hope this is the correct forum for my question.

I’ve come across this circuit for controlling an 8x8x8 LED cube from Electronics Demon. I think I understand the circuit and how it works, but I’ve noticed there is no resistor on the base of the transistors - I have attached the circuit diagram.

I thought a base resistor is always needed to avoid destroying the transistor, yet Electronics Demon has built this circuit without (apparently) any problems (see his YouTube description here if you wish: How to make 8x8x8 LED cube using arduino - YouTube).

Am I missing something? Could this be acceptable because the transistors are each ON for only a really short time period?

Any thoughts and suggestions are much appreciated.


There really should be a resistor at the base of every 2N2222 transistor. This would equalize the currents in the pairs of transistors, and prevent excessive current from a shift register output when the output is high. It would probably work as shown, especially if shift register outputs do not go high for very long (don't stop the code that drives this) but that is not the way that I was taught to do design.

Yes, bad circuit. Not only should have resistor on every npn base. Also the 220R are too low, could force each '595 to source ~110mA when the max is 70mA.


Thanks for your responses.

Based on your feedback, I've done the calculations below. I've also never done this sort of thing before so if you think I've got something wrong please let me know.

I am going to build this circuit with blue LEDS (if the parts ever arrive - geeze it's taking forever).

Regarding the 220 ohm resistor to protect the LEDs...I have a data sheet for super-bright blue LEDs that says the forward voltage is 3.5 volts. The 'internet' also says the forward voltage for blue LEDs is 3.3 volts. So assuming the lower value, each LED would draw 7.7 mA (i.e., (5-3.3)/220).

The shift register current limit (from a Philips datasheet) is indeed 70 mA as stated above. At most, the shift register would be supplying 8 LEDs simultaneously, which means the maximum shift register current is 62 mA (8*7.7) - so I think 220 ohms is ok for blue LEDs.

For the transistors, they may be ok as is due to the short ON time but to be on the safe side I will add a resistor for protection. At most, each pair of transistors will be powering 64 LEDs, which means the collector current will be about 500 mA (64*7.7), or 250 mA per transistor (he has two for each layer of the cube but I think he could have managed with one because the 2222a version can take 800 mA). Assuming 1/10 of the collector current to put the transistor into saturation means the base current should be about 25 ma, which means (assuming a 0.7 base emitter voltage drop), a resistor of 172 ohms should do.

I have some 110 ohms so I'm thinking those will be ok, since that will ensure more than 25 ma but not exceed the max rating from the datasheet of 50 mA base current (for saturation at 500 mA collector current).

Does this seem reasonable to you?

I'm also thinking a decoupling capacitor should be provided for each shift register, also based on what I've been reading on the internet. As I understand it, this is to protect the shift register from inductance induced voltages which could go high temporarily as the shift register changes state. Presumably you would also agree with that?

Lots of changes to this circuit, and I'm going to take the button out as well and add more effects to the software. I hope it all comes together - a month ago I had no clue about transistors, shift registers, diodes, microprocessors and C programming. But I did know Ohm's Law :slight_smile:


I have not previously looked into how to build an 8 by 8 by 8 cube. Interesting!

Simple bad design to use transistors for the cathode drivers.

A TPIC6A595 would perform the job perfectly - if you can reasonably guarantee that the code will not crash with all LEDs on.

Sounds like you are being sensible and logical and researching stuff for yourself and questioning whether circuits published on the internet are necessarily correct. +1 karma. Yes, use series resistors for the transistor bases. Why? Because most semi-conductors have a "bad habit". That is that their resistance drops as their temperature increases, unlike most "Ohmic" conductors. This can easily lead to "thermal runaway" where the temperature rises, the resistance drops, the current increases, causing more temperature rise. So they are not self-limiting. You have to take measures to limit the current.


OP again.

I looked into that TCIP6A595 suggested above. Thanks for the tip, but the datasheet says each output pin is rated at 350 mA and I think there will be about 500 mA on the pin if 220 ohms are used for the LEDs.

I've also ordered the transistors already so I think I will stick with those, although I will probably only use one for each layer.

Re researching before asking: I picked this as a project because I wanted to learn some new things. And I've learned heaps by reading and thinking through how the components, circuit and the associated software works. So apparently you can teach an old dog new tricks.

Thanks for the feedback.


I looked into that TCIP6A595 suggested above. Thanks for the tip, but the datasheet says each output pin is rated at 350 mA and I think there will be about 500 mA on the pin if 220 ohms are used for the LEDs.

That is why I researched the datasheet before posting. 350 mA is the continuous rating with all outputs on. You will be driving only one output at any one time, and continuously moving from one to the next.

@Paul__B which figure describes the max continuous current, one output on?

  • The current output will not be continuously on, will it?
  • Take a look at figures 8 and 9.

Not having a go at you here Paul, looking for guidance on interpretation of data sheets in general.

I don't think the OP can achieve the pulse width and duty cycle in note #3. More like 1~2ms pulse with 12.5% duty cycle. But only around 500mA, not the full 1.1A figure. So how can we calculate if that's within the specification, or do we have to take an educated guess?

Figure 9... For the OP, the pulse energy will be I^2 x RdsOn x pulsewidth? So (0.5A)^2 x 1R x 2ms = 0.5mJ? That's a lot less than 75mJ.

But then with note#3 parameters, (1.1A)^2 x 1R x 100us = 0.121mJ, even less. What am I doing wrong? What does the 75mJ represent? What does "Avalanche" mean in this context? I guessed "a sudden rush of current", but I can't reconcile these figures.

Why not use this chart:

mJ is usually something with inductive kickback.

Ah, yes! I would guess that 500mA on one output would be ok up to around 75C based on that chart. So the OP should be ok as long as the chip is not too hot to touch (and if it is, maybe glue a small heatsink on it).

OP again.

I see that there is more info in the datasheet than I first noticed- and yes, it would be a single pin live at a time.

Kinda lost in the other part of the discussion about pulse width and mJ though.

Food for thought.


Kinda lost in the other part of the discussion about pulse width and mJ though.

I don't think it's relavent, perhaps Paul__B meant to refer to some other figure. It may only be relavent when connecting the chip to reactive loads such as relays, not LEDs. The table posted by HKJ-lygte shows what you need to know.