Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BNO 055 calibrate using horizontal plane rotations only? And having to recalibrate too often.

    BNO 055 calibrate using horizontal plane rotations only? And having to recalibrate too often.


    Excuse me, I've bought some of your BNO 055 compass sensors for use in letting a robot navigate, is there any way to calibrate these (atleast calibrating the compass and accelerometer elements if not the gyro which I'm not using) by only rotating on a single plane?

    I've mounted the boards on a robot and therefore it can spin on the spot with it's wheels, and it can because of it's design manage a deliberate and controlled 10 degrees of back-forth pitch, but it can't by itself do anything to rotate the compass board in ALL 3 axes. All it can do is a fast spin clockwise or anticlockwise about the vertical axis (normal to the PCB on which the BNO 055 chip sits), or slowly do a 0 to 20 degree pitch range about the axis pointing parallel to the longer length side of the BNO 055 chip.

    I don't need accuracy on all three axes, just in the horizontal plane (my board is arranged on the robot such that the componentless side of the board has a normal pointing to the sky, and the other face of the board, where the chips are SMD soldered on to, has a normal pointing to the ground). As I don't need compass data in the other dimensions is there any way to calibrate well enough for use in the horizontal plane by using only movements in the horizontal plane?

    I have been using the adafruit bno055 library on an atmega328p, similar to an arduino uno but fitted with other components on a custom board, to interface over I2C to this sensor. I can work on modifying the library to add any extra features your BNO 055 datasheet describes which the library doesn't implement.

    I'm working in a situation where my robot must be able to find a globally determined heading relative to "north" for where-ever it currently is, it is NOT a problem in my application if where this north is changes with position, so long as it does so more slowly than 5 degrees of difference per metre of travel along the floor. So when travelling in a "straight line" it is ok if this straight line deviates by 5 degrees per metre, but  the robot would still need to have the same perception of where "north" is at a given location if it later returns to that same location.

    I think the device is operating in the NDOF fusion mode, with the faster, not needing full figure of 8, type of calibration enabled. I wonder if shifting to a non-fusion compass mode could help, or if this would leave the sensor useless for navigation. 

    In running test code to get the value from code doesn't print anything higher than a 1/3 for the magnetometer confidence until rotations on >=2 axes are made, it can get to 2/3 with some rotation about the vertical axis (that is to say staying on the horizontal plane) and a little bit of gentle tipping on one other axis, it refuses to reach 3/3 without the robot being hefted up and waved around in all directions. I wondered if there were any features on the BNO 055 which let you put it in to a horizontal plane mode, without having to get deeply involved with complex sensor fusion algorithms.

    Also, as my robot drives around, probably due to passing through different magnetic fields in the environment such as from steel structures under the floors, confidence sooner or later drops down again, and usually within a few metres and a very few minutes. The confidenc level does not manage to persist at the level it reaches after calibration for as long, even though I had thought that calibration remained from power-on of the sensor until power-off. I could well understand, and handle the resulting robot situation, if the presence of such altered field regions just caused local navigation confusion, but having to recalibrate is very bothersome.

    P.S. the board is in a robot, but I've been careful in the design and kept it well away from the robot's motors (which are small and low current anyway) and from any metal structural pieces, most of the robot is made from plastic, or high current wires. From checking around the robot using other tools I am confident that my motors should NOT in any way be interfering with the BNO 055. The BNO 055 is on a separate small daughter board from the other circuitry of the robot. The only metal, except header pins, anywhere near the BNO 055 is the end of an M2.5 screw 23mm away, and the side of another about 20mm away, this latter one could be removed if necssary.

    Thank you

    11 REPLIES 11

    I'll go ahead and try this, I had just been using the hand compass to check the environments I was testing the robot in and to ensure that motors at their current locations didn't cause significant problems at the relative location of the compass. I'll have a go at this and see if the needle reliably tracks north while the robot drives around. If it does track north fairly well though then I assume I WOULD be better going to magnetometer only mode, in which case is there an easy way to get the BNO 055 to serve as a magnetometer and output the 3 angles of the mag field, although I only need the horizontal plane one, for me to work with. Thank you

    A hand compass placed beside where the BNO 055 sits in the robot tracks north well for part of a rotation, but very badly during a section of it. So I think there is a significant hard iron distortion going on. It is my understanding that hard iron distortions can be compensated for by putting the outputs of an x-y-z magnetometer through a few functions for which calibration constants must be calculated once for the device but which then remain constant. Any tips on getting a BNO 055 to behave like this? I know that other magnetometers can give plain x-y-z without self-calibrating constantly, but the pinout means I can't swap easily. So if the BNO 055 can be made to act like a simpler chip then that might be my best option. I'd like to get uncalibrated x-y-z magnetometry and uncalibrated x-y-z accelerometry (the accelerometer never needed calibrating in practice anyway, always gave good enough readings throughout) data out of it. Any resources about doing this?

    To clarify, if I enter the MAGONLY or ACCMAG mode by sending the appropriate I2C command to the BNO 055 then once in such a mode it will act as a normal magnetometer and accelerometer? I can handle calibration entirely externally and all the BNO 055 will do in these modes is ouput x-y-z values for the magnetic field vector, as it measures it (I can run de-distortion anti-hard/soft-iron code on my own device so long as I can get simple magnetometer and accelerometer readings) and the same x-y-z for what it feels gravity to be (with whatever effects accelerations may have in making this one inaccurate, although the robot is fairly slow to accelerate and turn so i doubt the inaccuracies here will matetr much)? In those non NDOF modes I should never need to worry about the BNO 055 deciding on a new calibration valeu set, as it won't have one? In those non NDOF modes I should never need to worry of the risk that the origin about which the mag field is defiend suddenly jumps (the way that orientation outputs can when calibrations change in an NDOF mode)? And between multiple different BNO 055 chips, and over time, so long as my algorithm running on my device to de-distort compass data is good enough then multiple devices will agree on what is North?


    And although the BNO 055 contains a temperature sensor, slowly occuring chanegs in temperature shouldn't chnage anything about magnetometer readings so long as the actual magnetic field doesn't change?

    I really need to check if footnote 5 of page 48 of the datasheet "It is not possible to disable the automatic calibration which runs in the background" is still true, in any meaningful sense, when in a non-NDOF mode like ACCMAG or MAGONLY.

    Section 3.11.4 of the datasheet also talks of a soft iron calibration matrix, I assume in ACCMAG and MAGONLY modes that is not active, and any soft iron calibration, like hard iron, will be my problem to handle externally to the BNO 055? Some datasheets mention SIC matrices, some don't, I'm not actually sure whether the BNO 055 chips I've bought are more recent than the change on the datasheet. Either way, I assume this won't affect ACCMAG and MAGONLY modes in any way?

    If you can confirm whether all of the above is indeed the case then I am well on the way to solving my problems. Thank you

    Community Moderator
    Community Moderator


    Thanks for your inquiry.

    Yes, if you enter the MAGONLY or ACCMAG or AMG mode by sending the appropriate I2C command to the BNO 055 then once in such a mode it will act as a normal magnetometer and accelerometer. Sensor fusion is disabled and sensor calibration is also disabled. All you get from BNO055 is the raw data from the mag, accel and gyro.

    The footnote 5 of page 48 of the datasheet "It is not possible to disable the automatic calibration which runs in the background" is not true, in any meaningful sense, when in a non-NDOF mode like ACCMAG or MAGONLY. It is only true when you enter one of the sensor fusion modes.

    BNO055 has SIC matrix with default 3x3 identity matrix. If you know the SIC from your robot, then you can enter or input your SIC matrix to BNO055 so that the sensor fusion running inside BNO055 will take care of the soft-iron. Otherwise, BNO055 SIC is not used or it doesn't take any effect.


    Thanks for that confirmation, it gets me a long way to solving my issues.


    Can I ask for more details about what the different config options for the magnetometer in MAGONLY and ACCMAG modes do. The datasheet discusses a "power mode" an "odr" an xy and z repetition, and a resolution for the magnetometer, but doesn't give much details. Nor does it explain what other options can be set, or what the defaults actually are. The section on the magnetometer (3.5.4) mentions data output rates, operation mode and power mode, but these don't clearly correlate to the table in 3.5.1 which mentionbs ODR and repetition but not operation mode. What exactly do the different operation modes mesn "low power", "regular", "enhanced regular" and "high accuracy", what are the advantages and disadvantages to each mode (are the more accurate oens noiser, or slower refresh rates?)? And is there any reason NOT to set the data output rate as high as possible, reduced accuracy perhaps? and any reason NOT to set the operation mode the high accuracy?