Hey everyone, So I've been lurking here a while trying to learn and solve my own problems by using the search and going through old posts, etc. But I've hit a snag so finally had to make an account and start my own thread....
I guess it should be a pretty simple solve, but I feel like the transistor I chose and the corresponding data sheet are the source of my issues.....
Okay, on with it.....I'm trying to switch (5) LEDs with a transistor, and in doing so I need a resistor between the Arduino pin and the Base.
the LEDs are 3.2fV, 20mA each.
the transistor is a BC547 Data sheet
LEDs drawing 100mA total from a 5v regulator.
Through all the maths and formulas I've found on here and elsewhere on the internets my problem seems to be with the hfe. On this data sheet the only number is a Min. of 110. My understanding is that you want to use the worse case scenario hfe which I keep seeing listed quite clearly for other transistors at much smaller values like 30 or 40.
When I use 110 anyways, I get ridiculous resistor values around 4.1k or 4.7k (rounded to nearest standard).
4.3 x 110 / 0.1 = 4.7k
Needless to say, my LEDs are very dim
I threw in a 470ohm resistor just to try something and that looks waaaay better...but that's just a stab in the dark....
I want to know what I'm doing wrong or how I should determine a more proper hfe given how this data sheet is laid out!
A BC547 can only handle an absolute maximum of 100mA. You shouldn't actually use it for 100mA. That's right on the verge of killing it.
You're not quite drawing 100mA. (5V - 3.2V)/100Ω per LED = 18mA per LED, so your total current will be nearer to 90mA. Still pushing it with a BC547.
And you want to drive the transistor into saturation, so don't just calculate from the full gain value. It's fairly common to 'force-feed' about 1/10 to 1/20 the collector current into the base.
Edit: See figure 4 in the datasheet - their Vce(sat) calculations are done with Ib = Ic/10.
Incidentally, a Darlington pair or small MOSFET might be better suited to your application.
Just 'subscribing' to see what those 'in the know' have to say. I would basically have used the same calculation and probably have used a 3k9 resistor (rounded down instead of up).
With a Hfe of 100 (rounded number and a Ic of 100, you need 1 mA base current. So (5 - 0.7) / 0.001 gives 4k3. Maybe you're not fully saturating with 4k7 and hence the transistor is not fully open?
In an attempt to understand what is happening, I would try the same 4k7 with only 1 LED, next 2 LEDs etc and see what happens.
LED current, with a saturated transistor, will be 5volt -3.2volt (LED) -0.5volt (Vsat) = 1.3 / 100ohm = 13mA.
Collector current = 5*13 = 65mA. Just ok for a BC547.
Base current for saturation (1:10) is 6.5mA.
Voltage across R1 is 5-0.7(Vbe) = 4.3volt.
R1 is 4.3/0.0065 = 662ohm (1323ohm for 1:20).
I would use 1k.
There is little difference in Vsat between 1:10 and 1:20 base current.
Also very little brightness difference between 13mA LED current and 20mA LED current.
If these LEDs are used with an Arduino with enough available ports, why not just use five output pins and five resistors.
Leo..
Wawa:
LED current, with a saturated transistor, will be 5volt -3.2volt (LED) -0.5volt (Vsat) = 1.3 / 100ohm = 13mA.
Oops. Somehow, I did forget to allow for saturation voltage, didn't I? (I use MOSFETs too much, and have gotten into the habit of ignoring the voltage drop because it's so small.)
It won't be anywhere near as high as 0.5V though. It would only be about 140mV at Ic=90mA, according to the datasheet, figure #4.
Even allowing for 150mV, we get (5V - (3.2V + .15v)) / 100 = 16.5mA. Total 82.5mA for 5 LEDs. Still pretty high for a BC547.
Wombler:
I'm trying to switch (5) LEDs with a transistor, and in doing so I need a resistor between the Arduino pin and the Base.
the LEDs are 3.2fV, 20mA each.
the transistor is a BC547 Data sheet
LEDs drawing 100mA total from a 5v regulator.
Through all the maths and formulas I've found on here and elsewhere on the internets my problem seems to be with the hfe. On this data sheet the only number is a Min. of 110.
hfe isn't relevant for switching. It is relevant for linear amplification in the active region, but
switching doesn't use the active region, only saturation and cut-off regions.
Make the base current 5 to 10% of the load, ie 5 to 10mA, so a 470 ohm is plausible. Saturation is
when the collector-base junction is forward biased, in the linear region it is reverse biased, different
physics apply.
Your transistor is rated for an absolute maximum of 100mA, your load is 100mA - no safety margin there.
Thanks for the replies guys! I forgot to mention that I knew this transistor was pretty much at max with this particular load at 100mA, It's just all I had on me right now and I'm trying to use it more as a basis to get my maths right (and my understanding of data sheets and transistors) than to force it into my final circuit! I'm probably going to have more LEDs and therefor a different transistor in the array later....
Also, I have more than one of these arrays being separately controlled as well as some servos and other stuff, so I want to keep this to a 1 pin controlled deal.
So, as I understand it, this resistor is to there to control current into the transistor so it reaches its max saturation, but not jam too much current causing the transistor to fail? And this required current is dependent on the current at the collector? (sorry for the layman's terms...)
If that is the case; I was testing this circuit over and over, switching on and off and using fades (on a PWM pin) for the better part of a day, sometimes leaving the LEDs on for quite a while and nothing went wrong. I'm assuming the transistor was robust enough to not fail that quickly...but would surely go out before too long? ....or am I just wrong all over?
Wombler:
Thanks for the replies guys! I forgot to mention that I knew this transistor was pretty much at max with this particular load at 100mA, It's just all I had on me right now and I'm trying to use it more as a basis to get my maths right (and my understanding of data sheets and transistors) than to force it into my final circuit! I'm probably going to have more LEDs and therefor a different transistor in the array later....
Also, I have more than one of these arrays being separately controlled as well as some servos and other stuff, so I want to keep this to a 1 pin controlled deal.
So, as I understand it, this resistor is to there to control current into the transistor so it reaches its max saturation, but not jam too much current causing the transistor to fail? And this required current is dependent on the current at the collector? (sorry for the layman's terms...)
If that is the case; I was testing this circuit over and over, switching on and off and using fades (on a PWM pin) for the better part of a day, sometimes leaving the LEDs on for quite a while and nothing went wrong. I'm assuming the transistor was robust enough to not fail that quickly...but would surely go out before too long? ....or am I just wrong all over?
Since you were below the 100mA mark, and also because you used a fairly large value base resistor, there wasn't really much chance of the transistor failing too quickly. It's just not a good idea to drive them too close to absolute maximum limits, to ensure that they don't prematurely fail.
As Wawa mentioned, there isn't a hell of a lot of difference between driving the LEDs at 20mA, or at a slightly lower current, so if you were to use 120 ohm resistors, for example, they'd still be fairly bright, but well within the ratings of the transistor.
If the LED Vf is 3.2V, the transistor's Vce(sat) is 0.15V:-
(5V - (3.2V + 0.15V)) / 120 = 13.75mA per LED, a total of 69mA for 5 LEDs.
Wombler:
...I was testing this circuit over and over, switching on and off and using fades (on a PWM pin) for the better part of a day, sometimes leaving the LEDs on for quite a while and nothing went wrong....
oops....kinda left out a key point here....I was testing the circuit all day with NO resistor on the base...and for a little bit 10 LEDS...
Wawa - I was actually looking into MOSFETs now, as I will probably be running closer to 7-10 LEDs in the end.
At this point, I'm still just trying to fully understand the transistors!
Wombler:
If that is the case; I was testing this circuit over and over, switching on and off and using fades (on a PWM pin) for the better part of a day, sometimes leaving the LEDs on for quite a while and nothing went wrong. I'm assuming the transistor was robust enough to not fail that quickly...but would surely go out before too long? ....or am I just wrong all over?
Remember failure doesn't have to be immediate - the manufacturer guarantees highly reliable performance over a long
life (many decades of continuous use) if you avoid the abs max. If you exceed abs max the device is at
risk of permanent change, degrading its performance, limiting its lifetime, or in extremes killing it. Overcurrent
is usually a thermal overload or effects like ion-migration, which are gradual failure modes. Over-voltage
is typically avalanche-breakdown, oxide-puncturing and causes immediate death of the device.
While I was reading up on MOSFETs I noticed a lot of examples having the Gate wired with a pull down resistor (and telling why: no floating gate, etc.). Should I have the resistor wired the same with a transistor to avoid potential floating in this case as well? Or not worth it (or just shouldn't) because of how transistors work vs. how mosfets work?
Normal NPN/PNP transistor are current devices.
Without actual base current, it does nothing.
Bleed resistors are usually not needed. Certainly not when driving a LED.
Leo..
That diagram that you just posted is a really good way to kill an Arduino output pin.
Do you really want to connect the Arduino pin directly to ground?
(When it goes high, it will die.)