ADC output

Thread Starter

HEXbinazec

Joined Oct 2, 2013
7
Hey,

I need some help regarding ADC's.
How can i connect multiple ADC outputs and then take the average of them?

Regards,

HEXbinazec
 

ErnieM

Joined Apr 24, 2011
8,377
ADC typically means analog to digital converter. The output is a number in a register.

To combine them just add them together, then divide by the number of outputs you added together.
 

Thread Starter

HEXbinazec

Joined Oct 2, 2013
7
And, if you plan well, the divide is usually unnecessary.
Can't really follow that. The "definition" of average is the sum of all components divided by the amount of components so why would the division be unnessesary?

p.s thanks for the replies.
 

joeyd999

Joined Jun 6, 2011
5,287
Can't really follow that. The "definition" of average is the sum of all components divided by the amount of components so why would the division be unnessesary?
First, an A/D conversion is simply a digital representation of an analog signal. What the actual digital values mean is a matter of interpretation.

Example:

A 10 bit A/D, with possible values of 0 to 1023, has a full-scale analog input of 5 volts. Each A/D count represents a 5V/1024 increase in input volage, or about 4.9 mV/count.

Let's say I want to average 16 separate readings (either from the same channel, or, in your case, separate channels). I can add the 16 results, then divide by 16, giving me a resultant that has the same 4.9 mV/count.

Or, I can forgo the division and accept that my averaged value has 14 bits, with a range of 0 to 16383, and each incremental change represents 5V/16384, or 0.3 mV/count.

I then proceed with my arithmetic with the knowledge that the scaling factor is 0.3 mV/count rather than 4.9 mV/count. The division is avoided.

Usually, I do not depend on a single A/D conversion for a reliable value. Too many things can happen during the conversion time: random noise, a current spike, a transition on some other logic that causes some flipped bits, etc.

I like to run the A/D as fast as possible, and faster than necessary. I sum an appropriate number of conversions, and use the result as my "actual" conversion for later processing. This is called "oversampling" and has a number of benefits:

1. The S/N ratio of the converted signal increases by a factor of the square root of the number of conversions (*only* for uncorrelated noise).

2. The precision (number of bits) of the result is increased by a factor of log2n where n is the number of samples per sum.

3. The effect of occasional conversion errors is greatly attenuated. If one of, say, 64 samples is corrupted, it will have only 1/64th of the impact in the final answer than if I had used that value by itself.

4. I can arrange the number of sums so that the final answer makes more "sense" than the original values. For instance:

Say I have a 10 bit a/d and 5V input voltage range. The values from the A/D will be between 0 and 1023. Using 64 oversamples, the sum will be contained in 16 bits and range from 0 to 65535 (65472 in actuality...but who's counting?). Therefore, full scale is counted as 0xFFFF in hex. I can now call that value a fixed point fraction, with a range of 0.0 to 1.0 (0.999 in actuality). Simply multiplying that fraction by the value of "5" gives an answer that is equal to the input voltage! Easy peasy lemon squeezy.

Have fun.

Edit: Also, oversampling makes the design of your anti-aliasing filter much easier and less critical! *Big Benefit*
 
Last edited:

Thread Starter

HEXbinazec

Joined Oct 2, 2013
7
like that, Aha i get it. I'm familiar with oversampling and quantization noise etc. but never had much "real" experience with ADC's only theoretical. But thanks. I think this thread can be closed.

Thanks all! :D

HEXbinazec
 

joeyd999

Joined Jun 6, 2011
5,287
No, why'd you think that? I gave you a "thanks" :p I got my answer :)
Usually, close requests are made when forum rules are violated. I am happy that you got your answers, but there may be others who wish to comment further or ask for additional clarification.

I wasn't serious about "saying something wrong". I should have used the new sarcasm font :D. Sorry.
 

Thread Starter

HEXbinazec

Joined Oct 2, 2013
7
Yeah your right, though you see it very often that someone says this thread or something can be closed. But your right. sorry my bad.
 

joeyd999

Joined Jun 6, 2011
5,287
And, actually, I do have something further to add:

Be careful when you average (or sum) multiple channels, each with an independent input voltage. A proper average implies that each summed value has precisely the same "weight" for a given voltage.

This may not be the case!

For example, say each channel has a gain (perhaps the gain for each is the "same"), and each gain is programmed by fixed resistors. Each gain stage will have its own source of errors, and the resulting analog values may be quite different for each channel, even if provided with the same pre-gain input voltage.

In this case, the resulting average (or sum) *will not* be accurate, and the resulting total error will vary depending on the magnitudes of the input voltages of the various channels.

To solve this problem, each channel must be calibrated prior to conversion. Alternatively, each channel must be processed individually and digitally corrected prior to summing/averaging.
 
Top