Author Topic: NPN Constant current source with different transistors  (Read 12198 times)

0 Members and 1 Guest are viewing this topic.

Offline menimitzTopic starter

  • Contributor
  • Posts: 13
  • Country: us
  • Let's Get Started!
NPN Constant current source with different transistors
« on: May 05, 2014, 11:08:24 pm »
I was recently trying to brush up on my transistor circuits and LTSpice.  Motivated by another project I decided to build a simple constant current source.  From examples online I built the attached circuit on a breadboard and in LTSpice.

In my first version of the circuit I used a 2n2222A for Q1.  My measured current through RLOAD was not what I expected it to be based on calculations and LTSpice model.    Also, as I varied RLOAD over the range I chose, the current would vary by as much as an entire mA or so over the whole range. 

I eventually decided to try the circuit with a 3904 for Q1 instead.  When I did this, the circuit worked exactly as intended and matched the simulation fairly well. 

What characteristic of these two transistors causes this difference?  I was always under the impression the 2n2222 was very functionally similar to the 3904.  Did I just stumble upon one of the areas where they are not compatible?

Also, what affect does R1 play on the circuit?  I know with the more basic version of biasing the transistor using a voltage divider it makes a huge difference, but with the zener, does this R1 simply limit current to the base to protect it, or does it need to be a certain range? 
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16618
  • Country: us
  • DavidH
Re: NPN Constant current source with different transistors
« Reply #1 on: May 06, 2014, 12:40:54 am »
The 2N3904 and 2N2222 are generic transistors and either should work fine in this application.  The 2N2222 was probably either bad or oscillating.  You might need to add a small resistance in series with the base and I would double check that your local power supply decoupling is sufficient.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: NPN Constant current source with different transistors
« Reply #2 on: May 06, 2014, 12:59:42 am »
Try a different 2N2222, as well as a different 2N3904. Maybe try a few other transistors too. I think you'll find that this circuit really isn't an excellent performer with most transistors. It's better than Ohmic, at least... If you need a nice, stiff current source (but you don't want to use an op amp), you should try one of the better current mirror circuits.

R1 provides bias current for the Zener diode... Keep it within the range where the diode gives the best regulation (check its datasheet).
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline menimitzTopic starter

  • Contributor
  • Posts: 13
  • Country: us
  • Let's Get Started!
Re: NPN Constant current source with different transistors
« Reply #3 on: May 06, 2014, 01:35:46 am »
I actually did try 2 or 3 of the 2N2222 before switching to the 2N3904. 

...You might need to add a small resistance in series with the base and I would double check that your local power supply decoupling is sufficient.


When you say this, do you mean decoupling on the breadboard (+V to gnd)?  I actually did not have any.  I never think to use any in little test circuits such as this, especially if there are no ICs.  I probably know better but don't always do it.  I will also check what adding a small Rbase does to the circuit.  What range of values should I begin with?  I assume it should be small it terms of Re, as the closer to Re it becomes, the more it will affect my set current right?

... If you need a nice, stiff current source (but you don't want to use an op amp), you should try one of the better current mirror circuits.

R1 provides bias current for the Zener diode... Keep it within the range where the diode gives the best regulation (check its datasheet).

I had looked at trying a current mirror also, but wanted to get this problem sorted out first.  I will probably try that later this week.  Do you have any suggestions on where to start with current mirrors?  I have seen many different configurations online.
 
Thanks for the info on biasing the Zener also.  I would check the datasheet but I have no idea where the Zener I have actually came from.  They were in a kit I bought a few years ago and are poorly labeled.  It does keep a very smooth reference though, so it seems like a quality part. 

 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: NPN Constant current source with different transistors
« Reply #4 on: May 06, 2014, 01:45:58 am »
I'd start with a simple Wilson current mirror. The three-transistor version has a much higher output impedance than the basic two-transistor mirror, and the four-transistor version is better still.

If your VCC is stable, you can just use a resistor into the current mirror as a reference. Otherwise, use a proper current source to feed the mirror - the mirror will help isolate the source from the effects of the load. Choose two transistors with similar base-emitter thresholds (just measure B-E with a multimeter on the diode test mode), and for best results, add emitter resistors chosen to give about 0.5V drop at the chosen current (this smooths out the exponential voltage/current relationship). If you're clever you might be able to find a way to combine the source and mirror.

Yes, toss some decoupling capacitance onto the breadboard at least. I keep a giant capacitor (4700uF 63V) on the top of each of my boards, never to be removed, to isolate the breadboard from the leads going to the power supply. :-+ Wouldn't hurt to put some closer to the transistors as well, though this circuit isn't horribly prone to oscillation.

I don't think a base resistor will do much for you unless you have long leads going all over the place. In that case try 100-ish ohms.
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline menimitzTopic starter

  • Contributor
  • Posts: 13
  • Country: us
  • Let's Get Started!
Re: NPN Constant current source with different transistors
« Reply #5 on: May 06, 2014, 02:21:46 am »
Thanks for the current mirror insight.  Now I assume the need to match the transistors is one reason you generally see an IC serving this function instead, correct?  The project I had in mind when working on all of this was building an adjustable current source for my bench.  My power supply has a current limiting mode, but it is no more than a safety feature.  I have not chosen how I want to build the supply, but wanted some fundamentals of current supply circuits before I dove in. 

I don't believe I have any caps that large, at least not enough for all the breadboards I have lying around.  I usually just use a 220uF as I have (or had) many and they were a good physical size.  I will definitely be sure to pick some up next time I decide to place an order.
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: NPN Constant current source with different transistors
« Reply #6 on: May 06, 2014, 02:31:20 am »
Now I assume the need to match the transistors is one reason you generally see an IC serving this function instead, correct?

Yup. Not only are they matched in properties, but they're matched in temperature. But for hobby purposes, you can do pretty well by hand-matching them, especially if you use semi-matched emitter resistors and glue them together to share temperature.

Quote
The project I had in mind when working on all of this was building an adjustable current source for my bench. My power supply has a current limiting mode, but it is no more than a safety feature.  I have not chosen how I want to build the supply, but wanted some fundamentals of current supply circuits before I dove in. 

I'd use an op amp for that. Try something like one of the many DC loads floating around, but with an integrated power supply. Though I certainly won't object to experimenting with the fundamentals first :-+
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16618
  • Country: us
  • DavidH
Re: NPN Constant current source with different transistors
« Reply #7 on: May 06, 2014, 02:43:39 am »
I actually did try 2 or 3 of the 2N2222 before switching to the 2N3904. 

...You might need to add a small resistance in series with the base and I would double check that your local power supply decoupling is sufficient.

When you say this, do you mean decoupling on the breadboard (+V to gnd)?  I actually did not have any.  I never think to use any in little test circuits such as this, especially if there are no ICs.  I probably know better but don't always do it.  I will also check what adding a small Rbase does to the circuit.  What range of values should I begin with?  I assume it should be small it terms of Re, as the closer to Re it becomes, the more it will affect my set current right?

Despite their docile nature, the 2N3904 and 2N2222 can operate into the 100s of MHz so high frequency decoupling precautions still apply.  A solderless breadboard with no decoupling is almost a worst case situation.

The base current is small so the value of the base resistor is not very constrained.  47 ohms is typical but it could be larger at low currents.  A ferrite bead would also be suitable.

Quote
I had looked at trying a current mirror also, but wanted to get this problem sorted out first.  I will probably try that later this week.  Do you have any suggestions on where to start with current mirrors?  I have seen many different configurations online.
 
Thanks for the info on biasing the Zener also.  I would check the datasheet but I have no idea where the Zener I have actually came from.  They were in a kit I bought a few years ago and are poorly labeled.  It does keep a very smooth reference though, so it seems like a quality part.

"Current Sources & Voltage References" by Lindon T. Harrison is an excellent book on the subject.  It will tell you everything you need to know.  Your circuit is shown on page 69 and a temperature compensated version is shown on page 119 using an LED instead of the zener diode.  There is nothing wrong with your circuit if precision and very high output impedance are not required.

The low impedance of the zener diode driving the base of the bipolar transistor directly is probably contributing to the oscillation which is why a series resistor helps.  With proper decoupling, I doubt it would be an issue.
 

Offline menimitzTopic starter

  • Contributor
  • Posts: 13
  • Country: us
  • Let's Get Started!
Re: NPN Constant current source with different transistors
« Reply #8 on: May 06, 2014, 03:39:01 am »
I checked out the textbook.  It is more than I want to spend right now, but has been added to my wishlist of electronic texts. 

I also do have a few ferrite beads I have harvested from old equipment during de-soldering practice a few years ago.  I'll try to get the 2n2222 circuit working just to see what it takes.  Definitely will start with the decoupling caps.
 

Offline GK

  • Super Contributor
  • ***
  • Posts: 2607
  • Country: au
Re: NPN Constant current source with different transistors
« Reply #9 on: May 06, 2014, 04:11:13 am »
The circuit posted by the OP will have a collector resistance approaching 2M with a run-of-the-mill transistor having an early voltage (VA) of 100V.


ro =VA/IC.

The above formula approximates the collector resistance for a transistor with a grounded emitter (no degeneration).

With degeneration the output resistance is approximated by multiplying ro by the ratio of the voltage dropped across the emitter degeneration resistor to the thermal voltage (Vt - approximately 26mV at room temperature).

For example in the OP's circuit Ic =~ (4.7-Vbe)/470 =  8.5mA.
If VA=100, ro = 100/8.5mA = 11764 ohms.

As VRe =~4V, the collector resistance = ro(4/0.026) = 1.81M.

Very high collector resistance can be had with the simple current source just by dropping a large voltage across the external Re. For example if a 12V zener was used in the OP's circuit and Re adjusted for the same Ic, the collector resistance would rise to approx 5M, though that may not be reached in reality as other things put a limit to the ultimate collector resistance attained (eg beta dependance on Vce). The above simplifed formula generally give a good approximation of collector resistance up to a meg ohm or two. 

This can be modelled in spice but make sure the BJT model used does not have an erroneous figure entered for VA.

« Last Edit: May 06, 2014, 05:03:56 am by GK »
Bzzzzt. No longer care, over this forum shit.........ZZzzzzzzzzzzzzzzz
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: NPN Constant current source with different transistors
« Reply #10 on: May 06, 2014, 04:13:00 am »
Hi,

I have done a little modeling for you in LTspice. I have included a couple of advanced features:

1) Voltage controlled resistor

I have made R3, the collector resistor, a voltage controlled resistor by replacing the value with:

R=limit(1,10000,V(Res_ctrl))

This means the resistor has the value equal to the voltage on the node Res_ctrl. The resistor has a minimum value of 1 Ohm and a maximum value of 10K Ohms. V2 controls the value of the resistor.

This lets me sweep the resistor from 100 Ohms to 800 Ohms, the same as the range in the original post.


2) Multiple runs with different transistors

You cannot step the type of transistor directly.

The ako, meaning 'also kind of' allows a numeric value to be assigned to a model, using a .model statement.


The models can also be modified using the ako directive.

.model 2223 ako:2N2222 bf=100

This means generate a new model with a name 2223, with all the parameters of the 2N2222, except the ones that have been changed. In the case I specified that the forward gain bf (also HFE) is 100.

So here is the LTspice model



And here are the key results:



The selection of different transistors has very little effect on the current in R3. The majority of the change comes from difference in gain. This circuit holds the emitter current constant. Ic = Ie - Ib

There is a point where if I continue to increase the collector resistor, where the transistors collector - emitter voltage - 0 and the circuit can no longer regulate current. This happens when R3 is around 1 k Ohms.



I have attached the LTspice model in the zip file.

Regards,

Jay_Diddy_B


« Last Edit: May 06, 2014, 04:16:02 am by Jay_Diddy_B »
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: NPN Constant current source with different transistors
« Reply #11 on: May 06, 2014, 04:33:49 am »
The circuit posted by the OP will have a collector resistance approaching 2M with a run-of-the-mill transistor having an early voltage (VA) of 100V.


ro =VA/IC.

The above formula approximates the collector resistance for a transistor with a grounded emitter (no degeneration).

With degeneration the output resistance is approximated by multiplying ro by the ratio of the voltage dropped across the emitter degeneration resistor to the thermal voltage (Vt - approximately 26mV at room temperature).

For example in the OP's circuit Ic =~ (4.7-Vbe)/470 =  8.5mA.
If VA=100, ro = 100/8.5mA = 11764 ohms.

As VRe =~4V, the collector resistance = ro(4/0.026) = 1.81M.

Very high collector resistance can be had with the simple current source just by dropping a large voltage across the external Re. For example if a 12V zener was used in the OP's circuit and Re adjusted for the same Ic, the collector resistance would rise to approx 5M.

This can be modelled in spice but make sure the BJT model used does not have an erroneous figure entered for VA.



To illustrate the effect of the VA parameter, introduced by GK, I have made a version of the LTspice model to show the effects of different Early voltages. In LTspice the parameter is VAF.

In these models have kept the transistor as a 2N2222 but I have varied VAF either side of the default value. The higher the Early voltage, VAF, the more constant the current.

Modified model:



Modelling Results:



Regards,

Jay_Diddy_B

 

Offline GK

  • Super Contributor
  • ***
  • Posts: 2607
  • Country: au
Re: NPN Constant current source with different transistors
« Reply #12 on: May 06, 2014, 05:07:10 am »
Alternatively, how to plot the collector impedance directly in ohms (just read the vertical scale in ohms rather than volts).

Bzzzzt. No longer care, over this forum shit.........ZZzzzzzzzzzzzzzzz
 

Offline menimitzTopic starter

  • Contributor
  • Posts: 13
  • Country: us
  • Let's Get Started!
Re: NPN Constant current source with different transistors
« Reply #13 on: May 08, 2014, 04:20:24 am »
Thanks for the LTSpice examples.  I have used it in the past but never have gotten very deep into its functionality. 

When I did my own testing I used the .step parameter to test different RLOAD values.  I used something like:

.step param RLOAD 50 3k 50
.op

I was going well beyond my real world test of 800 ohms just to see how much it actually dipped off on the graph, them zoomed in to the region I wanted to see.  Is there a reason to use the .step method versus using the voltage to resistance method other than preference?

I also very much liked the model parameter stepping.  That seems to be a very useful feature. 

I still have not been able to test my original circuit with the power supply capacitors.  I will attempt to try that in a few hours. 
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: NPN Constant current source with different transistors
« Reply #14 on: May 09, 2014, 04:18:58 am »
Thanks for the LTSpice examples.  I have used it in the past but never have gotten very deep into its functionality. 

When I did my own testing I used the .step parameter to test different RLOAD values.  I used something like:

.step param RLOAD 50 3k 50
.op

Snip....


Stepping the resistor versus sweeping the Voltage controlled resistor


If I implement the voltage controlled resistor I can get the simulation in a single simulation for each of the transistors.

I can also switch from the transient analysis to dc sweep and make the source that is controlling the resistor the variable like this:



And I get the result:



If I step the collector resistor with a statement:

.step param R 50 3k 50

The simulation has to run 60 times for each transistor



I then see an output which looks like this:



If I introduce a measurement statement:

.meas tran collector_current avgI(R3)

I can LTspice to plot the collector current versus collector resistance:




I hope you get the idea. It is just faster to do the way I did it.

Regards,

Jay_Diddy_B




« Last Edit: May 09, 2014, 04:22:30 am by Jay_Diddy_B »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf