# temperature compensated BJT current source/sink

Discussion in 'Electronic Basics' started by Jonathan Kirwan, Sep 15, 2007.

1. ### Jonathan KirwanGuest

I'm considering the idea of compensating a BJT current source (or
sink) for temperature variation. I haven't read any detailed web
pages, mostly because google doesn't find much with:

"temperature compensation" "bjt current source"

Only patents, it appears. Not teaching pages. And if I open this up
to:

"temperature compensation" bjt "current source"

I get again lots and lots of patent pages plus a number of other
things which seem unrelated to my interest. I admit not having tried
to go through 30k+ hits, though.

No. I don't want to buy a temperature compensated IC device. I'm
trying to learn as a hobbyist only, about designing such things from
the ground up. It's a personal challenge to help me find and fill in
holes in what I understand now. I am not trying to learn how to buy
them from someone else who already knows how. I want the knowledge,
not the parts.

My target is to have these designed for 20uA, 50uA and maybe 100uA --
sink and source. With supplies that will be from 5V to 15V, 8-9V to
start out with.

So... I sat down to think about it a moment and came up with this:
The result of the above circuit using the standard BJT models, is a
nice parabola which sits right at 41.5uA and varies over a temp range
of 0C to 105C by no more than +/-65nA. In other words, it looks
pretty nice.

My question is about making quantitative calculations based upon
theory that will roughly bound the variation for me and allow me to
set the resistor values given specific BJTs for Q1 and Q2 and a
desired temperature stabilized current sink (or source, using the
reflected topology.)

My initial idea was rather simple. Since Q1's Vbe varies roughly
2mV/C, and the Vbe sets the current source magnitude, I'm going to see
something along the lines of 2mV/620mV or 3000ppm/C change in current,
early on, and as the Vbe gets smaller, that rate of change only
worsens from there. So not being happy with that, I figured if I
rammed that through R3 to jack up the base of Q2, make R3 about the
same value as R2 (because the magnification of that 2mV/C goes by
R3/R2) as seen by the Q2 base, and then it will be the case that as
Q1's Vbe shrinks as temp rises, dropping the current source's value
and thus lowering Q2's base, that Q2's Vbe also shrinks by a similar
amount thus causing its emitter to rise -- exactly compensating for
the fall of Q2's base by the same amount (assuming R3=R2.)

Now, it's also true that Q2 is an NPN and Q1 is a PNP and their Vbe
variation over temp don't exactly match. That's fixable by adjusting
R3 so that R3/R2 reflects the ratio of the mismatched Vbe variations.
So that seemed easy enough to imagine.

Then I just set R4 to get the desired collector current and .. wow ..
I should have it.

Thus, my first cut at the above circuit was to go look at the models
and make up an R3 that reflected the difference and that worked out to
about what shows, above. Although actually I computed an R3 a little
larger than you see there.

R4 is what allows me to adjust the current sink value, so although
that does monkey with the curve I'm not planning on changing R4 to
move the temperature parabola around. That gets set for the current I
want. This leaves R1 and R3 for adjustment of the temperature curve.

In playing around, I find that very, very slight changes in R3 will
move the parabola bottom around very strongly towards lower or higher
temperatures. Far less sensitivity is found with changes in R1. But
since even a 50 ohm change in R3 (assuming that ~13k value) can move
the parabola bottom over 50C, if the value is off by a few hundred
ohms, no amount of adjustment of R1 will fix it. And I'm not yet
taking into account the temperature variations of carbon or metal
conductors that might be used in the resistors, either. So ....

Before I go set down with the temperature equations for Isat and the
two BJTs and hit the books for the various temperature variations of
resistor materials, etc, has anyone already done something like this
and worked out the details to make a good design together with a
calibration procedure for it? Should I consider applying more BJTs
before settling down to work on the equations? If so, what topology
would you suggest?

Jon

2. ### John LarkinGuest

That's all interesting and instructive, but for a really good current
source, it's a lot easier to add an opamp and close a feedback loop on
emitter current.

I could post a sketch if that sounds interecting.

John

3. ### Bob MastaGuest

You might want to look up "delta Vbe" or "bandgap".
The basic idea uses two junctions with currents that
are a known ratio.

Best regards,

Bob Masta

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Signal Generator
Science with your sound card!

4. ### Jonathan KirwanGuest

Actually, I would like to see it. But I don't think seeing it will
help me understand this approach better. I already knew that a
negative feedback loop wrapped around a circuit, with appropriate
gain, would make this easier. I'm looking to do this like it might be
done __inside__ an opamp when creating current source/sinks, though.

How was temperature stability added to early transistor designs, where
there were no ICs and the transistors weren't anything to write home
about in terms of consistency between each other? I don't think this
stopped anyone from designing and calibrating them, when they really
needed such an element. So I'm curious about the approach used and
I'd like to understand various good and better strategies one might
use in those cases.

This needs to start in steps. In other words, I need to first know
what the larger effects are and to correct for those. BJT current
sources and sinks come in several varieties I'm already aware of,
three of them at least being:

(1) the emitter follower with a resistor in the emitter, dragging the
base up and down to set the current,
(2) the 'I don't know what it is called' thing that I show in the
above circuit with Q1, where the base and emitter develop a current
across a resistor based upon Vbe, and
(3) the current mirror form with incarnations including no emitter
resistors at all to having similar or differing emitter resistors and
a few or many BJTs each able to source or sink some current relative
to a set one.

There may be others, too. Perhaps some that are more or less immune
to temperature effects. I suspect, for example, that the current
mirror in (3) shows somewhat better temperature stability than the
version in (2), because the Vbe's are paralleled and then you are more
worried about the side that sets the current and how that gets set for
temperature drift. But again, I've not thought a lot about it, yet.

Anyway, large effects first. Understand those, fix them by good
inherent starting design and not by adding a negative feedback loop.
Then dig a little deeper and see what the next order of temperature
effect is that remains. Ask if there is yet another means of
improving the starting design to improve its inherent behavior, before
taking on the idea of adding a feedback loop. If you are at the point
of diminishing returns on the inherent features of the design, _then_
see about adding feedback to get that last bit you can.

This is about understanding. And I don't want to jump ahead with an
opamp as part of a feedback loop until I've learned what I can about
getting the design as inherently close as I can, first.

Does that make sense?

Thanks,
Jon

5. ### Jonathan KirwanGuest

Done, already. In fact, I think AofE lays out an general schematic
approach that starts with a current mirror (which I think is probably
better than the two subsections shown in the schematic I provided [a
Vbe-set current and an emitter resistor set current]), and where the
current set by one leg is then handled by some additional BJTs well
strategized for additional temperature compensation. However, I'm
struggling first to understand this pair of transistors and what can
be achieved with them by careful design before proceeding to trying to
do my own work understanding more about that one.

They develop a very nice parabola, temperature wise, and appear (from
simulation only, so far) to do a remarkably good job for just two
BJTs. However, of course, building a real arrangement from this
topology would require a calibration procedure that sets the resistor
values, to nail down well. I'm curious about understanding the
details that develop the parabolic shape with respect to temperature,
though.

In short, I want to take this in steps.

Jon

6. ### Jonathan KirwanGuest

In case I wasn't clear, yes I am interested in other topologies as I
said in my original post. So please, if you want to. I'd like that.

To be clear, though, when I wrote that I was thinking about "other BJT
topologies." Of course, one would set out with chains of differential
pairs and call it an "other BJT toplogy" but then... we'd be up to
quite a few transistors by then. And I'd like to start small and work
my way up to dozens of BJTs later on. I want to understand, at each
step of additional complexity, what I am buying and why I am buying
it.

Jon

7. ### John LarkinGuest

Here's a typical circuit:

There's a small error from base current, generally not enough to worry
about. A BCX71 has a beta in the hundreds, and it doesn't change much
with temperature, so stability depends mostly on the quality of the
bandgap and the source resistor. Of course, using a fet would
eliminate base current error but would typically add more output
capacitance.

There's no attempt to stabilize anything before adding the feedback;
it wouldn't matter here.

Older IC datasheets often included the entire transistor-level
schematic.

John

8. ### Jonathan KirwanGuest

Okay. That one is dead easy to understand. Maybe. I gather the cap,
1k and 47 ohm are to snip oscillation. Other than that, right or
wrong, I think I follow the rest. But it relies upon a bandgap ...
itself, I assume a temperature-stable one. And it's being able to
develop those details I'm looking for.
Yes. And that will be itself temperature varying, yes? (I'm thinking
about 20uA, 50uA, and 100uA in particular, by the way. Not 10mA. But
we can set that aside for now, I suppose.)
Ah, okay. So that answers the above question that it isn't "much"
varying with temperature. I should look at the model.

Also, I imagine that there is offset drift vs temperature in the
opamp, as well. Another factor?
I'm just focused on mastering BJTs, for now.
How many transistors are present in the opamp and the bandgap ref? How
much intelligent design time went into those? How much went into
whatever offset drift over temp the LM7301 exhibits?

What I'm looking for is the knowledge involved to _doing_ that. In
other words, not in using advanced designs to make a simple current
source/sink. But in what crafted thinking is involved in making those
parts, themselves. As I said earlier, it's the knowledge not the part
that I'm looking for.
Yes, but they don't teach well if you don't already know exactly what
each section is there to achieve, beforehand. I'm hoping someone who
already has been there, done that, can express some of what they know

Of course, I need to set down and actually do the experiments myself.
But I like to first have a theoretical basis upon which I make
predictions, which I can then test to see how well that worked in
something built up. Poking around empirically to "get something on
accident" might work at times, but it's not a good way in general. I'm
trying to "see" better, right now.

I sincerely appreciate the thoughts so far. Don't get me wrong. It's
just that the circuit you provided doesn't enlighten me that much
about temperature stability. However, let's talk about what I am a
little less sure of:

I think I have a feel for the 1nF -- I use exactly that kind of
approach to stabilize a power supply feedback loop, in fact. In my
own mind it helps stabilize a lot against ripple in the 12V supply
rail, for one thing. And that plus the 1k filters things to around
the microsecond area in the feedback. The 47 ohm, I think, is to deal
with oscillations that sometimes take place with BJTs when there is
too low of an impedance driving their base hard. But I'm open to
correction on all of that.

Jon

9. ### John LarkinGuest

Yes, but microvolts (ie, ppm's of the current) per degree C, totally
swamped by the bandgap and resistor temperature drifts.

Well, nowadays electronic design consists of connecting complex boxes,
with hundreds or millions of transistors inside, that somebody else
designed.

Agreed, it's best if you can understand what's happening all the way
down the abstraction stack, clear to the device physics.

All correct. The 1 nF was a guess, but with 1 nF and 1K, the opamp's
feedback becomes "local" at around 150 KHz, plenty good enough to keep
a 4 MHz opamp happy.

John

10. ### Jonathan KirwanGuest

And therein lies a serious problem for me. I want to understand the
details so that I can _be_ the somebody else, if I want to.
Bingo. I can actually solve eigen vectors and get eigen values and
find observables in simple quantum mechanical problems. (So I can do
some small things at the very tiny level, if I've a mind to struggle
there.) And I don't really want to go that that level, .... yet.
Right now, I'm on a __slightly__ more practical bend. I'd like to
start with a simple EM1, hybrid-pi approach to this essentially DC
problem and "get there" on my own. Well... somewhere, anyway.
Thanks for the confirmation. Then it all makes sense to me and I can
say that I probably didn't learn a lot from the schematic -- except a
confirmation of what I could already mostly imagine there.

Jon

11. ### John LarkinGuest

Two possible paths are designing the ICs themselves, or designing
discrete circuits that are not suitable to integration, for any one of
a number of reasons.

It's surprising how little really rigorous theory is involved in most
circuit design. In fact, circuit design is an emotional, qualitative
sport that real academic, analytical braniacs aren't necessarily any
good at. That is an occasional source of amusement.

It gets more interesting if you want to maintain a high output
impedance, and a constant current, out into the GHz. Or if you want
the current to be constant to a few PPM precision at, say, 100 amps.

John

12. ### Jonathan KirwanGuest

ICs have design capabilities I cannot access well. So discrete is all
I know it is. I do a lot of construction in practice of things I
design in theory -- even quite complex optical systems, for example.
And those things work quite well according to theory, so I suppose
that's one reason I am looking for something like that here. If it
isn't readily available, that's fine. I can hack things out like the
next guy. I'd just rather have as much theory as is available.

If you are telling me that it isn't available, I'll take that on
That's beyond me, of course. I need to take the early steps. But I
grant you that when reality impinges on a variety of fronts, each
important in some fashion and at the same time, then yes this is what
makes it more interesting once you've a solid handle on the basics.

Jon

13. ### Jonathan KirwanGuest

Okay. Here's another approach:

In this, D1 is there to provide just the right amount of compensation
for the Vb2 of Q2 and it simulates well, though again I still need to
try it out in practice with several kinds of diodes and BJTs.

Actually looks like something I might consider using as one side of a
differential pair being used as a voltage comparator, in fact --
thinking here of R4 as the shared emitter resistor, since the current
to be split would then be held fairly constant (constant current in
the emitter leg is that "good thing" in diff pairs.)

Jon