c6dofimu17  2.0.0.0
Main Page

6DOF IMU 17 click

6DOF IMU 17 Click is a compact add-on board that contains a 6-axis inertial measurement unit. This board features the IIM-42652, a 6-axis SmartIndustrial™ MotionTracking device that supports an extended operating temperature range for industrial applications from TDK InvenSense. It combines a 3-axis gyroscope and a 3-axis accelerometer featuring a 2K-byte FIFO that can lower the traffic on the serial bus interface (SPI or I2C) and reduce power consumption by allowing the system processor to burst read sensor data and then go into a low-power mode.

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jul 2021.
  • Type : I2C/SPI type

Software Support

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

Standard key functions :

Example key functions :

Example Description

his library contains API for 6DOF IMU 17 Click driver. The library initializes and defines the I2C or SPI bus drivers to write and read data from registers. The library also includes a function for reading accelerometer and gyroscope X-axis, Y-axis, and Z-axis data as well as the temperature in degrees Celsius.

The demo application is composed of two sections :

Application Init

The initialization of I2C or SPI module, log UART, and additional pins. After the driver init, the app checks communication, sensor ID, and then executes a default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
c6dofimu17_cfg_t c6dofimu17_cfg;
uint8_t device_id;
// Logger initialization.
LOG_MAP_USB_UART( log_cfg );
log_cfg.level = LOG_LEVEL_DEBUG;
log_cfg.baud = 115200;
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
c6dofimu17_cfg_setup( &c6dofimu17_cfg );
C6DOFIMU17_MAP_MIKROBUS( c6dofimu17_cfg, MIKROBUS_1 );
err_t init_flag = c6dofimu17_init( &c6dofimu17, &c6dofimu17_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
c6dofimu17_default_cfg ( &c6dofimu17 );
Delay_ms( 100 );
c6dofimu17_get_device_id( &c6dofimu17, &device_id );
Delay_ms( 100 );
if ( device_id == C6DOFIMU17_CHIP_ID )
{
log_printf( &logger, "\t\t Communication OK\r\n" );
}
else
{
log_printf( &logger, "\t\tCommunication ERROR\r\n" );
log_printf( &logger, "\t\t Reset the device\r\n" );
for ( ; ; );
}
log_printf( &logger, "\t--------------------------------------\r\n" );
Delay_ms( 100 );
}

Application Task

This is an example that shows the use of a 6DOF IMU 17 Click board™. Measures and displays acceleration and gyroscope data for X-axis, Y-axis, and Z-axis and the temperature in degrees Celsius. Results are being sent to the USART terminal where the user can track their changes. This task repeats every 1 sec.

void application_task ( void )
{
c6dofimu17_axis_t accel_data;
c6dofimu17_axis_t gyro_data;
float temperature;
c6dofimu17_get_accel_data( &c6dofimu17, &accel_data );
c6dofimu17_get_gyro_data( &c6dofimu17, &gyro_data );
c6dofimu17_get_temperature( &c6dofimu17, &temperature );
log_printf( &logger, "\t Accel X: %d\t|\tGyro X: %d\r\n", accel_data.x, gyro_data.x );
log_printf( &logger, "\t Accel Y: %d\t|\tGyro Y: %d\r\n", accel_data.y, gyro_data.y );
log_printf( &logger, "\t Accel Z: %d\t|\tGyro Z: %d\r\n", accel_data.z, gyro_data.z );
log_printf( &logger, "\t- - - - - - - - - - - - - - - - - - -\r\n" );
log_printf( &logger, "\t\t Temperature: %.2f C\r\n", temperature );
log_printf( &logger, "\t--------------------------------------\r\n" );
Delay_ms( 1000 );
}

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

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.


c6dofimu17_get_accel_data
err_t c6dofimu17_get_accel_data(c6dofimu17_t *ctx, c6dofimu17_axis_t *accel_data)
6DOF IMU 17 get accel data function.
c6dofimu17_s
6DOF IMU 17 Click context object.
Definition: c6dofimu17.h:371
c6dofimu17_init
err_t c6dofimu17_init(c6dofimu17_t *ctx, c6dofimu17_cfg_t *cfg)
6DOF IMU 17 initialization function.
c6dofimu17_axis_t
6DOF IMU 17 Axis structure object.
Definition: c6dofimu17.h:427
c6dofimu17_axis_t::y
int16_t y
Definition: c6dofimu17.h:429
c6dofimu17_get_gyro_data
err_t c6dofimu17_get_gyro_data(c6dofimu17_t *ctx, c6dofimu17_axis_t *gyro_data)
6DOF IMU 17 get gyroscope data function.
c6dofimu17_cfg_t
6DOF IMU 17 Click configuration object.
Definition: c6dofimu17.h:391
application_task
void application_task(void)
Definition: main.c:84
C6DOFIMU17_CHIP_ID
#define C6DOFIMU17_CHIP_ID
Definition: c6dofimu17.h:121
c6dofimu17_get_temperature
err_t c6dofimu17_get_temperature(c6dofimu17_t *ctx, float *temperature)
6DOF IMU 17 get temperature data function.
C6DOFIMU17_MAP_MIKROBUS
#define C6DOFIMU17_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: c6dofimu17.h:337
c6dofimu17_axis_t::z
int16_t z
Definition: c6dofimu17.h:430
application_init
void application_init(void)
Definition: main.c:38
c6dofimu17_axis_t::x
int16_t x
Definition: c6dofimu17.h:428
c6dofimu17_get_device_id
err_t c6dofimu17_get_device_id(c6dofimu17_t *ctx, uint8_t *device_id)
6DOF IMU 17 get device ID function.
c6dofimu17_cfg_setup
void c6dofimu17_cfg_setup(c6dofimu17_cfg_t *cfg)
6DOF IMU 17 configuration object setup function.
c6dofimu17_default_cfg
err_t c6dofimu17_default_cfg(c6dofimu17_t *ctx)
6DOF IMU 17 default configuration function.