ADC calibration for AC coupled inputs

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good day ladies and gentlefreaks,

 

I have used a common, or garden variety, method of 2-point linear calibration for ADC inputs on many projects in the past and it has served me well.  Now I find the old grey matter is a bit stretched to apply the same, or similar, technique for AC coupled inputs.  With AC coupling I cannot simply apply a (DC) calibration source to the input at each of the 2 cal levels and take the readings as they will settle back to (say) half-rail or zero reference point.

 

I was considering applying a known AC signal level (at appropriate frequency to pass thru the analog front-end) and use the system's calculated level as a single point (the system does perform an rms calc anyway). Perhaps 2 points are still required but I figured if all is linear (and believe it should be if well within the pass-band) a 2nd point would only give me the same information.

 

Or instead is it necessary to inject the 2 DC levels (old style 2-point cal) at a test-point downstream of the AC coupling?

 

Not sure if I'm on the right track here or thinking about it in completely the wrong way.

Can anyone provide any direction/guidance/experience?

 

Thanks,

Steve

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With a simple high pass filter algorithm you can nullify any dc offsets, then you only need to calibrate for gain. What would be the lowest frequency you want to measure?

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano wrote:
With a simple high pass filter algorithm you can nullify any dc offsets, then you only need to calibrate for gain.

That's a good point and I suspect reason for some of my confusion. As the signal is AC coupled, its already HP filtered. The DC is removed.

With the old (DC coupled) 2-point cal method, a correction for both gain and offset is achieved where as now I only really need the gain correction. (I think)

 

tpappano wrote:
What would be the lowest frequency you want to measure?

The system is measuring the response from a single frequency sine wave stimulus signal; 1kHz. I expect this would also be an appropriate frequency for any calibration signal if not the best option.

 

One thought was to take a peak reading as one of the points, i.e. I know the Vpeak of the injected signal, this should correspond to the peak ADC reading. However, there is no certainty that I sample at the precise peak of the wave. (I'm sampling at 10kHz btw)  Is there perhaps a reconstruction technique/algorithm that can reasonably deduce what the peak sample would be? Like a sample rate up-conversion or something?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but I figured if all is linear (and believe it should be if well within the pass-band) a 2nd point would only give me the same information.

Well no, if you apply a 2V AC signal, you will (should) read 2V.   Then you apply 4VAC & will (should) read 4V...if you instead read 2.12 & 3.95 volts, then you have a calibration to do!  

 

Note you can read pk-pk, RMS, pk, etc to define what you mean by "measuring ac"     Your question seems a bit confusing...are you already measuring AC voltages?  If so which type  of measurement are you performing?

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Thu. Jan 30, 2020 - 03:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What, exactly, are you trying to accomplish?

 

How accurate does your RMS measurement have to be, and how small of variations in amplitude do you wish to measure?

 

How fast does the input signal change value, and how often do you need to know the value?

 

Is your 10 KS/Sec sampling synchronized to the input signal's zero crossing or not?

 

Lots of questions...

 

If you know that the input signal is always 1 kHz, then one could use a zero crossing detector to know when the peak is going to occur, and take your sample at that time.

 

If your sampling times are "random" compared to the input signal, then the question is how far off from the peak can the nearest sample be?

If one draws a picture of the sine wave one can see the perfect positioning of the samples, and how far off the worst case sampling could be.

Taking the sin of the worst case sampling point tells one the maximum error in the measurement.

 

Since it sounds like you have some analog front end signal processing going on, (at least a DC blocker...), do you have a "spare" op-amp available?

Another approach would be to use a "Peak Detector", (one op-amp, a diode, a cap, and typically a resistor and an NFet to short the cap out to clear it's value before taking a new sample).

In this case the Peak Detector "holds" the peak voltage of the input signal for the ADC to then read its value.

 

The RMS value, for a sine wave input, without a DC component, is then 0.707 * Peak Value.

 

If the micro has an unused ADC input, then one might use that to measure the Vcc/2, (zero signal level), voltage.

Or one can measure Vcc/2 once with a voltmeter.

Or one can use Vcc as the Vref and the measurements all become ratiometric, (but one still needs to measure it for a real world voltage, i.e. was Vcc 5.0 V or 5.2 V, etc.).

 

If you do the analog signal processing on the front end, then the software becomes trivial.

A peak detector is likely easier to implement than a "good" zero crossing detector, as that requires a threshold level, which can again be done in hardware, or in software, or can be tunable.

The ZCD's performance ("accuracy") depends upon the threshold level and the noise in the signals, so sometimes a LPF is place before the ZCD...

 

If you want to do the processing all in software then that is certainly doable, also.

But if the signal sampling is not synchronized to the 1 KHz input signal then 10 kHz is a pretty low sampling rate to fine the "peak".

 

Lots of questions.  Lots of options.

 

JC

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 (the system does perform an rms calc anyway). 

Apparently OP is already measuring RMS voltage levels...just apply 2 different known AC signal levels & calibrate away.   

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

schtevo wrote:
However, there is no certainty that I sample at the precise peak of the wave. (I'm sampling at 10kHz btw)
A signal generator should have a sync signal output and input.

DAC clock?

sample clock?

10 MHz is common for sync among TME.

 

P.S.

AWG DAC | Analog Discovery 2 Reference Manual [Reference.Digilentinc]

Analog Discovery 2 also does FRA.

Network Analyzer | Analog Discovery 2 Reference Manual [Reference.Digilentinc]

DUT's AFE can be reviewed for completeness then measured and evaluated for preciseness and correctness (gain and phase)

Given a functional AFE response, measure and evaluate the software's response.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Apparently OP is already measuring RMS voltage levels...just apply 2 different known AC signal levels & calibrate away.

 

So my simplistic way of thinking isn't way off then? I simply apply 2 different Vrms input signals, note the 2 results from internal software processing and then (y2-y1)/(x2-x1) gives me my true (system) gain.

 

DocJC wrote:
Lots of questions...

I was thinking it was pretty simple and I was just missing some key idea/info say like above but let me elaborate a little more...

 

I am measuring a 1kHz signal at the input down to around 7mVrms. It is differential and there are multiple channels.

The AFE processing consists of passive AC-coupling (HP), and some LP filtering as well, followed by a differential input Mux, an Instrumentation Amp (with digital gain select) and finally a 2nd order MFB active filter that feeds the ADC.  XmegaE5 FWIW.

Technically the sampling is synchronised in that the 1kHz signal and the 10kHz sampling are both generated by the same micro. Just that no effort was made to set a precise or consistent phase between the 2. (For the RMS calc it was not necessary.)

Maybe unimportant, maybe not, but fairly slow result updates are perfectly fine. I have all the time in the world for processing. In the oder of minutes if necessary!

 

ATM I have used a scale or multiplication factor to convert the results into real values.  This is based on "known" or calculated gains. i.e. I know what the IA gain is set to (should be) and I calculate what the MFB filter gain is (should be).

This works OK-ish but there are component tolerances, etc to consider and at the moment I have issues with variations unit-to-unit.

Not unexpected for uncalibrated devices; I'm aiming calibrate these variations out to improve the repeatability.

I have taken results from a batch of about 40 units but haven't analysed them yet so no official stats.

 

Thanks

Steve

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So my simplistic way of thinking isn't way off then? I simply apply 2 different Vrms input signals, note the 2 results from internal software processing and then (y2-y1)/(x2-x1) gives me my true (system) gain.

gain (G) AND offset (O): Offset= O= Y1-GX1   or   O=Y2-GX2    G=(Y2-Y1)/(X2-X1)

 

Calibrated Result= O+ G*measurement 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Fri. Jan 31, 2020 - 03:25 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Technically the sampling is synchronised in that the 1kHz signal and the 10kHz sampling are both generated by the same micro.

Well in that case, you really don't need to sample at 10KHz (if you just do both at 1 KHz & maintain a steady phase ).  In fact, since the micro is generating the stimulus & could do synchronous detecting, you can easily make a  "lock-in" synchronous demod...which will allow you to detect microvolts of signal (of course withing the limits of the adc )  buried in volts of noise.  So you could see something that looks like a jumble of 1V random noise & nicely pull out your 1mv signal....it's amazing.

Now, I have no Idea if you need to even do such a thing. 

 

I was trying to find a specific article for you , with some specific example...but I couldn't locate it.. here are a few others...I'll look some more for te one I have in mind (or dig through boxes of paper looking for it)

 

http://server1.phys.utk.edu/labs/modphys/Lock-In%20Amplifier%20Experiment.pdf

 

https://gup.ub.gu.se/file/133300

 

https://www.semanticscholar.org/paper/Square-Signal-Based-Algorithm-for-Analog-Lock-In-Aguirre-Garc%C3%ADa-Romeo/2fd607d2c641cdce81b466a1f3060415dda4dd81

 

https://www.analog.com/en/analog-dialogue/articles/synchronous-detectors-facilitate-precision.html

 

from Oregon

https://ir.library.oregonstate.e...

 

https://pdf.sciencedirectassets.com/278653/1-s2.0-S1877705810X00108/1-s2.0-S1877705810005989/main.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEGMaCXVzLWVhc3QtMSJHMEUCIFM1xbwvVmO0R3NIGUIgrTop9UOs%2BKNp09sHarN%2FsvfyAiEAxvXx4jp%2FibU%2FVRN%2B7RTlMbIFJcv9G%2FUX7M91RIubM0IqvQMI%2FP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARACGgwwNTkwMDM1NDY4NjUiDItaRcTPto0MqKN%2FJiqRAxMbb5sVNQY0Dkk02WhnB42v5VapH5DXPm5Z513rJtTm%2BCmTPiWaidT6pTZzQemkxzEVkQenV5dvt6fW9%2B%2BO8bWkWPQZ%2FkSEmB0u0yzp6Wiar7E9DNG4ZJEpM%2F%2BOlZXMkWszPNtwv3m9f0hCCAOjLu2v%2FwqMxG3U25CYt1jbwx5xnKqbpvrSBP7dUhQz%2B%2FGuHeTvj7tPf7DazBGKm52vBv26CELkxsNtxvPYsCsKrgX19NfUoI%2BYjZB08TpsxumhxLPZP%2FGL9LRIG3KI5XI8PrUaakonjCrrKy%2BpGJ7z1v6Un%2ByeKESefDd74tOgmBRpGpoN7nllJ3cU7qjkxjKWD5BiqNV7Eagv3bHFAtFFCanO3XdNkZqjhfgGjcR%2FlmZDNwoP2cGMq%2Fb4wYs%2BnN2a1GQS420%2FrD1SAvfN%2BwtMCkZ8bcmHMnaXDPvdmxnyeJ3CMeyrGWna%2Bg2HmahvRF%2BH7r5m77Za%2FEfHCiBjaVzW91OJa27TzVxci3aJmKrkdAmVqulxFSOAVa%2F%2BIEq%2BViURX9iRMOywzvEFOusBO2Hmm1Il5gmCUEyLi665obUTWJ3VqD37%2Fpb1Ox7srEUq6XIGvGpPdy7ntCzRD5ylCrppacrh6uS3gXmmtAxwbKA7wD61PsK8nYV%2Ffn4z9hi6Wb3AD5J4fNBBbJP6Uk6dXibXxAfNdkjX89pBdJvAHnpXaqajzq4FX3kNCQyA9Qi3eh0DxlaQtpuZxfqlgab2fZZwQwm0hSALWGJ7Sz%2FuLBlbZ02PJy8I2H0WL2wuzFzTjQMlVgM1bxZuNx9%2FV%2FSQgyjWjYBsWOzWT8K284XOaCdCufexS0LqsAQjOl1OwHR04SjLkn%2F5BCAb8w%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200131T035409Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAQ3PHCVTY3ICQIQY2%2F20200131%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=91361a65a610f8359eb7ab9f05a9ab870a0237eeca4301c28bddf823f108d408&hash=6e5422de0f9b093d1011ab9fc738134d0b0dacc096910f9a139e6141a65d3dc1&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S1877705810005989&tid=spdf-8242a7da-283d-4f88-b19a-d28c888c3474&sid=5381589684f26044a25bb9155b8186b621c9gxrqa&type=client

 

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ah, I was thinking you were in the design and / or prototyping phase, I didn't realize you had a bunch of boards out in the real world.

So, so much for tweaking the AFE to make the RMS measurement easy, and to incorporate an auto-calibration capability.

 

You didn't mention the SW approach to measuring the RMS value.  If you aren't measuring the peaks, then one might guess that you are summing trapezoidal approximations based upon your 10 samples / period.  With a known, fixed, input freq that works, as one knows that the 10 samples are within one period of the waveform.  It would be interesting to see what the error rate is with only 10 samples / period, but that is a separate question.

 

I might, just for kicks, look at the input and the signal after the filters, (feeding the ADC), to see how much phase shift there is in the signal, (i.e. how long after the input signal's peak is the peak in the signal feeding the ADC).  As the micro generates the original 1 KHz sine wave, and you know the signal's phase shift from the AFE filters, you know when the peak will be present at the ADC input. 

I'd sample the input signal at that time and calculate the RMS value, (0.707 * Vpeak), and compare that to your present method of measuring the RMS value.  With the filters the signal feeding the ADC should be pretty clean, but if the system changes state slowly you could measure the Peak for several periods of the 1 KHz signal and average them.

 

But, you didn't ask about measuring RMS values, you asked about calibration.

 

You have a known, fixed, input frequency signal.  You have a known filter setup on your analog front end, and hence a known, (fixed) transfer function.  Mathematically one measurement ought to tell you the system's voltage gain.  In the real world you need to make sure you are operating within the linear region of the AFE, i.e. not near the rail on rail-to-rail op-amps, not saturating any inductors, not altering your signal with zener diode clamps, etc.  As long as you stay in the linear region, one gain measurement will factor in the variations between the filters on the various boards, and any differences on the instrumentation amp's gain, board to board.

None of that, however, will compensate for changes in gain as a function of the system's operating temperature.  Your filters will (likely) change with temperature, so you will want to calibrate your system at the temperature that the boards will be operating at, or at least be aware of this.

 

To verify the above, I would inject a know signal over a range of amplitudes into the input, and measure the output of the AFE, (input to the ADC).  Plot the graph, the gain should be constant, and independent of signal amplitude, but likely be slightly different board to board.

 

That would then confirm that you can build a simple dummy - tester that you can plug into the PCBs to perform one point calibration and move on.

 

Weekend project... (smirk)

 

JC

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
In fact, since the micro is generating the stimulus & could do synchronous detecting, you can easily make a  "lock-in" synchronous demod...which will allow you to detect microvolts of signal (of course within the limits of the adc )  buried in volts of noise.

Yes a while back, during the earlier stages of development, Russell had pointed me to the wonders of "lock-in" amplifiers.  Something I have noted to play with in the future.  Thanks for those links.

 

DocJC wrote:
You didn't mention the SW approach to measuring the RMS value.  It would be interesting to see what the error rate is with only 10 samples / period, but that is a separate question.

I'm doing the RMS calc from 1st principles, i.e. a root of mean of the sum of the squares.  I take this over 10 cycles with 10 samples/cycle.  Results are good.  Would have to dig up the official test results though.

 

DocJC wrote:
But, you didn't ask about measuring RMS values, you asked about calibration.

That's perfectly fine, Doc.  I appreciate that you have taken the time to ponder my issue from a broader perspective and respond with so much info.  As with all other respondents.
In fact I'n now considering the idea of auto-calibration you mentioned.  While the hardware is done and dusted (some 800 or so boards out there) another revision is not out of the question.
 
DocJC wrote:
None of that, however, will compensate for changes in gain as a function of the system's operating temperature.  Your filters will (likely) change with temperature, so you will want to calibrate your system at the temperature that the boards will be operating at, or at least be aware of this.

I am aware of temperature variation and fortunately the devices are in a fairly well controlled environment.  In fact, monitoring the temperature is part of the deal.  I could always compensate however I'd expect it unnecessary.

 

Thanks,

Steve

Last Edited: Sun. Feb 2, 2020 - 01:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm doing the RMS calc from 1st principles, i.e. a root of mean of the sum of the squares.

Note , if you are just using the value for some purpose (sound the alarm if the rms exceeds 23), you don't need to take the sloow square root.  In fact, you'd only have to take the sum of the squares, since that correlates with the mean, saving any division.

 

I was talking to someone who was getting a big headache a few years ago...they wanted to do something when the sine of some angle reached/exceeded 0.75.  I mentioned why not just check if the angle gets to more than 48.5 degrees?...they were quite relieved (since it was assembler).

 

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Sun. Feb 2, 2020 - 05:08 AM