6DOF IMU 16 click
6DOF IMU 16 Click is a compact add-on board with a 6-axis inertial measurement device. This board features the ICM-42605, a premium performance 6-axis MotionTracking™ IMU from TDK InvenSense. It combines a 3-axis gyroscope and a 3-axis accelerometer, supporting the lowest gyroscope and accelerometer sensor noise in this IMU class. It also has the highest stability against temperature, shock, SMT/bend-induced offset, and more.
click Product page
Click library
- Author : Stefan Ilic
- Date : Dec 2023.
- Type : I2C/SPI type
Software Support
We provide a library for the 6DOF IMU 16 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for 6DOF IMU 16 Click driver.
Standard key functions :
c6dofimu16_cfg_setup
Config Object Initialization function.
void c6dofimu16_cfg_setup(c6dofimu16_cfg_t *cfg)
6DOF IMU 16 configuration object setup function.
6DOF IMU 16 Click configuration object.
Definition c6dofimu16.h:340
c6dofimu16_init
Initialization function.
err_t c6dofimu16_init(c6dofimu16_t *ctx, c6dofimu16_cfg_t *cfg)
6DOF IMU 16 initialization function.
6DOF IMU 16 Click context object.
Definition c6dofimu16.h:319
c6dofimu16_default_cfg
Click Default Configuration function.
err_t c6dofimu16_default_cfg(c6dofimu16_t *ctx)
6DOF IMU 16 default configuration function.
Example key functions :
c6dofimu16_sw_reset
This function performs the device software reset.
err_t c6dofimu16_sw_reset(c6dofimu16_t *ctx)
6DOF IMU 16 software reset device function.
c6dofimu16_get_gyro_data
This function reads the angular rate of X, Y, and Z axis in degrees per second (mdps).
err_t c6dofimu16_get_gyro_data(c6dofimu16_t *ctx, c6dofimu16_axis_t *gyro_data)
6DOF IMU 16 read gyro function.
6DOF IMU 16 Click axes data structure.
Definition c6dofimu16.h:366
c6dofimu16_get_accel_data
This function reads the accelerometer of X, Y, and Z axis relative to standard gravity (mg).
err_t c6dofimu16_get_accel_data(c6dofimu16_t *ctx, c6dofimu16_axis_t *accel_data)
6DOF IMU 16 read accel function.
Example Description
This example demonstrates the use of 6DOF IMU 16 click board by reading and displaying the accelerometer and gyroscope data (X, Y, and Z axis).
The demo application is composed of two sections :
Application Init
Initializes the driver performs the click default configuration, and checks communication by reading device ID.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
uint8_t dev_id = 0;
{
log_error( &logger, " Communication error " );
for ( ; ; );
}
log_printf( &logger, " Device ID: 0x%.2X \r\n", ( uint16_t ) dev_id );
log_info( &logger, " Application Task " );
}
@ C6DOFIMU16_ERROR
Definition c6dofimu16.h:380
#define C6DOFIMU16_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition c6dofimu16.h:283
#define C6DOFIMU16_REG_WHO_AM_I
Definition c6dofimu16.h:126
#define C6DOFIMU16_DEVICE_ID
6DOF IMU 16 device ID setting.
Definition c6dofimu16.h:228
err_t c6dofimu16_reg_read(c6dofimu16_t *ctx, uint8_t reg, uint8_t *data_out)
6DOF IMU 16 register data reading function.
void application_init(void)
Definition main.c:29
Application Task
Reading the accelerometer and gyroscope measurements, results are displayed on the USB UART every second.
{
log_printf( &logger, " Accel data | Gyro data \r\n" );
log_printf( &logger,
" X: %.2f g | %.2f dps \r\n", accel_data.
x_data, gyro_data.
x_data );
log_printf( &logger,
" Y: %.2f g | %.2f dps \r\n", accel_data.
y_data, gyro_data.
y_data );
log_printf( &logger,
" Z: %.2f g | %.2f dps \r\n", accel_data.
z_data, gyro_data.
z_data );
Delay_ms ( 1000 );
}
void application_task(void)
Definition main.c:76
float y_data
Definition c6dofimu16.h:368
float z_data
Definition c6dofimu16.h:369
float x_data
Definition c6dofimu16.h:367
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.C6DOFIMU16
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. UART terminal is available in all MikroElektronika compilers.