Hi Guys,
New to this forum, hope this is a good place to come for help with this sort of stuff. I am from Perth, Australia and have been into electronics for a little while, but in the last couple of months have been spending a fair bit of time on a new project.
I am a pretty involved EE hobbyist and and am designing a unit to interface with automotive electronics over a CANBUS. I am learning massive amounts as I go (I learn pretty fast
) and really enjoying this challenge.
On the particular MCU I have chosen (PIC18F46K80) I have decided I want to have a series of warning LED’s, as well as the ability to drive a standard automotive relay (in the future anyhow)
LED’s I have are grouped in pairs, and draw around 25ma each at 2.2v. I am currently running each one with a 150R resistor.
Max current sourced/sunk by the PIC on some pins is 25mA, 8mA or 2mA, so by putting them into pairs (parallel) I am saving I/O pins but increasing current draw, meaning I cannot supply directly from the MCU anymore.
So I am going to use a basic NPN transistor as a switch, which is a first for me. Transistors are kind of like my final frontier with basic digital circuits, I find them more confusing than most other things... just me I guess.
The unit I have on hand is a BC549 and has the following characteristics:
Ic (max) 100mA (suitable for the LED’s)
Hfe min 420
VCEsat 200mV at IC = 100 mA; IB = 5 mA
VBEsat 900mV at IC = 100 mA; IB = 5 mA
What I am struggling to understand is how to equate the base resistor value. I have read probably 20 different web theories and still do not fully understand, and have come up with a few different values as a result.
Some things I wonder are:
- Is my RL (load resistance) figure the total impedance of my load circuit? Or just just my resistor in the case of the LED circuit? The example on the webpage below uses a relay which has an obvious RL due to the relay coil.
- The relationship between HFE and my need, from what I read the rule of thumb is 5 x Ic of the load you are trying to switch.
hFE(min) > 5 × load current Ic / max. IC current
In my case the Ic load is 50mA so I must have a HFE min of at least 125, well the BC549 is way over that figure, is that a good thing? or does it not even matter?
Both the LED and the IC (connected to base) operate off the same VDD of +5v, and the pin I want to control the transistor from has a Ic max of 2mA, but I do also have a pin with Ic max 8mA also.
Can anyone point me to some clear-cut theory or help me to understand this a little better?
One website I found most helpful was
http://electronicsclub.info/transistorcircuits.htmBut I am obviously missing something here.
Thanks,
Hayden