 # OpAmp based voltage controllable current source

19 Aug 2022 - tsp
Last update 19 Aug 2022 7 mins

This is another article that’s basically a note to myself to keep that information around. This circuit is well known all around the Internet so there’s nothing new.

## Introduction

So one often requires a voltage controllable current source - for example when one builds a power supply, drives coils for some nuclear magnetic resonance (NMR) or electron spin resonance (ESR) experiments or tries to build magneto optical traps for cold atoms - or just in case one requires a controlled lab power supply - there are zillions of possible applications.

A really nice way to drive such systems up to a few Amps is the usage of operational amplifiers such as the OPA549 by Texas Instruments that’s capable of driving voltages up to $\pm 30V$ and continuous currents up to $8A$ (peak currents up to $10A$). Those devices are really great even though a little bit costly. They are commonly available at most electronics distributors at prices between 15 and 20 Eur per piece.

So now one could simply build a voltage to current converter by attaching the load to the amplifiers output (don’t forget flyback diodes of course - not shown in the drawing below), pass the current over a small $1 \Omega$ sense resistor and use the voltage drop over the sense resistor as one input to one’s operational amplifier. The other side could then be exposed to the analog control voltage and thus in theory one would have a 1:1 voltage to current conversion (i.e. inputting 2V would lead to an output of 2A). This might be sufficient for many simple applications that have no major problems with drifts in current. The main problem is that the output current depends on the value of the sense resistor - a drift that occurs for example due to thermal load. Since the whole output current flows over the sense resistor this can be a rather large drift that might be unacceptable for sensitive applications.

Luckily there is a solution that uses just some small fraction of the output current that’s parasitically taken from the OpAmp that one can use in the feedback loop as well as a topology for a feedback network that also compensates for thermal drift inside the resistors used in the feedback loop - I came across this type of feedback loop when I saw this design from an analog magician at work (and found similar implementations later on online). The idea is pretty simple - the output of the OpAmp drives the load via a resistor $R_5$ that also controls the gain of the circuit. The feedback is routed through a parallel branch to the load circuit that’s formed by $R_3$ and $R_4$. The second feedback loop is formed by $R_1$ and $R_2$ as well as the control voltage. To compensate for thermal drift inside the feedback paths the circuit is designed symmetrically:

• $R_1 = R_4$
• $R_2 = R_3$
• $R_4 \mid R_3 » R_5 \mid R_3$

The reason for the last requirement will be obvious when one looks at the equations. Since the feedback paths are designed equally one will see that the feedback currents are equal - thus all resistors will heat up the same way (up to manufacturing differences). One should select high precision resistors for those paths of course. One will also see from the equations that the exact value of the resistors is not relevant - they should just be chosen way larger than the load resistor due to the current distribution between the two paths but one of course also has to think about the thermal noise that is increased with temperature (recall Johnson-Nyquist noise of an Ohmic resistor that as a root mean square of $\sqrt{4 k_B T R \Delta f}$ at a given bandwidth $f$. As one can see this scales with $\sqrt{T}$ and $\sqrt{R}$ thus temperature change has to be kept low by large resistance but on the other hand an increase in resistance will also introduce noise into the circuit). Usually one uses a few tens of $k\Omega$ for these resistors.

## Circuit analysis

To understand and model the OpAmp one has to recall that an OpAmp tries to keep both of it’s inputs equal when one supplies a proper feedback network - so it tries to achieve $U_{+} = U_{-}$. The OpAmp tried to drive $U_{+} = U_{-}$. In case the voltage divider is symmetric one can assume that $U_5 = U_{in}$. This can be seen easily when looking at the voltage loop formed by the feedback network and the voltage input via the ground connection. Thus one can directly express the current over the resistor $R_5$ in dependence of the input voltage $U_{in}$:

[ U_5 = U_{in} \\ I_5 = \frac{U_5}{R_5} = \frac{U_{in}}{R_5} ]

The current $I_5$ is composed of the large load current and the feedback current in the non inverted feedback loop:

[ I_5 = I_{FB+} + I_L ]

The current over the inverted feedback loop is determined by the potential difference between the amplifiers output $U_{op}$, the input voltage $U_{in}$ and the resistors $R_1$ and $R_2$:

[ I_{fb-} = \frac{U_{op} - U_{in}}{R_2 + R_1} ]

Now one can look into the non inverted feedback loop. The current over resistors $R_3$ and $R_4$ can be determined when one recalls that the current over $R_5$ has to be equal to $U_{in}$:

[ I_{fb+} = \frac{U_{op} - U_{in}}{R_4 + R_3} ]

When one recalls that we assume or require that $R_4 = R_1$ and $R_3 = R_2$ one can see that both feedback currents are equal:

[ I_{fb+} = \frac{U_{op} - U_{in}}{R_1 + R_2} = I_{fb-} \\ I_{fb+} = I_{fb-} = I_{fb} ]

Now one can recall that the current $I_5$ is composed of load current and feedback current:

[ I_5 = I_L + I_{fb} \\ \to I_L = I_5 - I_{fb} \\ I_L = \frac{U_{in}}{R_5} - I_{fb} ]

The last step is to recall that the operational amplifier tries to drive $U_{+} = U_{-}$, i.e. it tries to drive the potential difference between its inputs to zero. The voltages are only determined by the feedback resistors $R_2$ and $R_4$:

[ U_{-} = U_{op} - R_2 * I_{fb-} \\ U_{+} = U_{op} - U_{in} - R_3 I_{fb+} \\ \to U_{-} + U_{+} = 0\\ U_{op} - R_2 * I_{fb-} = U_{op} + U_{in} + R_3 I_{fb+} \\ U_{in} = (- R_2 - R_3) * I_{fb} I_{fb} = -\frac{U_{in}}{R_2 + R_3} ]

Inserting into the equation for $I_L$:

[ I_L = \frac{U_{in}}{R_5} + \frac{U_{in}}{R_2 + R_3} \\ I_L = U_{in} (\frac{1}{R_5} + \frac{1}{2 R_2}) ]

As one can see there is a direct relation between the load current $I_L$ and the input voltage $U_{in}$ that’s independent of the load resistance $R_L$. It depends on the resistor $R_5$ (and thus it’s thermal drift) though.

The constant factor is composed of two terms, the main component being $\frac{1}{R_5}$. The second term $\frac{1}{2 R_2}$ is usually pretty small - when one uses $20 k\Omega$ for all four resistors in the feedback network this should be around $10^{-5}$ in comparison to the factor $\approx 1$ or larger usually used at $R_5$ (remember that this resistor should be near unity or smaller since the whole load current flows through this resistor and might generate massive amounts of heat). In case one uses smaller resistors such as $1 m\Omega$ on can decrease the thermal load, thermal energy loss but also requires more fine grained control over the input voltage. Thus one can approximate:

[ I_L \approx U_{in} \frac{1}{R_5} ]