Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMM150 confusion about compass orientation

    BMM150 confusion about compass orientation

    ullix
    New Poster

    I am using the BMM150 on a waveshare module (https://www.amazon.de/dp/B0C4TSB47S) under Python (code below).

    Data seem to be coming out ok, like:

    X:36.325 µT  Y:0.000  µT  Z:48.786 µT  Magnitude:60.825 µT Heading: 86.349 DEG

    The chip is oriented so that the X-direction (as printed on the PCB) is pointing due North.

    Selection_053.png

    I do expect this to give a heading of 0 (zero) degrees, yet it is giving 86.3°, which I take as 90°.

    Do I use wrong code, or am I mistaken on my interpretation?

    Code used:

            import numpy as np
            import bmm150
            device = bmm150.BMM150()
            x, y, z   = device.read_mag_data()
            heading   = np.degrees(np.arctan2(x, y))     

     

    2 REPLIES 2

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    The BMM150 data you got is so called raw data in the unit of uT. You cannot directly use these raw data to calculate heading. You need to performance BMM150 calibration by moving your PCB randomly in 3D space slowly. Please refer to a video clip at https://www.youtube.com/watch?v=yS0_EB4TIsA for more information. You may also do a Google search on magnetometer calibration online where you can find a lot of articles, libraries and source codes that you can use in your project.

    After calibration you can test heading on a flat surface without any metal stuff nearby. If you want to get eCompass in 3D, then you also need an accelerometer to work together with BMM150 to get tilt compensated heading.

    One more note is that BMM150 has been discontinued. You can find PDN document in this community. Please switch to new magnetometer BMM350. You can purchase a BHI360 shuttle board through Digikey where BMM350 is installed. You can then get accurate heading directly from BHI360 because the sensor fusion algorithm running inside BHI360 has already taken care of BMM350 calibration and tilt compensation. Please see the attached PDF file for more information.

    Thanks.

    Thank you. But I did the random moving in space well before I posted my question, and I don't want any more libraries, and I am using the chip flat on a horizontal question and I don't want 3D compensation, and my lib does have the temp compensation.

    And thanks for the marketing push for your new sensor, but for now I am using the BMM150.

    But you did not answer my only question: what should the heading readout b, when the chip is placed on a flat, horizontal surface, with the X-axis pointing north? Is it 0 degrees, or is it 90degrees, or anything else?

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist