One challenge in circuit design is building a good current source, especially when the load is variable or the current must be controlled with a voltage source. The figure shows a simple, low-cost voltage-controlled current source using two op amps that provides a good range of current and maximum load.

The idea is to apply a voltage on a reference resistor (or resistors) having a low thermal coefficient. The current passing through this resistor will be the output current. U1 adds the input voltage with V2, and U2 buffers the load voltage, so we have:

V1 = V_{IN} + V2

Obviously, U1's output current is amplified by Q1.

Applied voltage on the resistor network R is (V1 - V2), which will be equal to:

V_{R} = V1 - V2

= (V_{IN} + V2) - V2

= V_{IN }

So the output current will be:

I_{OUT} = V_{R}/R = V_{IN}/R

If R is a constant value (low thermal coefficient), the output current will be a linear function of the input voltage. Four resistors in series reduce the effect of thermal dependency.

We also have to consider some other constraints. Limited supply voltages cause a limited maximum output current. And if the load is large, transistor Q1 must be able to handle the maximum current.

If U2 is a rail-to-rail amplifier, then the zener diode isn't required. Otherwise, it's needed to prohibit the current source from malfunctioning with low current outputs. (When V2 is very close to -V_{CC}, the buffer's output may not exactly follow input-voltage changes.)

Here is the calculation: Suppose we want to calculate the maximum output current with ±V_{CC}, and R as the resistor value, when the input voltage has a maximum value of V_{IN(MAX)}. Then:

I_{MAX} = \\[2 x V_{CC }- (2 x V_{z}) - V_{BE }- V_{IN(MAX)}\\]/R

For the circuit shown, a maximum current of 20 mA is feasible for a maximum load of 1100 Ohms. Using higher-voltage op amps and larger power transistors can increase these values if cost isn't a concern.