2n3904 DC current gain confusion

Thread Starter

odm4286

Joined Sep 20, 2009
265
Hello all. I am trying to setup a constant current source using a 2n3904 and a Motorolla LM358N. I want to ensure 4mA collector current regardless of my load. Here is a screen shot of the circuit, an explanation of my rationale, and the problem I am having.


My Rationale
Using the datasheet, to the best of my ability, it looks like my DC current gain would be 70. By that logic my base current, 3.68V/23k = 160µA, multiplied by 70 should give me a collector current of 11.7mA (NOTE: The LM356N does not go rail-to-rail so the output is 3.68V). When the voltage across my sense resistor exceeds 4V, 4mA total current, the LM356N will output low unbiasing the 2n3904. I know I may have to implement some hysteresis into this circuit.

My Problems

1. I am pretty sure I'm interrupting the datasheet incorrectly. Could someone explain this section to me?
How I see it if I'm fully on, what would my collector current be? Well in this case it would be 5v/1k which is 5mA.
With that information I assumed I would reference the 3rd entry for the behavior I could expect. Also, Vce is listed as 1V here.
How does this factor in?


2. As it stands right now, I get 2.8mA of total current through my sense resistor. What exactly am I screwing up here?

3. Lastly, I've heard it is poor practice to use an op-amp as a comparator without some sort of hysteresis. How can I implement this here?

Thank you all so much for any input. Hopefully, I was clear in my explanation.
 

dl324

Joined Mar 30, 2015
16,839
An easier to read schematic:
upload_2017-12-27_20-37-26.png

You have several problems.

The input common-mode voltage range with VCC=5V is 0-3.5V; you're trying to use 3.94V.

The output voltage is only guaranteed to be 3.3V.

To avoid these issues, you can change your voltage divider to use a voltage below the guaranteed max input voltage. That will also help with the max output voltage.

You can omit the base resistor.

Your beta assumptions are wrong. Beta is also dependent on Vce. You only need 4mA, so beta isn't a critical parameter.

Use a 240 ohm resistor for Rsense and set the voltage divider to give you 0.96V and you'll get a 4mA current sink.
 
Last edited:

KCHARROIS

Joined Jun 29, 2012
311
Hello,

Think about will say opamp “laws”. If you have 3.94V at the positive input of the op amp and introduce negative feedback then the negative input will also have 3.94V meaning rsense* will have 3.94V. Now if rsense* is 1K, current will equal 3.94mA all pending that the transistor base current fits within the transistor beta/hfe gain which I believe is average 173?
The second key to this circuit is that the transistor emitter current equals to the collector current. If your supply is 5V then the load resistor can’t be larger then 269 ohms.

Hope this helped,
Kevin
 
3. Lastly, I've heard it is poor practice to use an op-amp as a comparator without some sort of hysteresis. How can I implement this here?
Pssst

It's not a comparitor circuit.

When the voltage across my sense resistor exceeds 4V, 4mA total current, the LM356N will output low unbiasing the 2n3904. I know I may have to implement some hysteresis into this circuit.
Pin 2 will servo to the value of pin #3 if it can.
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
The input common-mode voltage range with VCC=5V is 0-3.5V; you're trying to use 3.94V.

The output voltage is only guaranteed to be 3.3V.
Thank you so much for helping me out. I see this in the datasheet now "2. The input common mode voltage or either input signal voltage should not be allowed to go negative by more than 0.3 V. The upper end of the common mode voltage range is VCC –1.7 V.".

Could you help me understand what "common mode voltage range" means? I understand that my output max will always be VCC - 1.7V because this chip does not go rail-to-rail, but I don't understand what they mean by common mode voltage range. Is this similar to a common mode rejection?
 

dl324

Joined Mar 30, 2015
16,839
Could you help me understand what "common mode voltage range" means?
It's the range of allowed voltages on the inputs. Going outside of that range can cause output "inversion".

Common mode rejection ratio is a measure of how well the opamp rejects the same signal at both inputs.
 

AnalogKid

Joined Aug 1, 2013
10,986
You didn't show the entire datasheet page, but I think the DC gain of 70 is a minimum value for that collector current. It should not be used a design parameter for several reasons. Most importantly, the opamp gain at DC is around 500,000, so that additional 70 doesn't really figure into the gain equations.

The opamp and its negative feedback will automatically adjust Q1 base current such that the voltage across sense resistor R5 is identical to the voltage across R4.

Delete R1 for now. Its purpose is to protect Q1 from too much base current, which is not a problem in this circuit. Depending on the value of the sense resistor there is a chance that the opamp output might not be able to swing low enough to drive Q1 correctly. In this case, something in the 1K to 10K range might help, but I wouldn't put it in until needed.

ak
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
The opamp and its negative feedback will automatically adjust Q1 base current such that the voltage across sense resistor R5 is identical to the voltage across R4.

ak
Thanks for the input AnalogKid, can you help me understand something? First, here is an updated schematic.


This is the last version I breadboarded, works pretty well so far. I calculated and tested(forgot to test 16mA) different values for Rsense to give me 4mA, 8mA, 12mA, 16mA, and 20mA through Rload. At some point I will have to increase Vcc to get a little bit more "overhead" and recalculate resistor values but overall it seems the circuit is built on a sound idea.

So, I'm trying to get a better sense of how the opamp drives the base of the transistor. Is it in an incredibly fast "on off" fashion or something more analog? I think I understand how the feedback is used to control the opamp, so I'm guessing the output is more "digital" than analog?

Thank you again for the replies everyone.
 

dl324

Joined Mar 30, 2015
16,839
At some point I will have to increase Vcc to get a little bit more "overhead" and recalculate resistor values but overall it seems the circuit is built on a sound idea.
You want to make Rsense as small as possible to maximize the voltage available for your load.
So, I'm trying to get a better sense of how the opamp drives the base of the transistor. Is it in an incredibly fast "on off" fashion or something more analog? I think I understand how the feedback is used to control the opamp, so I'm guessing the output is more "digital" than analog?
It's analog. The opamp monitors the voltage at both inputs continuously and attempts to keep them the same.
 
Thank you so much for helping me out. I see this in the datasheet now "2. The input common mode voltage or either input signal voltage should not be allowed to go negative by more than 0.3 V. The upper end of the common mode voltage range is VCC –1.7 V.".

Could you help me understand what "common mode voltage range" means? I understand that my output max will always be VCC - 1.7V because this chip does not go rail-to-rail, but I don't understand what they mean by common mode voltage range. Is this similar to a common mode rejection?
No. Common mode means signals common to both inputs. So, in order for the O{-amp to "work right", the signals for the LM358 inputs must be between 0 and Vcc-1.7V. Phase inversion is a common problem.

So, I'm trying to get a better sense of how the opamp drives the base of the transistor. Is it in an incredibly fast "on off" fashion or something more analog? I think I understand how the feedback is used to control the opamp, so I'm guessing the output is more "digital" than analog?
Not really. One way to look at an OP amps is that the output is (A-B)*n; where n is a very big number called the open loop gain. About 100 db for this OP-Amp. A is the non-inverting input and B is the inverting input.

100 db=100,000; so the small error of a-b * 100,000 is the output voltage. Stupid little concept.

So, in a negative feed back situation, the non-inverting - inverting is approximately equal to zero (Within the Vos specs).

In your circuit, a FET is better used for the transistor.
 
Last edited:

dl324

Joined Mar 30, 2015
16,839
In your circuit, a FET is better used for the transistor.
I see no advantage in using a MOSFET instead of a BJT. With a 5V supply, the output of the opamp is only guaranteed to 3.3V, so there's little headroom for gate voltage modulation. It shrinks even more given the OP's propensity for largish values for Rsense.

Driving a capacitive load could also require the addition of a gate resistor.
 

crutschow

Joined Mar 14, 2008
34,280
I see no advantage in using a MOSFET instead of a BJT.
A MOSFET eliminates the base current error in the load constant current.
With a BJT the load current equals the sense resistor current minus the base current.
That may not be important in many applications but it typically means about a 1% difference in the two currents.
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
A MOSFET eliminates the base current error in the load constant current.
With a BJT the load current equals the sense resistor current minus the base current.
That may not be important in many applications but it typically means about a 1% difference in the two currents.
Not saying you're wrong, just trying to learn. In this application wouldn't the sense resistor make the base current irrelevant? Given the fact that the opamp would drive the transistor until the Vsense matched Vref? Basically, once the sum of the Ic and Ib equal enough to create a voltage equal Vref across Rsense.
 

dl324

Joined Mar 30, 2015
16,839
In this application wouldn't the sense resistor make the base current irrelevant? Given the fact that the opamp would drive the transistor until the Vsense matched Vref? Basically, once the sum of the Ic and Ib equal enough to create a voltage equal Vref across Rsense.
The circuit will set the emitter current. The collector current will be Ie-Ib.

Whether that is significant is up to you.

If you had sufficient voltage headroom, a MOSFET wouldn't have that "limitation". With a 5V supply and an opamp that can output 3.3V (guaranteed), you only have 3.3V-Vsense to control the MOSFET. But, with a 619 ohm Rsense, at 4mA, you'd have 0.8V max for Vgs. Finding a MOSFET with such a low Vth would likely be problematic.

On the other hand, any general purpose BJT will work with that voltage budget.
 

Audioguru

Joined Dec 20, 2007
11,248
Why does your schematic drawing software produce (backwards) negative white lines on a black background instead of a normal positive image??
Also can't you turn off the "chicken pox" dots??
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
The circuit will set the emitter current. The collector current will be Ie-Ib.
What a misconception on my part. I completely overlooked the fact that this regulates current through the emitter but not necessarily through the collector, which is what I'm trying to accomplish. I calculated that with that sense resistor being 619Ω and my Vref set to 2.5V my Ib would be (2.5-.7)/619 ≈ 2.9mA.

Given the fact that I would have 2.5V across Rsense, Ie ≈ 4.04mA. So this means my Ic must be 4.04mA - 2.9mA = 1.14mA

I'm going to try and figure out how to guarantee a given Ic but for now I just want to make sure I'm understanding this correctly. Thanks again for all of the help.
 

dl324

Joined Mar 30, 2015
16,839
What a misconception on my part. I completely overlooked the fact that this regulates current through the emitter but not necessarily through the collector, which is what I'm trying to accomplish.
If beta is sufficiently high, Ic is essentially the same as Ie. To make the difference small, you just need to use a high beta transistor. If that isn't enough, you can use a split darlington to get an even higher beta; but you'll need another diode drop on the base. The split darlington configuration will give you an extra 0.7V for your load that a normal darlington wouldn't.
I calculated that with that sense resistor being 619Ω and my Vref set to 2.5V my Ib would be (2.5-.7)/619 ≈ 2.9mA.
You can't calculate base current that way. To do it experimentally, you could calculate Ie and Ic and subtract them. You can't go by beta data given in the datasheet either because it will give min/max and/or typical and there's no way to know which category your transistor is in unless you take measurements to find out how beta varies with Ic and Vce.
Given the fact that I would have 2.5V across Rsense, Ie ≈ 4.04mA. So this means my Ic must be 4.04mA - 2.9mA = 1.14mA
See above.
I'm going to try and figure out how to guarantee a given Ic but for now I just want to make sure I'm understanding this correctly. Thanks again for all of the help.
The question you need to answer is how closely do you need Ic to match Ie?
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
Why does your schematic drawing software produce (backwards) negative white lines on a black background instead of a normal positive image??
Also can't you turn off the "chicken pox" dots??
It's the default settings on the schematic software I use. It doesn't bother me.
 

Thread Starter

odm4286

Joined Sep 20, 2009
265
You can't calculate base current that way.
I was under the impression that the base-emitter junction is essentially a diode. Couldn't I treat this junction along with Rsense the same as an LED and current limiting resistor? I.e. (Vt-Vf)/R
 
Top