I'm playing around with opamps trying to build power supply for lead acid battery charger, but in general I want to learn a bit about opamp based design. I'm stuck with constant current mode.

enter image description here

I'm trying out various current sense amplifiers to sense current on the high side. I'm not using OA2 and M3 per se - they are packaged into current sense amplifier IC such as LTC6101, LTC6102, MAX9938. I've tried differently designed voltage output current sense amplifiers like AD8218 too.

So, OA2 and M3 are here to designate current sense amplifier IC that outputs voltage proportional to voltage drop on R1.

I've tried LM358, LM8272, LM8262 as OA1.

My problem is that whatever I do, it either oscillates or does not limit current from some point.

I've tried slowing down OA1 by adding a capacitor on negative feedback path or a low pass filter after current sense amp output, but then, either oscillations become worse, or, when I increase the load, OA1 stops decreasing its output at some point, voltage at output of M1 becomes fixed and I have no regulation.

The best I could achieve was by using high speed opamp such as LM8262 as OA1 and small (1nF) cap across the current sense amp output. On the maximum load, the system was oscillating a bit, but average current was somewhat right.

When I've tried doing low side current sensing using the same type of opamp for current sensing and for regulation, it just worked.

My suspicion is that mentioned current sense amplifiers are not designed to work in linear regulation, but rather as current feedback for some ADC to read (at least, all of them have such application as typical in their datasheets). What I suspect is that phase shift from them is too big. Am I right?

Can anyone recommend a better option for high side current sensing/limiting or some procedure for stabilizing the circuit?

  • \$\begingroup\$ Your schematic may be missing the information that's causing your problem: How is your OpAmp powered? If it's the same 15 V that you're using for the IRF530 MOSFET (M1), ... \$\endgroup\$
    – zebonaut
    Jun 4, 2012 at 9:28
  • \$\begingroup\$ yes, it's the same 15V, i have bypassing caps in place, just ommited it here. what's wrong with using the same power rail? are you suggesting, my power rail bounces around knocking opamp out? \$\endgroup\$
    – miceuz
    Jun 4, 2012 at 9:47
  • \$\begingroup\$ Please don't take my following comment as being overly critical. You provided more information than many do BUT it's easy to not see how hard it can be for readers to get a good feel for what you are doing. There are many subtleties which can trip you up and making enough information available for others to being able to "stand along side you" at a distance is key ... So ... \$\endgroup\$
    – Russell McMahon
    Jun 4, 2012 at 11:14
  • \$\begingroup\$ ... Without digging into the circuit in detail, I'll note that the LM358 you use has a max + input common range about 1.5V below supply. If the opamp needs to work in that range you'll wake up Murphy. Also check max output level. Links to all ICs cited (common or no), actual cct and the actual values of "at some point" in a well described example or few would all be useful. ie wading through the circuit in detail would, with near certainty, allow a working system to be produced but the work in doing so is much increased by lack of information. \$\endgroup\$
    – Russell McMahon
    Jun 4, 2012 at 11:15
  • \$\begingroup\$ Agree with Russell. It is better to power opamp with extra 5..7V over FET. Better both for FET and for opamp. Unfortunately it becomes a little bit high-voltage opamp. So LM358 will be too close to the specced voltage supply limit. \$\endgroup\$
    – user924
    Jun 4, 2012 at 12:02

4 Answers 4


For reference here and because it may change, the circuit you are currently asking about is:

This is supposed to regulate output current, but the complaint is that it is unstable. R1 is meant to be a high side current sense resistor. You say this is for charging 12 V lead acid batteries. You don't say what current, but probably a few amps. In that case 100 mΩ seems rather large. Note that at 5 A it will dissipate 2.5 W.

However, the large current sense resistor should only make measuring the current easier. It looks like your intent is that OA2 provide a ground-referenced voltage proportional to the current thru R1. That concept is good, but the implementation is flawed.

What you need is a "diff amp" that has some finite gain. The differential part eliminates the common mode voltage on R1, but the finite gain part is also important. As it is now, OA2 is being used open loop as a comparator. It's output will quickly switch between full high and full low as the current goes slightly above and below the regulation threshold.

Another problem is that the top of M3 is not connected anywhere, so it can't source any current onto R7. I don't know what that dashed line is supposed to show. Usually if things are connected to it like that it means a conductive case, but you show nothing else connected to it. A case is usually grounded, which is certainly not what you want the source of M3 (strange designator for a FET) connected to. It also makes no sense that you need to buffer the output of OA2 amplifier. I didn't look up a LM358, but if that does not have a push pull output stage, get one that does.

All in all, I'd lose the wierd current sense amp circuit as it is now. There are diff amp chips that do what you want directly. Sometimes they are called instrumentation amplifiers. These have a truly differential input, finite and sometimes adjustable gain, and the output can be referenced to some other voltage like ground.

Once you have a reasonable ground-referenced voltage proportional to the output current, you can feed it into the negative input of OA1 as shown. However, you have to make sure that the controller (OA1 in this case) is slower than everything else in the system. I mentioned this already in another one of your questions. Put a cap between the output and the negative input of OA1 to slow it down. This may require a resistor between the current sense amplifier output and the negative input of OA1 so that the cap has some impedance to work against. Do not under any circumstances attempt to slow down the current sense circuit. That will only make things worse.

  • 1
    \$\begingroup\$ as i've said in my question - M3 and OA2 are here just to mimic internals of specific current sense amplifier IC i use - LTC6101 in this case, i don't know if it has instrumentation amplifier inside, but it's output is proportional to current flowing thru rense resistor, its not bouncing around - i checked that. I'll get instrumentation amplifier to try. What parameters should i check when choosing one? \$\endgroup\$
    – miceuz
    Jun 4, 2012 at 12:37
  • 2
    \$\begingroup\$ @miceuz: Argh. Draw the schematic to show your actual circuit! No, I'm not going to always read every word you write, especially when it looks long. The schematic needs to stand by itself and represent the actualy circuit you are aksing about. \$\endgroup\$ Jun 4, 2012 at 12:45
  • \$\begingroup\$ M3's source is connected back to OA2's inverting input. It is hard to see, but you understand if you look carefully and see that dotted line is straight at some point. Well, OP should have created that dotted line so that it doesn't collide with any wires.. \$\endgroup\$ Jun 15, 2012 at 20:38

Driving power MOSFETs directly from OpAmp outputs may or may not work. The problem could be hidden in the MOSFETs' input capacitances. This value, called Ciss in the data sheets, is likely in the range of 0.5 nF to 2 nF. If you think of these capacitors paralleled to your gate and source terminals, you see how you may have created an oscillator.

What may work to prevent this problem is boosting your OpAmps' outputs with transistor stages, probably as in here: https://electronics.stackexchange.com/a/13377/930

Also, your NMOS (M1) rides on top of the load, which puts further challenges onto the driving circuit. Typically, you put an NMOS' source at GND and connect the load above, or you use a PMOS with the source at the supply rail and connect the load between the PMOS and GND. The goal is to have the source at a stable rail because then, you are able to drive the gate with regard to this stable rail. In theory, VGS will be the same whether or not you put this differential voltage VG-VS on top of a common-mode signal, but for practical designs, things become way better when VS=0

  • \$\begingroup\$ i don't think gate capacitance comes into play here, as i was able to make it stable in voltage regulation mode by slowing opamp. i'm aware that P-MOSFET would be better choise for this design, but i did'n want to add negative voltage into the mix, i thought, running opamps from higher voltage would do the trick. (i'm running it from lower voltage now, just for test purposes). will try putting mosfet on low side, thanks. \$\endgroup\$
    – miceuz
    Jun 4, 2012 at 11:52

I've tried slowing down OA1 by adding a capacitor on negative feedback path or a low pass filter after current sense amp output, but then, either oscillations become worse, or, when i increase the load, OA1 stops decreasing it's output at some point, voltage at output of M1 becomes fixed and i have no regulation.

The feedback compensation needs to be between the inverting input and the output of OA1.

This Intersil app note describes a proper type-2 compensator, which should do what you need:

Type 2 compensator from Intersil app note

You can always start with just a capacitor (C1) and add the R2-C2 branch if needed.

Another thing to remember is that your circuit has a fixed current reference (R3 / R2 divider). Once the battery approaches its charged state and the current starts to drop, your loop will send the control to the rail to try and continue delivering the target current. You need some logic to break out of constant-current mode and into topping charge mode. (See this app note for details.)

  • \$\begingroup\$ thanks for response, i'm aware that set current is fixed. this schematics is just a copy of what i have on the breadboard right now, i'm currently just researching how do i do constant current regulation as such \$\endgroup\$
    – miceuz
    Jun 4, 2012 at 17:19
  • \$\begingroup\$ @miceuz In that case, it should only be a matter of appropriate feedback compensation and your opamp having sufficient output capability to control the MOSFET. \$\endgroup\$ Jun 4, 2012 at 17:29

I've finaly got it!

The current sense amplifier in my circuit is using tha same rail it senses as a supply voltage and it has minimum supply voltage of 4V, so while i increase the load, opamp is closing a mosfet, it gets to a situation where input voltage for current sense amplifier is below 4V and that makes it's actions unpredictable, hence the oscillation and all the greif.

thank you all for suggestions, i've learned a great deal!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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