# Unity gain op amp gives static, incorrect output

I have the circuit shown here:

where I'm using a switching regulator (not the linear 78xx shown) to provide me with 5V to power an Arduino and a little more circuitry that the Arduino is monitoring. The Arduino is measuring (and logging) the voltage at A - ie I'm logging the input power supply voltage (which varies ~12.7 > 14V according to the solar charging the 12V batteries).

Without the op amp (ie measuring the voltage directly from the potential divider [and with resistor values ~1/2 of that shown]) the voltage logged is as expected. I want the unity gain op amp so as I can increase the resistor values to reduce the current drawn.

However with the op amp in place the output (A) is a static ~3.74V. I measured this directly at a time when the voltage to the +ve op amp input was ~3.85V, and I also know from reviewing the logging that the voltage on the output of the op amp was static throughout the previous day*.

I'm probably making some rookie mistakes, I'm new to the idea of an op-amp as a buffer - in this case I'm using an LM358 (datasheet pdf) as it's what I have available - I'm very open to suggestions of a more appropriate amplifier. While I could get away without it in this case, I do want to minimise the current drawn here, and I will also be logging the solar voltage (~70V) so will definitely want > 10k resistors in that potential divider and will therefore need a buffer.

*the voltage is logged whenever the scaled measured voltage varies by 0.05V (ie battery voltage goes 13.1 -> 13.15). Without the op amp this logged ~1000 entries in a day. With the op amp it logged half a dozen, and these varied only within ~12.4-12.5V (despite the solar MPPT charger reporting the day max of 14V).

• Your diagram doesn't match the pinout of the LM358. According to the datasheet I found, pin 4 is ground but you are using it as an input. Please check your connections against the datasheet and correct either the diagram you posted or the circuit you built.
– JRE
Commented Dec 1, 2015 at 9:33
• Won't the Op-Amp then draw more current than the resistors by themselves ? Commented Dec 1, 2015 at 15:45
• Yes, thanks, the schematic was thrown togethor this morning using a generic op amp in order to get the symbol (since the 358 has two op amps and so produces two symbols in the schematic). The pin numbers in the schematic above do not correspond to the 358, but the above is symbolically correct. Commented Dec 1, 2015 at 17:38

You are powering your LM358 from a 5V power rail: -

• It only has a 5V power rail
• Input common mode range is from 0V to Vcc-1.5 i.e. 0V to 3.5V
• Your input is 12V *10/32 = 3.75 volts
• Output range is about 0V to Vcc-2V i.e. 0V to 3V

Read the data sheet and don't expect miracles.

• Thank you. I had overlooked this part of the op amp specs, but that explains the results I'm getting and I'll seek a more appropriate part. Commented Dec 1, 2015 at 17:41
• There not cheap but an AD8605 will do the job OR just accept a lower peak voltage as representing full scale. Commented Dec 1, 2015 at 21:20
• Thanks for the pointer. By the looks of it that isn't available in DIP package? I need to hunt around properly sometime (I only have internet access at work...), but a forum post suggested a TLV2371... For the moment I'm just using the 12V supply, I need to iron out the design for another part of the circuit (no doubt another question to be asked soon!) before I have to commit on this. Commented Dec 3, 2015 at 8:58

The LM358 output will not go to V+ (currently 5V) - its output is saturating.

You need to find an op-amp with rail-rail outputs - or you could power the op-amp from the battery voltage.

You should also add a decoupling capacitor across the power pins.

• Thank you, that's pointed me in the right direction. In the short term I shall try running the op amp from the battery, I think I will prefer running from 5V in the final design so will look into a more appropriate op amp. Commented Dec 1, 2015 at 17:42