- Top Results

See all results

- Bosch Sensortec Community
- :
- Discuss
- :
- MEMS sensors forum
- :
- Reading BMM150 head

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

04-06-2021
01:18 PM

04-06-2021
01:18 PM

Reading BMM150 head

Hi

I'm using the BMM150 to get earth compass read

How to convert the X,Y,Z values to 0-360 compass heading read?

Do I need to calibrate the BMM150 to improve the readout values?

I set the following configuration using i2c:

Register 0x4B Value 0x01 (Power)

Register 0x4E Value 0x87 (Enable Data Ready bit)

Register 0x4E Value 0x4C(Normal mode)

Reading sequnse + parsing raw data:

When Data Ready Status bit is 1 read 6 byte from register 42 into buffer

x_raw[0] = (buffer[1] << 5) | (buffer[0] >> 3); // x

y_raw[1] = (buffer[3] << 5) | (buffer[2] >> 3); // y

xyHeading = atan2(x_raw[0], y_raw[1]);

if(xyHeading < 0)

xyHeading += 2*PI;

if(xyHeading > 2*PI)

xyHeading -= 2*PI;

deg = xyHeading * 180/PI;

I getting the same problem with every read call and the deg is alyaws 45 degrees regardless the location of the sensor in space.

Appreciate any help

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

04-06-2021
07:36 PM

04-06-2021
07:36 PM

Re: Reading BMM150 head

Hi,

Thanks for your inquiry.

If you want to implement an eCompass in 3D space, then you need a 3-axis accelerometer to work with BMM150. If you only rotate the eCompass on a flat leveled surface in 2D, then you don't need the accel.

For 2D eCompass, you can do the following:

(1) Get BMM150 x/y/z values in the unit of uT from the API source code online at https://github.com/BoschSensortec/BMM150-Sensor-API. Or you can refer to the attached "bmm150-step-by-step-temperature-compensation-sample.pdf" about how to convert BMM150 raw signed integers to uT values.

(2) After you get BMM150 x/y/z values in the unit of uT, then you can rotate your device clockwise or counterclockwise a few rounds slowly to collect BMM150 data.

(3) Then you can plot BMM150 x/y data in x-y plane. It should look like a circle shifted from the origin. Now you can determine the offset x0 and y0 so that you cam move the shifted circle to the center.

(4) Now you can use your formula below every time when you get the new BMM150 x/y/z data in the unit of uT:

xyHeading = atan2[(x_raw-x0), (y_raw-y0);

if(xyHeading < 0)

xyHeading += 2*PI;

if(xyHeading > 2*PI)

xyHeading -= 2*PI;

deg = xyHeading * 180/PI;

For 3D space tilt compensated eCompass, you can find a lot of articles online about how to do it.

Thanks.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

04-20-2021
08:19 AM

04-20-2021
08:19 AM

Re: Reading BMM150 head

Did not quite understand from witch registers I'm getting this parameters

Also correct me if I'm wrong - the offsets x0 and y0 is the Bx and By from bmm150-step-by-step-temperature-compensation-sample ?

Another question -is it necessary to tilt and rotate the sensor back and forth on every axis?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

04-20-2021
06:26 PM

04-20-2021
06:26 PM

Re: Reading BMM150 head

Hi,

Please see the attached another document "BMM150_temperature_compensation.pdf" regarding the location of each parameter from dig_x1 to dig_xyz1 from each BMM150's internal NVM.

Bx, By are the temperature compensated BMM150 data in the unit of uT based on the BMM150 raw data (signed integers) and the parameters from dig_x1 to dig_xyz1 and the formula. If you rotate BMM150 on a flat surface slowly in 2D plane, you will collect a lot of data points of [Bx, By]. Then you can plot these data points on x-y plane. You will find that these data points will form a circle or an ellipse with the center shifted from the origin [0uT, 0uT]. You can develop an algorithm to determine the center of the shifted circle for example. The coordinate of the center is [x0, y0]. After you subtract [x0, y0] from each data point of [Bx, By] , you will find that the circle is now centered at the origin of [0, 0].

Similarly, if you rotate BMM150 in 3D space slowly with Figure-8 motions, you can collect a lot of data points of [Bx, By, Bz]. After you plot these data points in 3D you will find out that these data points will form a sphere or an ellipsoid with the center shifted from the origin [0, 0, 0]. Then the offset will be [x0, y0, z0] so that you can subtract it to each data point and future data points so that the sphere or ellipsoid is centered at origin.

Thanks.

- Top Results

See all results