-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Different gyro value at startup and after reset #1
Comments
Hello and thank you for reporting the issue. Did you try to use the same MPU and another micro-controller? Or similarly did you try with the same micro-controller but another MPU6050 library? This library is based on the Tockn's one. You could try with his library and see if the problem persists. It might help to narrow down the origin of the issue (micro-controller, MPU or library). Kind regards, Romain |
Hello, thank you for your answer. I didn't try with an other µc. I only tried with different esp32 devboard (but all being esp32 onboard). I'm feeling like it's related to the µc but i can't find why. I'll do some tests next week and keep you in tuch. Thibaud |
On my side I tried the code with an Arduino Uno and Nano, maybe there is a compatibility issue with ESP32. The error I may think about in the The strange part is that your issue happens on powering on, and not on resetting... Romain |
I don't think the problem is directly in the calcGyroOffsets( ) because in fact, values wich are read in it (with : wire->requestFrom((int)MPU6050_ADDR, 6);) are twice bigger at startup than after a reset. So wrong gyro offset are more a consequence of an other problem. It seems that calling twice "begin()" function is resolving my issue ! (but no one of the reset function resolved this). To resume : BUT mpu6050.begin(); |
Thanks for the trick of calling |
Hi, WiFi-Setup.WiFi-Mode: Client --------------- CUT HERE FOR EXCEPTION DECODER --------------- Soft WDT reset
ctx: cont --------------- CUT HERE FOR EXCEPTION DECODER --------------- ets Jan 8 2013,rst cause:2, boot mode:(3,7) load 0x4010f000, len 3584, room 16 WiFi-Setup.WiFi-Mode: Client TEMPERATURE : 36.50 TEMPERATURE : 36.50 TEMPERATURE : 36.50 TEMPERATURE : 36.50 |
The library seems to have issues with ESP. Did you try with the Github jrowberg or tockn libraries? Since my library is based on the Tockn's one, you might get same kind of errors, however you might be able to make it work with other libraries. Please tell me if one of these libraries work. It might help to narrow down the issue |
Some hints are discussed in this issue of the Tockn library |
Hello Rfetik. I had the same problem using an Arduino Uno. I found that in the power up the GYRO_CONFIG register contains the value 0x0 after the MPU.begin (), indicating a 250 degree /s scale. When resetting, the GYRO_CONFIG register will have a value of 0x8 after MPU.begin (), indicating the correct scale of 500 degrees /s. |
Hello augustosc, setGyroConfig(gyro_config_num);
setAccConfig(acc_config_num);
byte status = writeData(MPU6050_PWR_MGMT_1_REGISTER, 0x01); // check only the last connection with status to byte status = writeData(MPU6050_PWR_MGMT_1_REGISTER, 0x01); // check only the last connection with status
setGyroConfig(gyro_config_num);
setAccConfig(acc_config_num); Please also disable your trick of setting Kind regards, Romain |
Hi rfetick Wire.begin();
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXX read registers before MPU.begin()
BT.println("Registers before mpu.begin()");
readReg = mpu.readData(pwwgmgtReg);
BT.print("PWR_MGMT_1 --> 0x");BT.println(readReg);
readReg = mpu.readData(configReg);
BT.print("CONFIG --> 0x");BT.println(readReg);
readReg = mpu.readData(smplRtReg);
BT.print("SMPLRT_DIV --> 0x");BT.println(readReg);
readReg = mpu.readData(gyroConfReg);
BT.print("GYRO_CONFIG --> 0x");BT.println(readReg);
readReg = mpu.readData(accConfReg);
BT.print("ACCEL_CONFIG --> 0x");BT.println(readReg);
//-------------------------------- initialize MPU6050
BT.println("inicializa MPU6050");
byte status = mpu.begin();
BT.print(F("MPU6050 status: "));
BT.println(status);
while(status!=0){ } // stop everything if could not connect to MPU6050
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
// XXXXXXXXXXX read registers after MPU.begin()
BT.println("Registers after mpu.begin()");
readReg = mpu.readData(pwwgmgtReg);
BT.print("PWR_MGMT_1 --> 0x");BT.println(readReg);
readReg = mpu.readData(configReg);
BT.print("CONFIG --> 0x");BT.println(readReg);
readReg = mpu.readData(smplRtReg);
BT.print("SMPLRT_DIV --> 0x");BT.println(readReg);
readReg = mpu.readData(gyroConfReg);
BT.print("GYRO_CONFIG --> 0x");BT.println(readReg);
readReg = mpu.readData(accConfReg);
BT.print("ACCEL_CONFIG --> 0x");BT.println(readReg);
BT.println(F("Calculating offsets, do not move MPU6050"));
mpu.calcOffsets(); // gyro and accelero
heading=leAngulo();
BT.print("Heading: ");BT.println(heading); 2-I did and registered tests without changes in the library. Watch, Watch, after the reset, the values of the registers after mpu.begin (): I edited the log below just to indicate by arrows the test points and the relevant results Received Log :
3-I made the changes you suggested in MPU6050_light.cpp and redid the tests. As the log shows, the change you propose solves the error (congratulations). /* - suggestions rfetick
writeData(MPU6050_SMPLRT_DIV_REGISTER, 0x00);
writeData(MPU6050_CONFIG_REGISTER, 0x00);
byte status = writeData(MPU6050_PWR_MGMT_1_REGISTER, 0x01); // check only the last connection with status
setGyroConfig(gyro_config_num);
setAccConfig(acc_config_num); */ Received Log :
4– I would like you to evaluate another proposal to resolve the error. /* - suggestions augustosc */
byte status = writeData(MPU6050_PWR_MGMT_1_REGISTER, 0x01); // check only the last connection with status
writeData(MPU6050_SMPLRT_DIV_REGISTER, 0x00);
writeData(MPU6050_CONFIG_REGISTER, 0x00);
setGyroConfig(gyro_config_num);
setAccConfig(acc_config_num); I did new tests with this change and found that Received Log :
5-These are the results of the test you requested. Sincerely |
Thanks for these great tests. I will implement you point number 4 and check it on my own hardware. Kind regards, Romain |
Hi Romain |
Hi Romain,
Thank you to try point 4. Please, give me feedback. I think it is not necessary the pull a request. I hope the changes work well.
Best regards
Augusto
… Em 24 de jan. de 2021, à(s) 10:47, Romain JL. FETICK ***@***.***> escreveu:
Thanks for these great tests. I will implement you point number 4 and check it on my own hardware. You can also open a pull request on github with your modifications, if you prefer.
Kind regards,
Romain
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Hello, I implemented your changes and it worked also on my Arduino! I committed the changes on the library on github (it is available for download). However it is not available yet on the Arduino library manager, I will push it soon for a new release. I will let the issue open for some time to see if it helps for anyone, especially with ESP32 microcontroller. Thanks again for your help, Romain |
My pleasure to be able to help. Thank you |
Hi there,
I'm using esp-wroom32 and i just noticed that when we turn the power ON (from usb or from a battery) calibration coefs are 2x higher than what they should be. measurments are also 2 times higher.
When i reset the board via the reset bouton, calibration coef are goods, 2 times less than before. Measurments are perfect.
This behavior is hapening every time.
exemple :
when i turn it ON it's : (coefX = 4 / coefY = 2 / coefZ = 2)
Each time i reset it's : (coefX = 2 / coefY = 1 / coefZ = 1)
I tried to reset the MPU, only the gyro etc... but nothing works. I'm not sure if it is related to the mpu or to the ESP32 but i never had this kind of problem with other i2c device (nor icm20948 nor mpu9050...)
Thank you,
The text was updated successfully, but these errors were encountered: