Low Pass Filter for Sensor

Hi Everyone,

I am working on a capacitive sensor. It used for sensing the sand compaction. Initially i will have some vol value and as sand gets more compact the vol goes on decreasing. I have to filter the noise present and then have to calculate the slope of the curve resulting from the sand compaction.

I have to use the arduino board for this one. Can anyone help me in getting started with this low pass filter first. Can i find some sample codes for the low pass filter? And how the slope of the curve can be calculate?

Thanks for any help!

What's a "vol value"? How fast do you have to take samples?

A low-pass filter is simply implemented as a resistor and capacitor before your A/D converter input: see here. The resistor and capacitor are chosen so that the equation F=1/(2*pi*R*C) is below the frequencies you want to filter out, and above the ones you want to keep.

You can also filter digitally by, for example, taking 128 readings then taking the average (easy to do by shifting the sum right 7 times), or median filtering.

Hi RuggedCircuits, Thanks for the reply.

The vol value is nothing but the initial voltage level when there is no sand. I have to remove the jitter present in the sampled values. As the sampled values are varrying frequently. I have to remove the jitter digitally just by using some code in the programe. I think your suggestion of taking the more saples say 10 and then taking there average will be helpful. Using that code i moght be able to get some stable readings.

Thanks for the help.