I have a scenario that implies measuring 2 inputs: - voltage through a resistive divider - current through a hall sensor followed by opamp for offset, direction and scaling

In my software, each channel has it's own average factor. I plan to use a simple 2 points (MIN/MAX) calibration technique on each channel.

The problem is slightly more complicated since my sensor use a opamp that (may) have it's own gain offset errors. Moreover, the sensor itself vary with Vdd and for this effect I use ratiometric measurement: ADC and sensor share the same Vref.

For voltage measurement I use a simple resistive divider which isn't perfect (measured ratio it's quite different from calculated) mostly due to un-precise resistors used. But even when I'll use 1% will be some errors which I compensate with 2 point method above.

The question is where should I measure / apply the calibration data?

1. Calibrate once raw ADC data (offset and gain) and use for all channels

2. Use separate 2 points for each channel on entire paths:

• hall sensor -> opamp -> adc -> average for this channel -> apply calibration
• voltage -> divider -> adc -> average for this channel -> apply calibration

It all depends on what you are trying to calculate - if you are trying to calculate AC RMS values then having your software continually calculating the mean value of the two signals and using that in the RMS calculation gets rid of those pesky dc offsets and offset drift with temperature.

This just leaves you with gain calibration and this can be tricky if you haven't got highly stable potential divider circuits - I'd start by picking resistors with a 10ppm/ºC temperature coefficient - this then gets rid of that as an error but, your ADCs will have gain and non-linearity errors and these might drift with temperature. How you would counter these temperature effects could mean you ditching your current ADC and using a better ADC with the performance you want/need.

If you are wanting to measure dc levels then I'd use precision resistors and much better op-amps of the "zero-drift" variety AND design your hardware so you can do a "zero" measurement - you'll need analogue switches to do this and you'll need to do it on a regular basis.

It all boils down to what you want to measure and how accurate you want to be; neither of which are stated in the question.

• Thanks for valuable comment. The voltage isn't critical: it's a battery (12V) and I already acheived 0.01V resolution with 2 point calibration on 12 bit ADC. More problematic is hall sensor which has a narrow negative slope output. So I put a opamp to reverse the slope and rise up to 5V adc. But I'm afraid due to temperature, the "zero" after opamp will not be zero anymore. – user1973900 Feb 19 '14 at 13:01
• @user1973900 looks like you have to choose a better op-amp - AD have a range of "zero-drift" devices and so do TI and LT. – Andy aka Feb 19 '14 at 13:04

You will get best results by calibrating everything, separately on each input. So you need to store 4 numbers in EEPROM for calibrating two channels.

The really, really important thing is to make sure that nothing saturates under all possible conditions (maximum offset of op-amp, temperature etc.), especially if you are going to use the extremes of range for calibration (which is the more accurate way to do it). You should also apply sanity checks to the calibration (only allow a few percent gain trim, for example) in software.

Otherwise you'll potentially get enormous errors. One thing I've done in instrumentation applications is to calibrate at "Zero" and "FS" then check that the instrument is within tolerance at mid-scale.

As an enhancement, if you calibrate at mid-scale you can apply a spline or quadratic correction and get rid of first-order nonlinearity errors in the circuitry, but the same considerations apply. At some point, your calibration is limited by the error in your measurements (the applied signal will have some error and you have a finite time to make each measurement) so further calibration won't improve the result.