# How to reduce op amp output error?

I am trying to precisely measure cell voltage of a LiPo battery using a differential amplifier. The idea is to use an op amp to measure each cell voltage. I need to get a precision of about +-5mV considering that each cell differential voltage goes from 3 to 4.2V max but the input voltages in the op amp are from 25.2v (sixth cell) to 4.2v (first cell). Here is the circuit I am using with a LM324: The output of the op amp goes to a micro-controller ADC. In this circuit the gain is 1.2 but I know resistors have tolerance so first I have a calibration step where I put a precise know voltage in the inputs of the op amp, I get the output voltage with the ADC and Vout/Vin = G so I get the real gain because of resistances variations.

But now I have a new problem, if I put 8.4V and 4.2V I calculate the gain that gives me for example 1.22. If now I put 9V and 4.2V gain is the same (1.22) but if I elevate or reduce the voltage even more let's say 15V and 10V the output doesn't responds to 1.22 gains, the total gain is now 1.29! I think this offset voltage I am getting (despite 2 to 3mV input offset of LM324) is due to bias current that are increasing as I increment input voltage is my assumption correct? If so, is there any relation between input voltage and offset voltage at the output according to the resistances in the circuit?

If my assumption is wrong, is any other way to reduce this error despite of using a precision amplifier? Because here are very rare and cost 5 times the price of an LM324 :/

• What kind of microcontroller are you using? It's AVR with 10-bit ADC or something better? Apr 26, 2014 at 1:40
• PIC18F4550 at 5V so I have 5mV ADC resolution Apr 26, 2014 at 1:41
• What simulation software is this? Nice voltage indicators! Apr 26, 2014 at 2:04
• Are you getting these results (problem with gain 1.29 instead of 1.22) or in real circuit? I've tried to reproduce your problem in Multisim and im getting correct results with gain of 1. I've tried 1k, 100k and 1M resistors. 1M resistors gave me 0.1% error, 1k resistors 0.02% error at 20-25V measuremet (in simulation, 0% tolerance resistors). Apr 26, 2014 at 2:21
• Yes I am getting this errors on a real circuit on breadboard not on simulator. @Kamil the simulator is Cadence Orcad. Apr 26, 2014 at 2:35

Im curious why you are using aplification. In my opinion simple cell voltage measuerement could look just like this (i drawed it only for 3 cells): This should give you acurracy probably below 0.5% + resistor tolerance, but you can compensate resistor tolerance in software.

This is how very acurrate cell measurement can be done

This is part of cell voltage measurement circuit from well designed 6 cell battery charger: You can find full version of this schematic here

LM324 amplifiers were used in very good Turnigy Accucell 6 and some other RC battery chargers in cell balancer circuits.

• Yes I thought of the first option too I gonna test it! I also saw that schematic but why that differential amplifier is more accurate than my configuration? Apr 26, 2014 at 3:35
• Im not saying thats more accurrate than yours. I've added this as "fully tested circuit". Notice that op-amps with dividers at inputs are powered from 5V. That simplifies power circuit (no need for 30V) and you have ADC input protection from overvoltage. Apr 26, 2014 at 3:52
• @Kamil Your second diagram had spawned a separate question: Differential op amp inputs beyond supply rail? Feb 28, 2016 at 1:39

I'm going to answer this even though an answer has been accepted because the problem is all about non-ideally matched resistors. Consider the situation where you have a perfect measurement amplifier and the battery (BAT5) voltage you are measuring is forced to be zero volts. BAT1 to 4 are all at 5V: - simulate this circuit – Schematic created using CircuitLab

Note that I've made R1 equal 101 kohm with the other resistors at 100kohm. If R1 were precisely 100 kohm, clearly the output of the Instrumentation amp would always be 0V. If you were measuring the lowest battery (R1 back to 101 kohm and Bat1 voltage at 0V), clearly the IA output would also be 0V (again).

However, with R1 at 101 kohm and measuring Bat5, the voltage on the inverting input is 9.95V whereas on the non-inverting input it is 10V and, the IA output will be +50mV (an error).

If Bat1 to Bat4 were doubled up so that there were now 8x 5V batteries, the output error of the instrumentation amp would become 100mV.

Offset errors and bias currents aside, if you don't use accurate resistors, expect inaccurate results. This also applies to the voltage dividers used in Kamil's answer.