Three-axis geomagnetic sensor
GeoMagnetic click is a digital magnetometric click board which can measure the geomagnetic field in three perpendicular axes. The onboard sensor uses FlipCore - a proprietary technology from Bosch, which results with a carefully tuned performance, tailored for demanding 3-axis mobile applications, such as a tilt-compensated electronic compass, gaming controllers, augmented reality applications and similar applications which require reliable and precise 3-axis magnetometric measurement.
Besides the magnetic field measurement functions, GeoMagnetic click also provides an advanced programmable interrupt engine, which allows for a flexible design and responsiveness of the application. GeoMagnetic click can use either SPI or I2C interface to communicate with the host controller. All these features make GeoMagnetic click an easy to use and reliable solution for a rapid development of geomagnetic based applications.
How does it work?
GeoMagnetic click carries the BMM150, a three-axis geomagnetic sensor from Bosh Sensortec. Featuring the proprietary FlipCore technology from Bosch, low power consumption, and noise, as well as thermally compensated measurements, this device is specially tuned and tailored to be used in demanding 3-axis mobile applications.
The BMM150 module is able to work in four power modes: Power Off mode, Suspend mode, Sleep mode and Active mode. The overall power consumption is greatly affected by the selection of power modes. All modes except the Power Off mode can be set by programming the appropriate registers. Additionally, while working in Active mode, the power consumption depends on the measurement rate, which can be either timed with the programmed output data rate (Normal mode) or forced by the user (Forced mode).
The sensor output noise is processed by the internal integrator, so setting more measurement repetitions for the same axis will yield output results with less noise. This also affects the overall power consumption in the Active mode.
There are four interrupt engines available on this device: low threshold, high threshold and overflow and data ready (DRDY). Every interrupt engine can be enabled independently. If the interrupt is enabled, it will set the corresponding status bit in the status register. For this interrupt to appear on the INT pin of the BMM150 IC, a corresponding bit should be set in the configuration register. This pin is routed to the mikroBUS™ INT pin and can be used for triggering external events. Data ready pin is not physically available on the click board™, but still, its status bit can be read from the status register.
The temperature compensation is based on a hall plate sensor measurement. This IC outputs raw values for the measurements: DATAX, DATAY, DATAZ, and RHALL. The data width for the X and Y axes is different than the one for the Z and RHALL. DATAX and DATAY data fields are 13 bits wide, while DATAZ field is 15 bits wide. RHALL data field is 14 bits wide. The manufacturer recommendation is to read all the axes at once. The output registers are refreshed all at once after all the measurements are finished. While reading registers, a new measurement is not stored in the same registers, but buffered to shadow registers, instead. This prevents axes data mixing, so it is also recommended to read the whole register sequence in one burst. To further control the data reading sequence, two additional bits are used to indicate the data ready status and data overrun status.
GeoMagnetic click can use either SPI or I2C communication interface. The selection between the interfaces can be done by switching the SMD jumper positions. There are two group of SMD jumpers. The first group is labeled as COM SEL and it is used to select the required interface type. It should be noted that all the jumpers need to be switched either left for SPI interface type or right for I2C interface type. Mixed positions are not allowed. The second group of SMD jumpers is labeled as ADD SEL and it is used to set the two least significant bits (LSB) of the I2C address. These jumpers are disregarded if the SPI interface is selected. More information about the registers and their settings can be found in the datasheet link, below.
The provided GeoMagnetic click library offers simple and easy to use functions, which are demonstrated in the demo application. These functions allow easy and simple configuration management and data reading, speeding up the development process.
Specifications
Type | Magnetometer |
On-board modules | BMM150 geomagnetic sensor from Bosch |
Interface | GPIO,I2C,SPI |
Input Voltage | 3.3V |
Click board size | M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on GeoMagnetic click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
GeoMagnetic click specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
I2C Clock | 400 | kHz | ||
SPI Clock (SDI, SDO load < 25pF) | 10 | MHz |
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
JP1 - JP5 | COM SEL | LEFT | Communication protocol selection: Left position - SPI, right position - I2C |
JP6 - JP7 | ADD SEL | LEFT | I2C Address selection: Left position - 0, right position - 1 |
LD1 | PWR | - | Power LED indicator |
Software support
We provide a library for GeoMagnetic click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers and mikroSDK. The provided click library is mikroSDK standard compliant. The demo application can run on all the main MikroElektronika development boards.
Library Description
Initializes and defines the SPI and I2C bus driver and driver functions, which has the ability of writing on registers and reading from registers. The functions also offer a choice to reading x, y and z axis data and hall resistance data when data is ready for reading. For more details check the documentation.
Key functions:
GEOMAG_RETVAL_T geomag_writeReg( uint8_t dataIn, const uint8_t registerAddress )
- The function writes one byte data in the register.
GEOMAG_RETVAL_T geomag_readReg( uint8_t *dataOut, const uint8_t registerAddress, const uint8_t nBytes )
- The function reads the determined number of bytes from registers.
void geomag_readData( uint16_t *dataX, uint16_t *dataY, uint16_t *dataZ, uint16_t *resHall )
- The function reads 13-bit x and y axis data, 15-bit z axis data and 14-bit hall resistance data from data registers.
Examples Description
Application Task - (code snippet) - Reads axis data after each 500ms and logs results on USB UART.
void applicationTask() { geomag_readData( &axisX, &axisY, &axisZ, &RHall ); WordToStr( axisX, text ); mikrobus_logWrite( "X axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); WordToStr( axisY, text ); mikrobus_logWrite( "Y axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); WordToStr( axisZ, text ); mikrobus_logWrite( "Z axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); Delay_ms( 500 ); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This click board is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.
Downloads
mikroBUS™ Standard specification