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

Fix calculations of BMM150 #2376

Merged
merged 10 commits into from
Jan 28, 2025
Merged

Fix calculations of BMM150 #2376

merged 10 commits into from
Jan 28, 2025

Conversation

pgrawehr
Copy link
Contributor

@pgrawehr pgrawehr commented Jan 18, 2025

The calculated headings (both corrected and uncorrected) of the BMM150 Magnetometer where wrong due to an incorrect sign extension. The compensation functions also had sign errors.

Microsoft Reviewers: Open in CodeFlow

@dotnet-policy-service dotnet-policy-service bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Jan 18, 2025
src/devices/Bmm150/Bmm150.cs Outdated Show resolved Hide resolved
@Ellerbach
Copy link
Member

Hum, there is still something I don't get, as with the previous method, you were able to really have a great space repartition (see the pictures). If you don't apply a proper calibration like this, you'll mainly get improper numbers. Unfortunately, on other platforms and in the samples online, the calibration is most of the time not done properly.
So, please generate a similar diagram with all the 3 axes and please make sure you really get them centered.

@pgrawehr
Copy link
Contributor Author

Hum, there is still something I don't get, as with the previous method, you were able to really have a great space repartition (see the pictures). If you don't apply a proper calibration like this, you'll mainly get improper numbers. Unfortunately, on other platforms and in the samples online, the calibration is most of the time not done properly. So, please generate a similar diagram with all the 3 axes and please make sure you really get them centered.

A calibration is only possible if you know what the values should be, as with this sensor, the expected reading when not in motion is not 0 (we can't switch off the earth's magnetic field). So to properly calibrate such a sensor, you need some kind of reference, E.g. a GNSS sensor and an attitude sensor. I've started to investigate into this topic, but that is a lot of math and I couldn't find the proper practical documentation on this yet. In either case, that's something that needs a separate PR.

@pgrawehr pgrawehr merged commit 9b7972d into dotnet:main Jan 28, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants