Skip to content
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

Unexpected X, Y value range when run upside down #6

Closed
daara-s opened this issue Jan 8, 2021 · 3 comments
Closed

Unexpected X, Y value range when run upside down #6

daara-s opened this issue Jan 8, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@daara-s
Copy link

daara-s commented Jan 8, 2021

Hi,

I have an MPU6050 breakout board mounted on a Teensy 3.2.
The GetAngle example program runs fine, but when starting the program with the MPU6050 upside down the X and Y values only have a range of -25 to 25 (when rotated by 90° in either direction). Z values are unaffected.

Is there a calculation I should apply to get expected value ranges, or would this be a library specific issue?

@rfetick
Copy link
Owner

rfetick commented Jan 9, 2021

Hello Daara-S,

The calibration has to be performed when the MPU6050 is in upside-up position (and not upside-down)!!! If you do so with your MPU upside-down, the accelerometer reads approximately +1g on the Z axis, whereas it should be -1g (multiplication by -1 of the values, whereas the calibration supposes only an offset).

What you can do: Save the calibration whereas the MPU6050 is upside-up, and use these calibration values when it is started upside-down. The library will state that your MPU is upside-down, but with correct angular ranges. Tell me if this solves the issue.

What I can do: Add a upside-down mode that reverts the Z axis. So your MPU6050 can work upside-down as if it was upside-up.

Kind regards,

Romain

@rfetick rfetick added the enhancement New feature or request label Jan 9, 2021
@rfetick
Copy link
Owner

rfetick commented Jan 9, 2021

I just added a new feature to manage upside-down mounting. Please download the new library from github. Don't update the library from the Arduino library manager (in case you use it) since I didn't push the new version yet on the Arduino library manager.

Then have a look at the the new getAngle.ino example. There is a line to uncomment to manage upside-down mounting. The MPU6050 will behave as if it was mounted upside-up.

Please tell me if this solves your issue.

Romain

@daara-s
Copy link
Author

daara-s commented Jan 9, 2021

Hi Romain,

Thank you for the quick response, as well as the quick fix. The new feature works perfectly, I'm getting the same expected response as when the sensor is the right way up.

Best wishes,
Daara

@daara-s daara-s closed this as completed Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants