Monthly Archives: June 2013

Current Source 3

This is a minor posting to follow up a point raised in response to one of the previous Current Source posts. Several people sent me emails of the form “Why don’t you….?”. In Current Source 2, I explained that the application was for building by ‘hobby people’ with a production run of 1 (each). This makes any specialized current source ICs unsuitable. James Fenech asked “Why don’t you use an op-amp?” James knew perfectly well that I had used an op-amp for a very similar task on a previous design. Below I show (with permission of the intellectual property owner) a circuit which used a quad op-amp to provide pulse width modulation. This was designed by me, but is not drawn as I would draw it. I have taken this diagram from a much larger and complex one, and this circuitry had to fit on the page amongst other things. In this case, there is not a module of circuitry that one would identify as “the current source”, which plays the equivalent role to the current source in the last post, as it is a single resistor: R14. Unfortunately, you might not be able to identify R14 on the circuit diagram (This is a problem with this blog software – not enough resolution for diagrams! If you wish, you can view a higher resolution copy of this here: .pdf of op-amp based circuit ) It is the resistor feeding current to the inverting input of the op-amp labelled “Integrator”.


In this particular application, the requirement was to sense temperature across an isolation barrier. An opto isolator was already in the design to pass a pulse stream for other purposes, so this circuit was added to hitch a free ride on those pulses by modulating their width. I won’t attempt to explain every detail of the circuit operation, as you can figure it out for yourself, although there is a trap in there for the unwary.

Note that the amplified voltage from the temperature sensor is “mixed” with a bit of DC from the regulated supply (the resistor immediately above the Integrator) We didn’t want the pulse width to diminish to zero as the temperature fell to zero.

The “Trap”? I designed this circuit, and got it working, without understanding it fully (even though I had several pages of notes to support the design). What I hadn’t allowed for is that in the time immediately before the integration ramp, the Trigger output is high and the Integrator output is saturated low. The integrator capacitor will thus charge up (plus at the left end as shown). When the trigger changes state, the capacitor will have to discharge before the integration ramp can start (the integration ramp involves charging the capacitor with the right end positive). I designed this, and missed this point. The circuit was inspected by several very clever engineers and they missed this point as well (So I don’t feel so bad). This delay to the integration ramp did not matter in the application, but I did not want any of that sort of second order complexity in the circuit at the end of the previous post (Current Source 2). So James, that is why I did not use an op-amp in Current Source 2.

Current Source 2

Towards a Temperature Compensated Current Source.
Second Post on Topic


I continue to look at current sources for an application in which the temperature coefficient had to be kept under control. This post assumes that the reader has read my previous post on this subject. If you have not read that, seek it out before reading this.

The application is a pulse width modulator in which a fixed current is applied to a capacitor to provide a “time – voltage” relationship. The application does not require very high accuracy or linearity, but a couple of set points on the range (min and max) have to stay pretty well where they are put. (Just exactly what “pretty well” means is not determined yet.)

There are two ways from here
The narrative splits into two at this point. I will have to deal with them sequentially. When you get to the second branch, just remember that this is where it branches off.

Current Source Thread Branch 1.
Just a reminder, this is the current source circuit that I had at the very end of my last posting.


On simulation, this yields output current from 0.99954mA to 1.00026mA over temperature: a change of 720nA. (The temperature range I had selected for these tests was 0 degrees C to 70 degrees C) The actual sequence that lead to this circuit was not exactly as I had stated in the last posting. I had been tweaking the values of the resistors R5 and R2 and found that my optimum was at almost identical values before the reason that they would be almost identical became clear.

By the time I was writing out the last posting, it was obvious why:
(a) They are almost identical
(b) Choosing the same value in “real hardware” would be near enough
(c) The optimum values I had found by iteration in the simulation were not exactly the same.

Just to clarify in my own mind exactly how the temperature compensator was influencing the mirror, I went into the matter in a little more detail. Some of you will be way ahead of me, but others might find this clarifying.

Here again is the raw current mirror.


Remember that I had identified that the main temperature error (assuming identical transistors) arose because the current in the left branch has to traverse:
(a) R1
(b) VBE of Q4
(c) R2

As the VBE of Q4 varies with temperature, the volt drop left to share between R1 and R2 changes, and thus the current changes. The temperature compensator replaces R2 as a current sink for the Q4 collector.


I like to show voltage dividers as voltage dividers, and a change to this yields:


Replacing the VBE multiplier with a voltage source symbol changes the circuit to:


The voltage source V4 has a magnitude of output of two times VBE. Notice that I called this 2 x Vj (for Voltage of junction) as the circuit capture on the low price spice does not provide for subscripts.

It should be noted here, that there is nothing, as far as I can see, that is magical about the number 2. This circuit would work if V4 gave 1.8 times the junction voltage and then the voltage divider divided by 1.8. Indeed, there might be some reason for choosing a number other than 2, but I am not going to pursue it in this posting (see below).

When we encapsulate the voltage divider in our model, we get:


The voltage source is halved, and the output resistance is the resistance of the two divider resistors in parallel. Now let us reunite the temperature compensator with the left leg of the mirror.

CS2-7There are three voltage sources in series around this loop. Lets incorporate them all into one.


The voltage across the resistors has no contribution from any junctions within the limits of all the assumptions, stated and implied.

My third obvious point above, (c), was that it seemed obvious to me why I had found an optimum in which R5 and R2 were not exactly the same. I reckon that it is because the junction that has its volt drop multiplied in the VBE multiplier is not carrying the same current as the junctions in the mirror. I have observed that we can multiply, and then divide this VBE by some number other than 2. I reckon that in this way we could change the current in Q1 so that it matched that in the mirror transistors. Some tricky maths might yield a simple answer that would give us different resistor values and a better optimum. I am not going to go there now for two reasons. First the optimum is pretty good already, and second, this is the place to terminate this branch and go back up to the branching point and look at the other.

Current Source Thread Branch 2.
After I had posted the last posting on this, I was looking a bit further on the web and I had one of those “D’oh!” moments. (Is that how you spell it?)


I found a circuit that was simpler than the one I have developed above and which will most likely be good enough. It reduced the transistor count from 3 to 2. I do not remember ever seeing it before, but that is no excuse. As soon as I saw it, I could see that it was so obvious, that not thinking of it was inexcusable. I will record that I had several replies to the last posting, and one of them was on to this (after I had found it). The circuit was in a group of images that Google offered me when I Googled “Temperature Compensated Current source”. I tracked it down to:
… a site I do not particularly recommend, as it is written at too simple a level for readers of this post. Their circuit was:


As I wanted a current source and not a current sink, I took the simple step of turning it upside down.

CS2-11The operation is obvious: (to a first approximation) the constant voltage determined by the divider R1 and R2 has one VBE subtracted from it, and then a VBE added back to it. The two VBEs can be contrived to match reasonably well if the two transistors carry the same current.

This arrangement was adopted in my circuit. I had described the requirement earlier, but I should perhaps add that this circuit is for publication in a hobby magazine, and might go on to be constructed by a number of amateur constructors. The optimum economy in the design will thus be different from most design projects. In particular, the product cost is the BOM cost. Labour is costed at zero. Secondly, component availability is an issue. One lot of freight cost from Digikey will buy a lot of parts from Altronics or Jaycar when the purchasing is being done for a production run of one. This is why I have not chosen one of the monolithic current sources.

Here is my back-of-the-envelope sketch of the module incorporating the current source (as drawn before I went off on this “minimizing tempco” quest).

CS2-12In this application, a “servo” of the type that is used in model aeroplanes and the like is used to activate an engine throttle. The reason that I had written earlier that “couple of set points on the range (min and max) have to stay pretty well where they are put” was that these are the stops in the throttle linkage travel. I place “servo” in inverted commas as in this context the word has come to have a quite different meaning from that used elsewhere. These little jiggers take as input a pulse train, and adjust their position according to the width of the pulses. The requirement to drive one, then, is a repetitive variable pulse width. Here is the circuit a little further down the development track.


For reasons that are logical, but which I will not go into here, this circuit has some anomalous resistor values showing. If the dual comparator is changed from a LT1017 to an LM393, and the MOSFET changed to a 2N7000 (both changes will have no impact on operation) then the requirements about component availability are met. I only have two line thickness for the reproduction of the circuit above, and I have chosen “thick”. This makes the comparator symbols very unclear. To help you read the circuit: the inverting input is at the top and the non-inverting below it.

Here (in simulation) is the “Servo Drive” and the “Ramp” signal.


The timing of the falling edge of the output pulse (blue) is determined by the voltage on the ramp.


Current Source 1

Towards a Temperature Compensated Current Source.

In the text below, I use the term “transdiode”. If you have not encountered this term before, you will, I am sure, find the meaning obvious. This is not a matter of me making up words or picking up new trendy ones. I picked up the term from Peter Baxandall and Douglas Self.

I had recommended a cheap current source circuit to a colleague. On reflection, I was concerned that the temperature coefficient might have been too high. I explored several alternative arrangements and found that the temperature coefficient could be vastly improved. I have restricted this to circuits with small number of transistors and resistors. Circuit modelling has been done with LTSpice. This provides for variations in temperature, but I do not believe it is correcting for variations in rise above ambient for different silicon chips according to their individual dissipations. The optimum that would be obtained with real hardware could not be expected to be as good as I have obtained in the simulation.

The application is a pulse width modulator in which a fixed current is applied to a capacitor to provide a “time – voltage” relationship. The application does not require very high accuracy or linearity, but a couple of set points on the range (min and max) have to stay pretty well where they are put. (Just exactly what “pretty well” means is not determined yet.)

A crack at it
My starting point was a circuit that I have always known as the “D2 current source” as I have associated it with a colleague whose nick name was “D2”. I do know that he didn’t invent it, and maybe it has a proper name.

I record here several steps I took whilst I explored the options for reducing the temperature coefficient of the current source for this application. I chose a design current of 1 mA. there is nothing special about this figure, and indeed, there might prove to be good reasons for diverging widely from this. I believe that what I have discovered here would apply just as well (with appropriate adjustments) for other quiescent conditions. As I tried different circuits, I did not attempt to adjust the output current: not, that is until just near the end. CS1-1

This is the basic D2 Current source with resistor values chosen to give a nominal 1 mA output. The resistor R3 is in the circuit for the simulator (LTSpice) to have a component to measure the current in. Over the temperature range (0 degrees C to 70 degrees C), this yields 720uA to 920uA a Delta of 200uA. That is a fifth of the span. Not good enough for the application. In this circuit, the output current is determined by the comparison of VBE for Q4 and the volt drop in R1 carrying the output current. First order base current cancellation takes place, as the base current of Q3 is added to the output current on its way to R1, but then the base current of Q4 is subtracted. One idea is to correct for the VBE drop of Q4 and then add a more stable volt drop. One of the band gap devices might serve. This gives the following circuit.


V2 represents a “perfect” one volt band gap device. This now provides the volt drop to compare the volt drop in R1 with. The transdiode Q1 cancels out (to an extent) the temperature sensitive VBE of Q4. This gave a range of 788uA to 830uA over temperature, a delta of 42 uA. This is better.

It occurred to me that the above circuit was using the transdiode Q1 which is carrying pretty well the output current to cancel the VBE of Q4 which is carrying very much less current. One trick might be to increase the current in Q4 to a value much the same as the output current.

CS1-3 This is easily achieved by reducing the value of R2. I chose 2k8. the result is an output current of 0.9995mA to 1.0011mA over temperature, a delta of 1.6uA.

This is pretty good. (Much better than is needed for the application) but it does involve the use of that perfect 1 volt band gap device. can we do without that? What about a current mirror?

This gives an output current of 884uA to 913uA over temperature, a delta of 29uA. Better than the plain vanilla D2, but maybe we can do better yet. I thought of a two terminal current source circuit that I devised many years ago for a completely different application.


This gives 770uA to 890uA over temp, a delta of 120uA. Not promising. I went back to that current mirror to see what I could do with that.


The trouble with it is, I reasoned, that the five volts is divided up between:
1. The volt drop across R1
2. The volt drop of the transdiode Q4
3. The volt drop across R2.

Of course, item 2. varies with temperature, which imposes a variation on the other two. The variation in item 1. translates directly into variation in output current. What can we do to keep the current in R1 constant? One trick would be to vary the voltage at the collector of Q4 with temperature. If instead of just having R2 there, we had some circuit that varied the voltage on the collector of Q4 by just as much as the forward volt drop of Q4 configured as a transdiode would vary.

One way to do this, is to start with a supply voltage that varies twice as much as Q4 does, and then divide this variation in two with a resistive divider. If the current flowing from Q4 upsets the perfect division by two of the voltage divider, then maybe we can compensate by tweaking the dividing ratio a little. Here is the result.

CS1-7 The collector of Q2 will be at a voltage that is two transdiode drops below the five volt rail. R5 and R2 divide this voltage by a factor that is slightly off one half. In my reasoning for the divide ratio (above), I allowed for variation from the the exact factor of one half. I imagine that other factors come into play as well. Q1 and Q2 will not be carrying the same current as Q4 for a start. The values of R5 and R2 sown here are only 1.3% apart.

In this case, as I was coming near to the end of my quest for a cost effective low tempco current source, I did go to the trouble to tweak the resistor values to get closer to the design current specification that I set myself.

The result is: output current varies from 1.00028mA to 1.00029mA a change of 10nA!
(Please forgive the exclamation mark. I am pleased with this result.)

What if we make R5 and R2 the same value (a practical thing to do)? I will choose 2k91, an E96 value. The output current degrades to variation between 998.88uA and 999.23uA, a variation of 350nA. This does look a lot worse than 10nA, but I suspect that this difference would not be significant with real world components.

The emitter resistor should have tight control of the current in Q3, so I do not expect much Early effect influence.
Output current with R3 = 0.1 ohm (default temperature) = 1.000215 mA
Output current with R3 = 2k5 3k (default temperature) = 997.407uA

Effective output impedance = delta V/delta I
= 2.5/2.8E-6
= 890k
I thought it would be higher than that.
A variation in 2.8uA in a 1 mA current as a connected capacitor is charged will not be a problem in the application.

An afterthought.
I just thought “VBE multiplier” and saved a transistor. No efforts to optimize this at this stage.