Hi,
Arduino suggest this tutorial for ADX__:
http://arduino.cc/en/Tutorial/ADXL3xx
I tested my ADXL203/ADXRS401 IMU board from SparkFun using some minor changes to code:
ixacc = analogRead(xPin);
iyacc = analogRead(yPin);
xacc = ((float) (ixacc - 510))* 5 / 1024;
yacc = ((float) (iyacc - 510))* 5 / 1024;
printFloat(asin(xacc)*180/PI,2);
printFloat(asin(yacc)*180/PI,2);
and keeping the arrows of each sensor axis at a time, along with the axises of trigonometric circle:
http://www.cartage.org.lb/en/themes/Sci … x/gon1.gif
and got these output:
for sensor axis: Y
along 0 rad on the circle, ---->, gives: 660 pin-read, converting to degree using asin() after subtracting the offset of 510 gives: 57 deg.
along PI/2 rad on the circle, gives: 510 pin-read, converting: 0 deg.
along PI rad on the circle, gives: 330 pin-read, converting: -57 deg.
along 3*PI/2 rad on the circle, gives: 510 pin-read, converting: 0 deg.
That is something about +/- 57., but shouldn’t it be +/- 90 deg.?
for sensor axis: X
along 0 rad on the circle, ---->, gives: 510 pin-read, converting to degree using asin() after subtracting the offset of 510 gives: 0 deg.
along PI/2 rad on the circle, gives: 327 pin-read, converting: -65 deg.
along PI rad on the circle, gives: 510 pin-read, converting: 0 deg.
along 3*PI/2 rad on the circle, gives: 690 pin-read, converting: 63 deg.
That is around +/- 63, but again shouldn’t it be +/- 90 deg.?
Does this mean that the sensor is broken? I guess that now it is no more usable for applications like Kalman filtering with gyro for balancing robot right? Or may be there is any recommendation how to scale/adjust it in +/- 90 ?