Maker Pro
Maker Pro

Is my transistor circuit design, selection and maths ok?

sparks32

Jun 21, 2015
4
Joined
Jun 21, 2015
Messages
4
Hi There,
I need some guidance on whether or not I have selected the right transistors and their resistors for there bases.I lost all my books in a big flood that I would use to learn this stuff. I need to drive 500mA to 25 RGB LEDS and the output of this AVR chip can only supply 20mA max on a 5.15V supply. Instead of using HFE values i just selected based on the base current
saturation took took from data sheets and took into voltage drop across the transistor at different angles when selecting my base resistors. I couldn't find just 1 transistor to do the job so I selected 2. BC547 NPN draw 5mA to BE(SAT). BC327 PNP takes more than 60mA from the NPN to the base and supplies more then 500mA to transistors( all that those gains i pulled straight off the data sheets). Some said I was way off saying I don't see any HFE values. can anyone advise me if my thinking is flawed and if so show me the right way or at least correct my reasoning ? thanks in advance. I put my workings on the drawing.
led rbg array 2nd draft.PNG
 
Last edited by a moderator:

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,713
Joined
Nov 17, 2011
Messages
12,713
This circuit looks fine.
The BC327 has a DC current gain of ~40 at high collector currents. You'll need 12.5mA base drive current - use 15mA to be on the safe side. The base resistor to the PNP drops ~4.3V (5V-0.7Vbe), therefore Rbase=4.3V/15mA=286Ω. 270Ω is a good E-series value here.
The BC547 has a DC current gain of ~100 at 15mA collector current. Using the same calculation as above you'll arive at ~27kΩ to the base of the NPN.
Your values are much smaller and will certainly work fine, only at the cost of a few mW higher power consumption.
 

sparks32

Jun 21, 2015
4
Joined
Jun 21, 2015
Messages
4
Thank you for your help i was told that my values were too low. I just needed someone to help me with the theory a bit so i can learn. You have been very helpful, much appreciated. Cheers
 
Last edited by a moderator:

hevans1944

Hop - AC8NS
Jun 21, 2012
4,759
Joined
Jun 21, 2012
Messages
4,759
Also, I would drive all those anodes of the RGB LEDs through separate current-limiting resistors.

Presumably, you want 20 mA in each LED (500 mA / 25 LEDs) with the red LEDs dropping 2,4 V while the green and blue drop 3.4 V. So, if your calculations for a single resistor for each group of red, green, or blue LEDs is correct, you need 25 times that value in series with each LED anode, or about 100 Ω for the red ones and 52 Ω for the green and blue ones.

Lessee here... (5.15 - 2.4 - 0.7) / 0.02 = 102.5 Ω for the red LEDs. Check! And (5.15 - 3.4 - 0.7) / 0.02 = 52.5 Ω for the green and blue LEDs. Check!

If you are operating your ATmega from the 5.15 V rail instead of the 3.38 V rail, you may want to run the LEDs from the 12 V rail and increase the size of the current limiting resistors to 442 Ω for the red and 392 Ω for the green and blue (nearest 1% tolerance standard values). This will prevent half-ampere current surges from occurring on the ATmega power supply rail when the RGB LEDs turn on and off.
 

sparks32

Jun 21, 2015
4
Joined
Jun 21, 2015
Messages
4
That is a major concern of mine too. I want to use PWM to dim those primary colors to produce multiple secondary colors. power dissipation across resistors at 12V may not be energy efficient though.I was thinking maybe running the ATMEGA off the 3.38 rail would be ideal. but will that saturate the transistors enough to supply the leds? to tell you the truth I'm a little scared of reworking the transistor problem again in case I make a mistake.
What differences would a 5.15V LED , 3.38V control system have on the transistor and base resistor arrangement? I love that idea
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,759
Joined
Jun 21, 2012
Messages
4,759
...
What differences would a 5.15V LED , 3.38V control system have on the transistor and base resistor arrangement? I love that idea

Page 314 of the datasheet says the output high voltage when sourcing 10 mA could be as low as 2.1 V when Vdd=3V and the chip is operating at an ambient temperature of 105C. So I would consider that "worst case" and lower the NPN base resistor value to (2.1 - 0.7) / 0.05 = 28 Ω. You are well within the total I/O pin current maximum of 150 MA, and clearly the output-high minimum level (2.1 V) is sufficient to forward bias the b-e junction of he NPN while the 28 Ω resistor limits the base current to 5 mA. Go for it!

Yeah, throwing away power on current-limiting resistors is a total waste.

A real PWM circuit would dispense with the LED current-limiting resistors, connecting individual RGB LEDs in series so the current in the series string can be sensed, then do the PWM with negative feedback from current-sense resistors (which are small and dissipate almost no power) or Hall-effect current sensors on each R or G or B LED string. The PWM controller has various forms, both analog control and digital control, but one version uses an up/down counter to set the nominal LED current digitally from zero to some maximum value while the feedback adjusts the PWM duty cycle to make it so. These PWM controllers make for some very "stiff" servo and stepper motor controls, but I think they would work just fine for large LED displays too. The disadvantage is you need to wire the LEDs in series and apply a higher PWM voltage, but almost all the power goes into lighting the LEDs instead of warming up resistors. All that is probably way beyond the scope of your project... and probably scary as hell, too. Continue on in the direction you are going, but if you are ever asked to build a stadium-sized display realize there is a better way.
 

sparks32

Jun 21, 2015
4
Joined
Jun 21, 2015
Messages
4
wow thanks 4 the advice, I see you put some time into helping me , pity that the ATmega328 doesn't have DAC so that there would be no need for that violent switching. the main idea was to do a gradual changing through the colors. i might try do some tinkering with capacitors to smooth out the outputs of the PNP a bit in the bread board stage. I don't have a inline amp meter that would accurately read the RMS value of a square wave form. would a low duty cycle PWM compensate for the 5V forward voltage the led would receive? i Have a Programmable logic controller at home that plays back IR signals at 38kHz through a 9 led emitter I built to turn on appliances so they must turn fully on and off very fast, I might run a LED at 80kHz 24v PWM 0.01 duty cycle and increase it to see where it pops. I'm an electrician by trade and even though i was taught some fundamentals of I always new electronics was a different beast. A stadium would be the dream but as you can probably tell i have a bit to learn in this arena before i would attempt something like that. baby steps for me i guess, hopefully I'll have a few little something specials thrown together in time for Christmas this year.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,713
Joined
Nov 17, 2011
Messages
12,713
A real PWM circuit would dispense with the LED current-limiting resistors
You will then need an inductor to limit current rise during the on phase. Otherwise the LEDs may draw too high a current during the on time of the pwm and be destroyed (even if this duration may be short).
Typically PWM is not used to limit the max. current, but to control the average current.
 

hevans1944

Hop - AC8NS
Jun 21, 2012
4,759
Joined
Jun 21, 2012
Messages
4,759
You will then need an inductor to limit current rise during the on phase. Otherwise the LEDs may draw too high a current during the on time of the pwm and be destroyed (even if this duration may be short).
Typically PWM is not used to limit the max. current, but to control the average current.
Oops! You are absolutely correct. Bad idea. The inductor would also slow down the LED response to PWM brightness control. Maybe a constant-current source for the PWM modulation, with the off-state current diverted to "ground," would improve efficiency? I just "know" those big stadium LED displays somehow avoid dissipating a lot of power in current-limiting resistors. Well, maybe "know" is too strong a word. "Suspect" is better. I would certainly put forth a lot of effort to make a few thousand LEDs operate efficiently if it were my job to build such a large display.

Thanks for the correction, Harald. I need to learn to think before I type... or at least think before hitting the "ENTER" key.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,713
Joined
Nov 17, 2011
Messages
12,713
Don't worry. Hop. Everybody's allowed to err from time to time.

The inductor + pwm + a freewheeling diode make for a simple switch mode current controller.
 
Top