c6dofimu14  2.0.0.0
Main Page

6DOF IMU 14 click

6DOF IMU 14 Click is a compact add-on board that contains a 6-axis MEMS motion tracking device combining a 3-axis gyroscope and a 3-axis accelerometer. This board features the ICM-42688-P, high precision 6-axis MEMS motion tracking device, from TDK InvenSense.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : May 2021.
  • Type : I2C/SPI type

Software Support

We provide a library for the 6DOFIMU14 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 6DOFIMU14 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of 6DOF IMU 14 click board.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the click board.

void application_init ( void )
{
log_cfg_t log_cfg;
c6dofimu14_cfg_t c6dofimu14_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
Delay_ms( 100 );
log_info( &logger, " Application Init " );
// Click initialization.
c6dofimu14_cfg_setup( &c6dofimu14_cfg );
C6DOFIMU14_MAP_MIKROBUS( c6dofimu14_cfg, MIKROBUS_1 );
err_t init_flag = c6dofimu14_init( &c6dofimu14, &c6dofimu14_cfg );
if ( ( init_flag == I2C_MASTER_ERROR ) || ( init_flag == SPI_MASTER_ERROR ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms( 100 );
if ( c6dofimu14_default_cfg ( &c6dofimu14 ) != C6DOFIMU14_OK )
{
log_error( &logger, " Default Config Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
Delay_ms( 100 );
log_info( &logger, " Application Task " );
}

Application Task

Reads accel, gyro, and temperature data and displays the results on the USB UART approximately every 500ms.

void application_task ( void )
{
float temperature;
c6dofimu14_get_data( &c6dofimu14, &accel, &gyro );
c6dofimu14_get_temperature( &c6dofimu14, &temperature );
log_printf( &logger, " Accel X: %d | Gyro X: %d\r\n", accel.x, gyro.x );
log_printf( &logger, " Accel Y: %d | Gyro Y: %d\r\n", accel.y, gyro.y );
log_printf( &logger, " Accel Z: %d | Gyro Z: %d\r\n", accel.z, gyro.z );
log_printf( &logger, " Temperature: %.2f C\r\n", temperature );
log_printf( &logger, "----------------------------------\r\n");
Delay_ms( 500 );
}

Note

In the case of I2C, the example doesn't work properly on some of the 8-bit PICs (ex. PIC18F97J94).

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.6DOFIMU14

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.


c6dofimu14_init
err_t c6dofimu14_init(c6dofimu14_t *ctx, c6dofimu14_cfg_t *cfg)
6DOF IMU 14 initialization function.
c6dofimu14_cfg_setup
void c6dofimu14_cfg_setup(c6dofimu14_cfg_t *cfg)
6DOF IMU 14 configuration object setup function.
c6dofimu14_axis_t::y
int16_t y
Definition: c6dofimu14.h:686
c6dofimu14_axis_t
6DOF IMU 14 Axis structure object.
Definition: c6dofimu14.h:684
c6dofimu14_cfg_t
6DOF IMU 14 Click configuration object.
Definition: c6dofimu14.h:718
application_task
void application_task(void)
Definition: main.c:76
c6dofimu14_software_reset
err_t c6dofimu14_software_reset(c6dofimu14_t *ctx)
6DOF IMU 14 software reset function.
c6dofimu14_get_temperature
err_t c6dofimu14_get_temperature(c6dofimu14_t *ctx, float *temp)
6DOF IMU 14 get temperature data function.
c6dofimu14_default_cfg
err_t c6dofimu14_default_cfg(c6dofimu14_t *ctx)
6DOF IMU 14 default configuration function.
C6DOFIMU14_OK
@ C6DOFIMU14_OK
Definition: c6dofimu14.h:745
application_init
void application_init(void)
Definition: main.c:31
c6dofimu14_axis_t::x
int16_t x
Definition: c6dofimu14.h:685
c6dofimu14_get_data
err_t c6dofimu14_get_data(c6dofimu14_t *ctx, c6dofimu14_axis_t *acc_axis, c6dofimu14_axis_t *gyro_axis)
6DOF IMU 14 get accel and gyro data function.
c6dofimu14_axis_t::z
int16_t z
Definition: c6dofimu14.h:687
c6dofimu14_s
6DOF IMU 14 Click context object.
Definition: c6dofimu14.h:696
C6DOFIMU14_MAP_MIKROBUS
#define C6DOFIMU14_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: c6dofimu14.h:649