Electrical – precision current sink for battery discharge

current-sinkjfetmicrocontrolleroperational-amplifierprecision

I'm trying to build a precision computer-controlled current sink to discharge a battery. The maximum discharge current is to be 2mA (at the moment; I might go to larger currents later) and the battery voltage starts at around 1.5V.

enter image description here

I have built this circuit, in which the voltage source is provided by a DAC attached to a microcontroller. The op-amp kindly adjusts its output to control the current through the JFET so that the voltage from the DAC is matched by the voltage drop across the 500Ω sense resistor and everything works very well down to µA ranges. I'm logging the battery voltage and current through an ADC (not shown).

The problem is that if the battery is detached before the output of the DAC is set to zero then the op-amp forward biases the JFET junction and provides the current rather than the battery doing it. I could detect the battery being removed with the microcontroller then set the DAC output to zero but it doesn't seem to be a very elegant solution; can anyone suggest a more "circuitous" way of solving the problem?

Best Answer

This is pretty simple.

schematic

simulate this circuit – Schematic created using CircuitLab

The comparator is any open-collector comparator which will run from your op amp supply. The Ref input can be any handy voltage less than the battery. For instance, if your op amp is run from 5 volts, dividing down to 2.5 would be simple enough. R3 and R4 produce a comparator voltage which is comfortably above the Ref voltage when the battery is connected. For this example, a 2:1 ratio will give 3 volts, compared to the 2.5 Ref. When the battery is present, the comparator output will not affect the op amp input, but when the battery is disconnected the divider output will go to 0, the comparator output will go low, and the op amp input will be pulled to ground.

Depending on your op amp voltage, you might not even need a divider. If you use a 12 or 15 volt supply, you could sense both the supply and the battery directly, assuming neither condition violates your comparator input limits.