The latest development version of this page may be more current than this released 1.14.0 version.

BMM150 Geomagnetic Sensor

Overview

This sample application periodically reads magnetometer (X, Y, Z) data from the first available device that implements SENSOR_CHAN_MAGN_* (predefined array of device names). This sample checks the sensor in polling mode (without interrupt trigger).

Building and Running

This sample application uses an BMM150 sensor connected to an Arduino 101 board via I2C. Sensor has multiple pins so you need to connect according to connection diagram given in bmm150 datasheet at page 41. There are two processor cores (x86 and ARC) on the Arduino 101. You will need to flash both this sample’s code on the ARC core (using the arduino101_ss board target), and stub code on the x86 core (using the arduino_101 board target), as shown below.


# On Linux/macOS
cd $ZEPHYR_BASE/samples/sensors/bmm150
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\samples\sensors\bmm150
mkdir build & cd build
cmake -GNinja -DBOARD=arduino_101_sss ..
ninja flash
# On Linux/macOS
cd $ZEPHYR_BASE/tests/booting/stub
mkdir build && cd build
# On Windows
cd %ZEPHYR_BASE%\tests\booting\stub
mkdir build & cd build
cmake -GNinja -DBOARD=arduino_101 ..
ninja flash

Sample Output

To check output of this sample , any serial console program can be used. Here I am using picocom program to open output. Check which tty device it is. In my case it is ttyUSB0

$ sudo picocom -D /dev/ttyUSB0
( x y z ) = ( -0.390625  0.087500  -0.390625 )
( x y z ) = ( -0.275000  0.115625  -0.275000 )
( x y z ) = ( -0.281250  0.125000  -0.281250 )
( x y z ) = ( -0.287500  0.134375  -0.287500 )