Electrical – Converting Acceleration of ADXL335 data into displacement

accelerometercphysics

I'm currently using a ADXL335 chip two measure acceleration then converting it into a displacement. I'm wanting to measure the vetical (-z direction) displacement range of maximum 10cm, so quite small. I have read the data from the ADXL335 and converted it into "g's". I then numerical integrate (trapezoidal) it twice in order to convert the g's into displacement. I only want to measure the vertical displacement in the -Z direction.

Sample rate == 100Hz; using a 12 bit ADC; Vref == 3.3volts;

here is my CVI/c code:

//every sample (0.01 seconds)

acceleration = (((((adc - 2420)*3.3)/4096)/0.3)*-9.8);//subtracting 2420 to account for the acceleration due to gravity.

acceleration_1 = acceleration;

velocity = velocity_1 + (((acceleration+acceleration_1)/2)*0.01);

velocity_1 = velocity;

displacement = displacement_1 + (((velocity+velocity_1)/2)*0.01);

displacement_1 = displacement;

….//then I output the displacement data and have a condition to reset the values of the velocity and displacement to zero (when the acceleration goes positive as only need the vertically down direction).

My problem is that I'm getting incorrect values of displacement and my observation so far is that the faster the accelerometer moves the higher the displacement will be.

Would appreciate all the help i can get, been stuck on this problem for a while and not able to make sense of it.

I also tried using a High pass filter to remove the dc offset of the acceleration with no luck (The subtract works?). I also tried implementing another button to control when I integrate. For example integrate when the button is push and set the data values to zero when not pressed.

Hope my problem is clear, In essence my displacement output depends on the rate of acceleration and not the total distance.

Best Answer

Converting an Analog Accelerometer data into the distance is fairly difficult because of the offset involved in double integration causes drift as already told. Check this interesting presentation sensor fusion for further details.
As far as I know, this drift can be avoided by using Digital Accelerometers (with high sampling rates) and the double integration has to be performed using electronic integrators with appropriate filters at every stage to remove the offset as well as the low-frequency noise. Your ADC sampling rate looks very low! Use higher sampling rate and if you can design appropriate signal conditioning circuit at each stage, you might be successful with decent results!

Hope this gives little more insight into your problem:)

PS: I myself have investigated ADXL335 for using it for vibration measurement and have failed miserably. I had to standardize my values with optical vibration measurement.