Electronics > Projects, Designs, and Technical Stuff
Understanding this ADC resolution calculation
<< < (3/3)
ejeffrey:
The rms of a sinewave is 1/sqrt(2) ~ .707.  the absolute average is 2/pi ~ .637.  not the same at all.

You can do sqrt pretty fast if you don't need to handle full floating point resolution and range.  For a integer or fixed point you can just use a lookup table and do linear interpolation if you want.  That would only require a few additions and a single multiplication, plus a small amount of flash memory for the table.  But that probably isn't worth it for such a low speed application
Siwastaja:
Rerouter,

Summing absolute values is completely different than summing squares. The latter gives rms when you take sqrt of the sum. Which one you want to use depends on what you need, but they are not the same. Squaring puts more emphasis on large values.

Depending on instruction set, squaring (x*x) is likely faster, or at least not any slower than abs(x), hence if you want RMS, you don't even save time by calculating sqrt(sigma(abs)) instead.

If the window from which you calculate RMS is long, the sqrt operation is a small portion, even if your instruction set doesn't implement sqrt. Note, often you just compare things to a threshold, or log it somewhere; in these cases, you don't need to calculate sqrt. Square the comparison threshold instead. Or, calculate sqrt after logging.



On peak detection, do note that you don't want to detect infinitesimally short peaks, otherwise you are just measuring noise. For example, if you sample at 1MSPS, and want to actually detect 1ms peaks, you can average 1000 samples, then detect peaks. So specify your "peak length" first; don't try to detect peaks that are so short that they don't actually appear on the signal of interest.

Red_Micro:
See attached my circuit. This is my approach:

My CT is 1000 turns secondary. It has high sensitivity so I can read down to mAs.
For a range of currents: 5 mA to 500 mA, switch is closed, so the gain becomes ~62.
For a range of >500mA to 30 A, switch is open, the gain becomes ~1.

I have designed both ranges so that at max current level, the peak-to-peak voltage is not greater than 3V.

Doing some quick calculations:
For 10 mA through the primary, 10 uA secondary multiplied by the burden 30 ohms = 300uVrms = 424.26 uVpeak
Amplifying this: 424.26 uVpeak * 62 = 26.3 mVpeak
ADC count = 26.3*4095/3.3 = 33 counts

For 15 mA I get 50 counts. So there's a difference around 18 counts between 10 mA to 15 mA. Is it enough to deal with noise?

Overall, do you think I'm in the right path?

Kleinstein:
For just single ADC readings there can be noise in the 1 LSB range, maybe more. So 18 LSB for the 5 mA step is than not much but usually still well visible.

For the RMS readings one would have many more readings averaged, more like 10000 readings over 1 second. This would reduce the noise level nearly 100 times. So there should be no problem resolving better than 1 mA maybe even 0.1 mA.

However at low levels there can be an effect of external hum that can cause trouble at low low levels. So good shielding can be important if one really needs to measure low levels.
Navigation
Message Index
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod