ADXL345 Accelerometer
Information
I2C ADDRESS
- ADXL345 : 0x53
- ITG3200 : 0x68
Data Sheet
calibration data
- double a_xdata_Plus = 266.00;
- double a_xdata_Minus = -262.50;
- double a_ydata_Plus = 282.50;
- double a_ydata_Minus = -246.00;
- double a_zdata_Plus = 250.00;
- double a_zdata_Minus = -259.00;
Offset
- a_xOffset = 0.5 * (a_xdata_Plus + a_xdata_Minus) = 1.75
- a_yOffset = 0.5 * (a_ydata_Plus + a_ydata_Minus) =18.25
- a_zOffset = 0.5 * (a_zdata_Plus + a_zdata_Minus) = -4.5
Gain
- a_xGain = 0.5 * (a_xdata_Plus - a_xdata_Minus) / 255 = 1.04
- a_yGain = 0.5 * (a_ydata_Plus - a_ydata_Minus) / 255 = 1.04
- a_zGain = 0.5 * (a_zdata_Plus - a_zdata_Minus) / 255 = 1.00
Sampling
- a_x = (((a_xAccumulator / SAMPLES) - a_xOffset) / a_xGain);
- a_y = (((a_yAccumulator / SAMPLES) - a_yOffset) / a_yGain);
- a_z = (((a_zAccumulator / SAMPLES) - a_zOffset) / a_zGain);
Angle
- #define ACCELEROMETER_ANGLE_GAIN (90.0 / 255.0)
- x = (a_x - a_xBias) * ACCELEROMETER_ANGLE_GAIN;
- y = (a_y - a_yBias) * ACCELEROMETER_ANGLE_GAIN;
- z = (a_z - a_zBias) * ACCELEROMETER_ANGLE_GAIN;
Angle
- hdgV = atan2(a_x, a_z); Down 0 -> 1.5 -> 3.14 / Up 0 -> -1.5 -> -3.14
- hdgV = atan2(a_x, a_z) * 180/3.14159; Down 0 -> 90 -> 180 / Up 0 -> -90 -> -180
- angle_z = angle_z / cos(hdgV);
Quote:
reference
- http://w3.doshisha.ac.jp/japanese/graduate-thesis/2011_abstract/36100708.pdf
- http://usi3.com/index.php?title=Position_estimation_by_using_acceleration_sensor
- http://mclab.uunyan.com/lab/sixaxis/sxs007.htm
- http://www.robotsfx.com/robot/TriAxisSen.html
- http://wave2.iobb.net/pplog2/displog/24.html
- Low Pass Filter
- lowPassX += (valuesX - lowPassX) * k; k = 0.1
- lowPassY += (valuesY - lowPassY) * k;
- lowPassZ += (valuesZ - lowPassZ) * k;
- High Pass Filter
- rawAx = valuesX - lowPassX;
- rawAy = valuesY - lowPassY;
- rawAz = valuesZ - lowPassZ;
Please log in to post comments.