Reliable tilt compensated compass system

Hello Friends,
I am looking for a reliable tilt compensated compass system.
The best I found is the BOSCH BNO085, but on the Bosch website they write:

''The BNO085 is the perfect choice for AR, immersive gaming, personal health and fitness, indoor navigation and any other application requiring context awareness.''

Are there some better chips on the market? more suitable for professional use?

Most of the modern 6 or 9-DOF sensors outperform that module. Open source code dramatically outperforms the built in firmware, too.

You have to calibrate the gyro and magnetometer carefully for best performance, which the BNO085 does poorly.

For a tilt-compensated compass you do not need the gyro.

Thank you for the replay jremington! Please can you give me a link or name of good and reliable 9-DOF sensor? And where I can find the open source code for it? Maybe my keywords are wrong.. can't find any usable information about this.., the best result what I got is this video - 9-Axis IMU LESSON 10: Making a Tilt Compensated Compass with Arduino - YouTube

I have used and recommend

Tilt compensated compass code is available for all of them, for example on Pololu's site (also here), and here for the Sparkfun module.

2 Likes

My indoor experience with compass modules is bad. Are there too many wires and iron to distort the earth magnetic field?

My experience has been fine indoors, in a wood house, as long as I stay away from magnets and large iron containing objects. That is often not possible for a roving vehicle, though.

Buildings with concrete walls containing iron posts or reinforcing bars may well be hopeless.

Once I got about 30cm above the floor in my home, a magnetometer worked ok but if it got anywhere near (<0.5m) the fridge it would go berserk.

No surprise there. Magnetometers can be used to detect vehicles passing by, over a distance of several meters.

jremington Thank you very much for so much information!
I am happy! Will try it!

I totally agree with jremington. A few years ago I started a boat autopilot project and obviously I needed an IMU. Did a research and BNO080 came out. I thought what a blessing, no need for complex AHRS code, everything's computed on the chip and with Sparkfun library it was extremely easy to get tilt compensated heading values into my code. Except… those values were wrong. No matter how carefully you calibrate the magnetometer the compass heading calculated by built-in firmware is off like 5-20 degrees depending of the direction… I ended up with three of these BNO080 modules and they all behave the same.

As my budget is quite limited I just do not want to throw them into the garbage bin yet. I can get the raw values of acc, gyro and mag from BNO080 easily via I2C. I have looked for a library that could calculate tilt compensated heading from those raw values, bypassing the built-in firmware. There are quite a few such libraries out there (also from jremington) but they all seem to be chip specific and as I am a beginner in Arduino programming I have not been able to modify the code to take raw values from BNO080.

So, please - does anyone happen to know about such a library / code? Thank you beforehand.

What library are you using? It is certainly possible to get the raw data values out of that sensor, but the library may not have a function to do so.

I use Sparkfun's library and that has functions to get raw accel, gyro and mag values also. But I have not found a library that would turn those raw values into tilt compensated heading.

Would you please take a look at this example from that library

That example is all you need to get started. The magnetometer needs to be calibrated (and for best results, also the accelerometer), and the raw data corrected accordingly.

Then you just apply the basic vector operations to create the compass. Code examples can be found in the links at the end of post #4.

Thank you, I will definitely try it before dumping those BNO080 modules. Hopefully it is possible to outperform the built-in firmware.

Hello Fred,
I faced same issue with a boat autopilot project as well. In my case I used BNO055 with in-chip fusion capabilities.
Calibration was unstable and it was impossible to follow a course for more than 5 minutes.
I am testing external fusion algorithms and my first tests (taking the system in a car) are good/stable , but still not tested in real boat situation.

Explanatory Web for AHRS systems with interesting 3D testing solutions (in spanish)

Arduino code compatible with many sensors (eg.BNO055)

ArduinoIMU

ArduinoIMU is the main demo sketch. It configures the IMU based on settings in RTIMUSettings.cpp. Change these to alter any of the parameters. The display is updated only 3 times per second regardless of IMU sample rate.
If using this sketch with the BNO055, RTFusionRTQF performs the fusion and the BNO055's internal fusion results are not used. Magnetometer calibration data, if present, is also not used as the BNO055 performs this onchip.

I hope this helps
Regards,
Sergio

Hi Sergio,

Thank you so much for your suggestion, I really appreciate it. I will definitely take a closer look at your links.

So I calculated heading value from the BNO080 raw magnetometer values. Before that I calibrated it of course. The heading accuracy was +-7 degrees. Better that from BNO080 fusion algorithm but still unacceptable. Apparently the magnetometer sensor of the IMU is not accurate enough.

So I decided to dump the BNO080 and started to look for a new and better sensors. There's quite a few to choose from. Combing the Internet for the info I stumbled to the AvionicsDuino project. They had used Adafruit LSM6DSOX + LIS3MDL sensor. I thought if it's good for avionics it should suffice my needs also and ordered a couple of them. BTW the whole avionicsduino.com site is very interesting material to read. I found especially enlightening the page dedicated to magnetometers and digital compass Digital compass - Open source software and hardware avionics.

I calibrated the LSM6DSOX + LIS3MDL sensors carefully and then compared the tilt compensated heading value to magnetic compass. And guess what - the accuracy was +-2 degrees. I am really very pleased with that result. Worth to mention that that was achieved with complementary filter only, have not tried any AHRS code yet.

As a result of my short tests the Adafruit LSM6DSOX + LIS3MDL sensor seems like a good choice and I am going to integrate that into my project to see how it holds up in real working conditions.

Kind regards,
Fred

Good job! Thanks for posting these encouraging results.

The Bosch BNOxxx modules are quite outdated and as you have confirmed, perform rather poorly.

I think that having a good hand compass can identify major problem spots.

I wore a brass belt buckle when I was out hiking cross country back in the day.

This thread recently popped up during a search, and I have been reading it with interest. I'm developing a device that needs precise tilts (pitch & roll). Yaw is of interest, but it's accuracy is not critical. I'd also like the ability to sense impacts from an accelerometer. It will be paired with an Arduino compatible (currently Adafruit Huzzah32) and custom water pressure (depth) sensor, then mounted on an inland river barge with solar/battery power. Years ago I started with the BNO-055, then shelved the project for a while, and recently have been playing with the BNO-08x. While I've still got a LOT to learn, I've come pretty far with the rest of the project and just need to zero in on the best IMU.
Seems several of you have worked extensively on similar issues. Would anyone recommend a specific IMU sensor with the best accuracy and resolution for pitch and roll? Thanks, Steve.
PS: My expected tilts will usually be single digits, and seldom exceed 15-20 degrees.

For static tilt measurements all you need is an accelerometer, and for highest accuracy it must be calibrated and requires extensive averaging. The market is competitive so the current crop all have pretty similar characteristics, but my favorite is currently the ISM330DHCX

Most thorough calibration tutorial: Tutorial: How to calibrate a compass (and accelerometer) with Arduino | Underwater Arduino Data Loggers