How does it work?
Compass 3 Click uses the MMC5883MA, a complete 3-axis magnetic sensor with on-chip signal processing and integrated I2C bus suitable for use in various applications, from MEMSIC. The device eliminates the need for A/D converters or timing resources by being directly connected to a microprocessor. It can measure magnetic fields within the full scale range of ±8Gauss (G), with 0.25mG per LSB resolution at 16bits operation mode and 0.4mG total RMS noise level, enabling heading accuracy of ±1° in electronic compass applications.
An integrated SET/RESET function provides for the elimination of error due to Null Field output change with temperature. Temperature information from the integrated temperature sensor is available over the I2C Interface.
The SET/RESET function can be performed for each measurement, periodically, or when the temperature changes by a predetermined amount as the specific application requires. In addition, the SET/RESET function clears the sensors of any residual magnetic polarization resulting from exposure to strong external magnets. The MMC5883MA is packaged in a low profile LGA package (3.0 x 3.0 x 1.0 mm) and an operating temperature range from -40°C to +85°C. The MMC5883MA provides an I2C digital output with 400 kHz, fast mode operation.
This Click Board™ is designed to be operated only with a 3.3V logic level. A proper logic voltage level conversion should be performed before the Click board™ is used with MCUs with different logic levels.
Specifications
Type
Compass,Magnetic
Applications
Can be used in electronic compass and navigation, position sensing or general purpose magnetic field measurements.
On-board modules
Compass 3 Click uses the MMC5883MA IC, a complete 3-axis magnetic sensor with on-chip signal processing, from Memsic Inc.
Key Features
Measuring of magnetic field within the full scale range of ±8Gauss (G), 16bits resolution, 0.25mG per LSB sensitivity, heading accuracy of ±1°
Interface
I2C
Compatibility
mikroBUS
Click board size
S (28.6 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on Compass 3 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
Compass 3 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Field Range (Each Axis) | – | ±8 | – | G |
Supply Voltage | 2.16 | 3.3 | 3.6 | V |
Operating Temperature Range | -40 | – | 85 | °C |
Software Support
We provide a library for the Compass 3 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
This library holds functions that can be used to read, write and measure magnetic field and temperature.
Key functions:
void compass3_write_byte ( uint8_t reg_adr, uint8_t data_in );
– Writes 8-bit data into register defined by 8-bit register address.void compass3_full_measurement ( float *x_val, float *y_val, float *z_val );
– Measures magnetic field surrounding the device.float compass3_read_temp ( );
– Function is used to measure temperature.
Examples description
The application is composed of three sections :
- System Initialization – Initializes I2C module, LOG and GPIO structures, sets INT pin as input.
- Application Initialization – Initalizes I2C driver, applies default setup and writes an initial log.
- Application Task – (code snippet) This example demonstrates the use of Compass 3 Click board by measuring the magnetic field surrounding the device.
void application_task ( ) { if( compass3_check_int () == COMPASS3_INTERRUPT ) { compass3_full_measurement ( &x_val, &y_val, &z_val ); FloatToStr( x_val, log_txt ); mikrobus_logWrite( " X-axis: ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( "mG", _LOG_LINE ); FloatToStr( y_val, log_txt ); mikrobus_logWrite( " Y-axis: ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( "mG", _LOG_LINE ); FloatToStr( z_val, log_txt ); mikrobus_logWrite( " Z-axis: ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( "mG", _LOG_LINE ); Delay_ms( 1000 ); mikrobus_logWrite( "--------------------", _LOG_LINE ); } }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- UART
- Conversions
Additional notes and informations
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.