# Non-inverting amplifier clips to unexpected voltage

I'm trying to build a circuit where I control a small DC motor using an Arduino. My goal is to be able to sense the load on the motor, and shut it off or reverse when the load is too high or the motor is stalling.

My idea was to use a shunt resistor and a op-amp to sense the current through the motor and control it accordingly.

I'm powering the motor using 3.3v. The no-load current is ±10mA while the stall current is ±80mA.

I've build the following circuit (non-inverting amplifier):

Where:

• Rsense = 0.1Ω, R1 = 2k, R2 = 1M

The op-amp I'm using is the LM324AN, which I power with 3.3v

effectively resulting in:

The voltage I measure over Rsense is in the range of 0.0011V and 0.0082V (which is as expected).

The problem is the Vout. I would expect this to be between ±0.5 and ±3.3v (the voltage it's supplied with). Since the Gain = 1 + R2/R1 ≈ 500.

However Vout is not coming above 2.06V. It seems some clipping is happening, which I expected. But I expected it to happen at 3.3V and not 2.06V.

Is there an explanation why the Vout is not coming above 2.06V?

Thanks, R.

I presume you have read the data sheet. Regardless, look at this one and on page 6 you'll see output voltage swing specifications. Granted, this is only given for a 30 volt power supply, rather than a 3 volt supply, but notice that a 324 is only guaranteed to put out 22 volts under those circumstances - although typically it will do much better.

So, when running at a 3 volt supply, you simply cannot get more than a volt or 2 out of the op amp. If you can't live with that, get an op amp which is specifically rated as "rail to rail output". This won't actually get perfectly to the rails, but it will do much better than an LM324.

Furthermore, running an LM324 at a gain of 500 is a really bad idea. Referring to the data sheet, on page 5 you'll see "Input offset voltage". This is an error voltage which every real op amp displays, and for the LM324 it can be as high as 3 mV. Multiply that by 500 and for zero current in the shunt the output voltage can theoretically be as much as +/- 1.5 volts. It's perfectly possible to compensate for this by providing a variable voltage at the ground end of the 2k resistor, in the range of +/- 3 mV, but this will not provide compensation for changes in the offset with temperature. This temperature drift is not specified for an LM324, and this should give you some warning that it is not intended for very high gain DC applications.

Finally, an op amp does not magically produce voltage. It can only produce an output between its power supply voltages. This means that for a single-supply setup such as you have, it cannot produce voltages less that ground. If you must have a negative voltage swing you must supply a negative voltage to the IC.

• With a stall current of 80mA @3.3V the motor should have a resistance of ~41 Ohms, so a much higher value sense resistor could be used without affecting it too much. Using 1 Ohm the gain could be reduced to 25 (for 2V output at stall) resulting in a maximum offset of only 0.075V. I presume the motor is powered through an H bridge, so sense current would always be positive. Oct 1, 2016 at 14:10

This is exactly to be expected- the output voltage of an LM324 cannot swing very close to the positive rail. If you can reduce the range to something like 1V with a 3.3V supply it will work reliably for all cases over temperature etc, otherwise use a single-supply op-amp with rail-to-rail output such as LMV324 or a RRIO op-amp.

Also note that it cannot swing below (or even quite to) the negative rail, which is 0V in your case, so you can probably depend on 0.1 to 1V with the LM324 on a single 3.3V supply, not +/-3.3.

And you definitely should not connect more than a small capacitance (as in pF not nF or uF) directly fron the op-amp output to ground- this is how you make an oscillator. Add a few hundred ohms to isolate the load capacitance.

• It may be possible to salvage the circuit by adding a pull-up resistor between op-amp output pin and the +3.3v supply. Value not terribly critical (perhaps 1K). The original spec (for motor shutdown on overcurrent) cries out for a comparator: LM393 or LM339. Oct 1, 2016 at 13:20
• A pullup resistor is also problematic : the LM324 output stage pulls down VERY weakly - thousands of times weaker than its pullup strength.
– user16324
Oct 1, 2016 at 19:22
• Both the above comments are correct, which is why I didn't get into it. If you're only interested in a range from 1-3V say it might work. The pull-down strength is a nominal 50uA so very weak until you get more than a diode drop above the negative rail. Oct 1, 2016 at 20:20