Code Monkey home page Code Monkey logo

Comments (8)

flybrianfly avatar flybrianfly commented on June 18, 2024

Can you post a picture of your sensor and setup?

from invensense-imu.

TahaMoncef avatar TahaMoncef commented on June 18, 2024

the Vcc pin is connected to the 5v of the arduino
the ground pin is connected to the ground of the 5v supply
SCL pin connected to A21 since i'm using Arduino mega 2560
SDA pin to A20
264242389_291054402957641_5169034461350391647_n
266013626_588758255754178_5104867685520513179_n

from invensense-imu.

flybrianfly avatar flybrianfly commented on June 18, 2024

Seems weird, the total acceleration is higher than it should be (i.e. around 12 m/s/s instead of 9.8 m/s/s). Also seems weird that you're not getting magnetometer data as often as I would expect. I would probably touch up the soldering, install the latest version of this library, and test while ensuring that the sensor is resting on a table.

from invensense-imu.

TahaMoncef avatar TahaMoncef commented on June 18, 2024

I thought about a potential solution: Taking few seconds when the code starts running to calculate the mean value of each sensor(on each axe) and then consider these "means" as an offset.
Then, I can simply compensate for the shift in the raw values by adding the missing values due to the offset.
However, I'm not so sure of this solution since I'm not aware if this offset is linear or not.
PS: i am using the latest version of the library.

from invensense-imu.

flybrianfly avatar flybrianfly commented on June 18, 2024

It's not the newest version of the library, we use a namespace and the class object isn't fully capitalized, which is different than the screenshot posted. I don't think it's the code, but helps to get on the same baseline for any troubleshooting.

You should absolutely calibrate it anyway, but my expectation would be that the value is closer to {0, 0, -9.8} at rest with the sensor z axis aligned with gravity. You could calibrate it by moving the sensor very slowly in a spherical motion and then doing a least squares estimate of the resulting data to get a bias and scale factor for each axis (exciting each axis with +g and -g enables you to get both a bias and a scale factor).

from invensense-imu.

TahaMoncef avatar TahaMoncef commented on June 18, 2024

Indeed, i was just trying to test multiple libraries, unfortunately i keep getting the same error even with this latest version.
One more thing, i've noticed another measurement error: the x-axis column and y-axis column measurements are swapped which i believe that i'm the only one getting this weird results.
Hence i think that there's something wrong either with my MPU or the camputer/ my arduino software.

from invensense-imu.

TahaMoncef avatar TahaMoncef commented on June 18, 2024

hello sir, so I bought a new MPU chip, and tried to do the soldering very carefully, this time it worked correctly.
One last thing, do you have any sort of documentation or guide to calibrate the magnetometer, I'm trying to build up a compass, and all that is left is to calibrate the magnetometer?
Thank you for your help.

from invensense-imu.

flybrianfly avatar flybrianfly commented on June 18, 2024

You'll want to slowly move the magnetometer so that each axis traces a sphere while recording data (this ends up being kind of a figure 8 shape that you may be familiar with from calibrating the magnetometer for phone apps or a smart watch). Then use a least squares method to find a scale factor and bias for each axis to fit the data to a sphere. That's it! You'll need to re-calibrate any time the electromagnetic environment changes.

There's also a bunch of web pages with instructions and video demos if you search for "how to calibrate a magnetometer".

from invensense-imu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.