3D Hall 3 Click Board
3D Hall 3 Click Board
The 3D Hall 3 Click Board™ is a very accurate, magnetic field sensing Click Board™, used to measure the intensity of the magnetic field across three perpendicular axes. It is equipped with the LIS2MDL, a low power 3D magnetic sensor. This IC has a separate Hall sensing element on each axis, which allows a very accurate and reliable measurement of the magnetic field intensity in a 3D space, offering a basis for accurate positional calculations. Both I2C and SPI communication protocols are supported by the LIS2MDL. This sensor IC features a powerful programmable interrupt engine, allowing firmware optimization.
Software Support
We provide a library for the 3D Hall 3 Click Board™ 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
The library initializes and defines the I2C bus or SPI bus driver and drivers that offer a choice for writing data in registers and reading data from registers. The library includes function for read X/Y/Z axis data, set offset, read interrupt state. The user also has the function for configuration chip.
Key Functions
void c3dhall3_readXYZ( int16_t *OUT_XYZ )
- Reading X Y Z - axes valuesvoid c3dhall3_configuration( void )
- Click default configurationvoid c3dhall3_writeOffset(uint8_t axis, uint16_t offset )
- Writing X Y or Z-axis offset
Example Description
The application is composed of the three sections :
- System Initialization - Initializes I2C communication, INT pin as input, RST pin as output and CS pin as output
- Application Initialization - Initializes I2C driver and 3D Hall 3 Click Board™ to basic settings
- Application Task - Reads and logs XYZ axes values
void applicationTask( ) { c3dhall3_readXYZ( &axes_xyz[0] ); mikrobus_logWrite( " X:", _LOG_TEXT ); IntToStr( axes_xyz[0], text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " Y:", _LOG_TEXT ); IntToStr( axes_xyz[1], text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " Z:", _LOG_TEXT ); IntToStr( axes_xyz[2], text ); mikrobus_logWrite( text, _LOG_LINE ); Delay_ms(100); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
I2C
SPI
UART
Additional Notes and Information
Depending on the development board you are using, you may need a 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
The 3D Hall 3 Click Board™ is supported
3D Hall 3 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.