Calculating base resistor pn2222

I'm saturated from studying datasheets, and reading articles from so many different people, this has me seriously confused. What I would like to do, is use a transistor (pn2222) to limit the amount of current sent to a circuit, say limit to 45 ma at 5 volts.

The closest example article I can get to explain to me, shows a LED with a current-limiting resistor on the led circuit leading from the power to the collector lead of the transistor. Which to me, defeats the purpose of using a transistor to limit the current that flows through that circuit - using the transistor as a solid-state relay switch.

Why and what is this for?

Try this link
current limiting transistors

According to the datasheet the PN2222 has a current gain (hfe) of between 50 and 375 depending on the conditions and the particular part. That's a wide range (typical for a transistor) so you either need a pot, or you can experiment and select a resistor, or design a more advanced circuit that depends on resistor values rather than the transistor itself.*

The base-emitter junction acts like a diode, so I'll estimate a voltage drop of 0.6V and that means with 5V applied you've got 4.4V across the base resistor. But, since the transistor's gain has such a wide range we don't need to be that exact and we can just assume 5V across the resistor.

So, if the transistor has a gain of 100, we need 0.45mA through the resistor (and base) so that's about 11K. But, since there is so much tolerance in the transistor's gain, that's just a starting point.

  • That's how op-amps work. They have very-very high gain and with negative feedback the gain can be controlled with the resistors, and you don't have to worry about the exact open-loop gain of the "raw" op-amp. And in fact, most real-world circuits (not just op-amp circuits) rely on the same principals so in production you don't have to tweak pots or select resistors.

I think I noticed a sweet-spot in the circuit. Like it didn't seem to start limiting current until I put 100k ohm resistor in. Then I tried a 500k pot. I was playing around with that until the pot started smoking (lol not me).

But it seemed like the sweet spot was above 100k started limiting to the range I needed, but I had to keep giving it more 100k resistors for every 10 more ma of current to limit. And I must have hit some type of limit because the transistor burnt out. I guess if that energy isn't consumed by a device or resistor it's probably turned into heat and poof - goes the circuit.

The reason I am trying to do this, is for many reasons, mainly education so I can design better circuits. I started off to control the power-on to the hc-05, so I could reset the board into command or spp mode. I got confused because I just wanted to send +5v on or off to the power line, and not power the hc-05, and toggle a ground wire by a transistor. But I got the circuit to work, I am not sure I'm doing the right thing, but it's not smoking or getting hot so far.

I was also interested in knowing this to better my skills in building a circuit to drive high intensity LEDs, control the power to give the most light without sending too much energy. I know the other part of that is a pwm driver, of course - but I want to be certain I knew exactly how much current is being sent and spent.

You could always make a proper current sink - see the enclosed

regards

Allan

Isink.pdf (17.2 KB)

Allanhurst: Thanks for the example circuit. Is interesting. There is a line that just goes from the op-amp to the base of the pn2222, with what looks like a current limit resistor on the ground line of the circuit. I can toggle the pn2222 just fine with a 2.2k resistor in the base lead from a digital pin, so the op-amp would just be a more expensive component that uses more wires.

As I understood, a current limit resistor on the line will convert the energy to heat. I was looking to control the amount of energy that was allowed thru the transistor so the power isn't wasted.

The point is that this a precision current sink - the gain of the transistor is irrelevant within reasonable limits. All sensible designs don't rely on this value - it's both unknown and highly temperature dependant.

Dissipation - yes - with 100 ohms and a 50mA current the resistor will dissipate I^2 * R or 0.025 watts - is this a problem?

And the transistor will dissipate = IA ie (Vc - IR ) * 50mA - depends on your supply volts and load.

regards

Allan

The heat dissipation on this circuit is not a problem, of course. I was using a small scale for my learning purposes. Ideally I want to power these 100 watt LEDs, in an array and conserve as much of the rechargeable battery supply, without converting to heat.

I thought the gain of the transistor was really difficult for me to study. If you say it's trivial, I can accept that.

DocStein99:
Ideally I want to power these 100 watt LEDs, in an array and conserve as much of the rechargeable battery supply, without converting to heat.

Then stop thinking analogue regulation.
Power LEDs need to be controlled with switching constant current supplies.
Link to the LED you want to power, and the battery you will be using.
Leo..