I've two identical GY-291 / ADXL345 sensors. To read the data I use the python-module (https://pypi.org/project/adxl345/). i2cdetect
detects the sensors at address x53 correctly.
Unfortunately, data for all axis are way off. z stays always constant at 20 m/s^2 and x and y are measuring pitch and roll correspondingly but are way off. For example, if I place the sensor horizontally on the table the x = -5, y = -11, and z = -20 for one sensor and x = -10, y = -11, and z = -20 for the other one.
I've tried the libraries from Pimoroni and Adafruit but to no avail.
I've checked the code on the chips and it reads 345B **** **** PHIL. So, I guess it should be an Analog Devices ADXL345.
Q Any ideas to get the sensors on track?
Edit
Say for sensor A:
z-axis aligned vertically, static
- x-axis = -5 m/s^2 (offset by 5 m/s^2)
- y-axis = -11 m/s^2 (offset by 11 m/s^2)
- z-axis = -20 m/s^2
x-axis vertically, static
- x-axis = -15 m/s^2
- y-axis = -11 m/s^2
- z-axis = -20 m/s^2
y-axis aligned vertically, static
- x-axis = -5 m/s^2
- y-axis = -20 m/s^2
- z-axis = -20 m/s^2
Even when accelerating or decelerating, the sensor's z-axis reads constantly 20 m/s^2.
Edit 1
- black is connected to rPi's ground
- red is connected to rPi's 3V3 pin
- SCL and SDA are connected to the rPi accordingly
- the chip reads 345B #029 4218 PHIL
Edit 2
Results for http://abyz.me.uk/rpi/pigpio/code/i2c_ADXL345_py.zip
x y z
z-up: -127 -282 1299
z-down: -110 -264 762
y-up: -125 43 1017
y-down: -128 -594 1043
x-up: 201 -277 1029
x-down: -448 -278 1034