# How to smooth analog data?

I am trying to read load cells data, but these values are very fluctuating. I have ADS1230 ADC and I had configured it to the internal gain of 128. Four half-bridge load cells are connected in a bridge configuration and the output of bridge is fed into ADC. BUt there is no way i can get stable reading. It would be great to know what i am missing here. Would EMI be the Cause here? Any suggestion would be appreciated.

It's likely that your input is simply quite noisy. Applying some form of averaging here is your best bet.

The simplest solution is to take n samples and average them together to produce a result. This divides your sampling rate by the number of samples you use per averaging interval.

Another option is to use a digital filter; the simplest to implement is a first-order infinite impulse response, and looks something like this:

accumulator = 0.9 * accumulator + input


Where input is the ADC reading. Each time you update the filter with a new reading, you're taking a weighted average of the new data and all the old data. To get the averaged result out, divide accumulator by the inverse of the weighting - in this case, 0.1, like so:

value = accumulator / (1 - 0.9)


The weighting value controls how much averaging you get, and how quickly results converge when there's a change to the input; in this case each value is 90% dependent on the previous state and only 10% dependent on the new reading.

If you pick weightings that are powers of 2 - eg, 1/2, 1/4, etc - you can execute this very efficiently on a microcontroller without needing expensive division operations. For instance, picking a weighting value of 1/16 (=6.25%), you can compute your accumulator like this:

accumulator = accumulator - (accumulator >> 4) + value


and get the result like this:

result = accumulator >> 4


Firstly, you need to lowpass filter the analog signal at a corner frequency significantly lower that the ADC's sample rate to avoid high frequency noise aliasing into the ADC conversion (which cannot be removed on the digital side).

The exact nature of the filter depends on the noise/interference, ADC sample rate and type. For example, a sigma-delta allows a single pole filter, but you may require a high order filter for a significantly noisy system with a SAR ADC.

Digital filtering is easily achieved with a digital filter of the type : $$y=(1-\alpha)x+\alpha y$$ where y is the output, x is the input and alpha is a value such as 0.9 or 0.99 (the closer to one that is, the more filtering you get).

• I am currently using RC filter. AS per your information what type of capacitors should i use for Low pass filtering. Moreover what values? – Arjun Jun 23 '15 at 11:34