-
Notifications
You must be signed in to change notification settings - Fork 91
Magnetometer always zero, Accel + Gyro working fine #72
Comments
I had that issue with the magnetometer on one of the ones I ordered. The device I ordered was defective. ordered a new one and ran my same code a few days later and it worked |
I will have to disagree with you on that @Chrisrdouglas , I managed to write a code that works consistently well, and another that has that problem on the exact same setup, I have no idea why that really happens but it seems to be a timing issue. I am curious tho to see if the working code works constantly on multiple platforms as I'm using the esp8266 rather than the Arduino nano so @darrenrahnemoon I would like you to try it and see if it does work for you and tell us about it. working code #include <Arduino.h> #define I2CADDRESS 0x68 MPU9250 mpu; float ypr[3]; void setup() { Serial.begin(115200); } Serial.println("Accel Gyro calibration will start in a sec."); } void loop() { if (mpu.update()) { } |
Oh, that's interesting! So if it was a timing issue then would that only affect the values for the magnetometer? Or would the values for the gyro and accelerometer be affected as well? |
@Chrisrdouglas that is a great point. |
So when I ran the calibration code it was on a Teensy 3.2 and I used the calibration.ino file. I didn't do anything fancy with it at that point. That's when I discovered that the magnetometer was just reading all zeros. The second one I got worked flawlessly. I think that's all the information I have for ya. Here's the one I purchased: http://www.hiletgo.com/ProductDetail/1953399.html |
Maybe related to #52 |
I am closing this is not a problem for the library (the device is not real MPU9250). |
hi how to check, the value (x,y,z) from the magnetometer sensor is correct reading or not? |
Yse I'd verify the output by moving a magnet near one of the sides and seeing how it affects the value. if it goes up while the magnet gets closer then i would assume that means you got a good one |
Hi guys,
I have the following code:
When I run this I do get some values for the accelerometer and gyroscope. However my magnetometer doesn't return anything (always returns to zero).
Sample:
My roll, pitch and yaw are also always stuck at 0, 0, -7.51.
I am running the calibration sequence (for mag moving it around the path 8 when calibrating) every time but still no results. Any clue as to what I am doing wrong?
I am also getting some values for the bias when I print them so it's still doing something.
My hardware setup is an Arduino Nano with its A4, A5 being connected to SDA, SCL of the module
The text was updated successfully, but these errors were encountered: