Changing range of GY521 accelerometer

Hello, I am working on using two GY521 accelerometers to read data. I have both of the accelerometers working but I am unable to switch the measurement range from +-2 to +-8 gs. Here is the data sheet: https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf See page15.

This is what I am attempting: I am writing to register 0x1C which is the accelerometer configuration register and setting the AFS_SEL value to 2 which corresponds to +- 8gs. I also am able to request the value of AFS_SEL at 0x1C to confirm that it took the change and it does confirm that I changed it to 2; however, when I test the accelerometer I get the exact same outputs and same limits as when the accelerometer was set to 0 (+-2gs).

See pictures: I am shaking the accelerator and easily clipping the reading when set to 0, 2, and even 3!
0:


2:
3:

Thank you in advance for any help!

Here is my code (based on the example code)

#include<Wire.h>
const int MPU=0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){
Wire.begin();
Wire.beginTransmission(MPU);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);

Wire.beginTransmission(MPU);
Wire.write(0x1C);
Wire.write(3);
Wire.endTransmission(true);

Serial.begin(9600);

Wire.beginTransmission(MPU);
Wire.write(0x1C);
Wire.endTransmission();
Wire.requestFrom(MPU,1);
Serial.println(Wire.read());

Serial.println("Time,XAxis,YAxis,ZAxis");
}
void loop(){
Wire.beginTransmission(MPU);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU,10,true);
AcX=Wire.read()<<8|Wire.read();
AcY=Wire.read()<<8|Wire.read();
AcZ=Wire.read()<<8|Wire.read();
// Serial.print(millis()); Serial.print(","); Serial.print(AcX); Serial.print(","); Serial.print(AcY); Serial.print(","); Serial.println(AcZ);
//Serial.print(AcY);
Serial.println(AcZ);
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.