I'm considering designing/building a fairly basic electronic load (constant current, but possibly also constant power and resistance). However, after drawing up a few ideas for the basic operation, I got stuck.

My first idea was to go the digital route, using a MOSFET driven by a DAC as the power dissipator, and a sense resistor + current sense monitor/amplifier read by a microcontroller to adjust the current to the user-set level.

I started doubting it a bit, though, for two reasons:

  1. I'm not sure if it's "fast" enough. The code would have to check the current in the sense resistor, and presumably use some sort of PID loop or such to drive the MOSFET gate. The monitor I had in mind (TIs INA226 I2C current shunt monitor) can be read at least 1000 times/second, probably 3000; the datasheet is a bit unclear[1]. My guess is that this will do?
  2. I have no experience with this; would a PID controller be a good fit? More specifically I really have no clue how, better than basic trial and error, to figure out e.g. what the MOSFET Vgs should be to allow a certain current though at a certain voltage (Vds).

After that, I thought a bit about an analog+digital design: same load and sense resistor, but with an analog instrumentation amp to amplify the sense voltage up, and drive the MOSFET with an opamp with negative feedback. The noninverting input would then be set by the MCU + DAC, but the digital control would only set the current, not actively control it.

The main potential downside I see here is that if the current is low, so that the shunt monitor output should be very low (say 5 mV, for ~ 0.005/5 of the full scale value), the not-truly-rail-to-rail nature of the amplifier might cause issues.
For example, if the "low swing" is 35 mV above ground, it'd essentially "tell" the op amp that the current is 7 times higher than it is, wouldn't it?

This turned out longer than expected. Anyway, the main question is really:
Would the first solution, with digital control by sampling the current at perhaps 1-3 kHz and some sort of PID controller, be a good one?
I figure that if I get that running, I can add more advanced modes such as constant power and constant resistance fairly easily, as opposed to with the analog design.
And if not, is the analog idea any better, and will it work at the case I mentioned with near-ground output?

[1]: They mention as an example that with a 588 µs conversion time and 4 averages, data can be read roughly every 4.7 milliseconds. I'm not sure why that's not every (0.588 * 4) ms instead.


2 Answers 2


It might work, but I would suggest another approach that is open loop and has 8 bit accuracy.

enter image description here

You can implement a discrete version or buy the chip and R/3R precision component.


Unless you really want to start doing fancy stuff like transients, a slowly-changing active load is ideal, as the low control frequency would avoid interacting with the loop of the power supply under test.

If you go closed-loop around a current sensor, the exact gate voltage needed to get to that current becomes moot - as long as the op-amp is capable of controlling the gate (i.e. can set a high-enough voltage to get the needed drain current) you're fine.

The approach of using a DAC to set the reference voltage for the error amplifier is sound, and is the 'best' way to do things if you wish to have some sort of a front panel or easy remote control capability (I2C / UART / whatever) - just program a target current and voila.

If you sense the voltage at the load terminals, you can then do fancy stuff like constant resistance and constant voltage.

Don't forget to add some MOSFET temperature sensing (reduce the current if the device gets too hot).

  • \$\begingroup\$ Hmm, I'm having "some" trouble with oscillations in a simulation. I set up this slight mess: i.imgur.com/S7xMZ.png ... and I get a current that oscillates between 0 and 2.5 amps, with a period of ~0.1 ms (10 kHz). R5 was an attempt to fix it which did nothing useful. The opamps used are just ones I picked because LTspice shipped with them. Am I doing something fundamentally wrong here? (This stuff is why I prefer digital, by the way. ;) \$\endgroup\$
    – exscape
    Nov 16, 2012 at 15:41
  • 1
    \$\begingroup\$ Your error amplifier doesn't have any compensation to limit the bandwidth, which is a sure-fire way to make an oscillator. Try putting 1uF between the output and non-inverting input of the amplifier and try again. \$\endgroup\$ Nov 16, 2012 at 16:55
  • \$\begingroup\$ Before or after R5? Before (connecting + to Vout directly) did nothing, but with it after R5 it helped, but didn't stop it completely. It works for ~45 ms after which a sine wave osillation breaks out again, between 658 and 674 mA, so centered around the correct current. \$\endgroup\$
    – exscape
    Nov 16, 2012 at 17:37
  • 1
    \$\begingroup\$ Try again with 1k in series with each opamp input (the DAC as well as the current sensor output). 1uF is just a value I guesstimated - you may need a different compensation arrangement (two branches between output and non-inverting input: one with a small cap, the second with a larger cap and a a resistor in series). 5V supply and max op-amp output may not be enough to fully control the gate of the MOSFET. The 100k should be reduced by a lot (try 10-100R) and you should add 10k from gate to source to ensure the FET is off if there's no control input. \$\endgroup\$ Nov 16, 2012 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.