c6dofimu21  2.1.0.0
Main Page

6DOF IMU 21 Click

6DOF IMU 21 Click is a compact add-on board perfect for applications requiring accurate orientation and movement detection. This board features the WSEN-ISDS (2536030320001) sensor from Würth Elektronik, which integrates 3-axis acceleration and gyroscope sensors using advanced MEMS-based capacitive sensing technology. It offers a fully calibrated 16-bit digital output, with acceleration ranges from ±2g to ±16g and gyroscope ranges from ±125dps to ±2000dps, alongside a high output data rate of up to 6.6kHz for seamless movement tracking. Additionally, an embedded temperature sensor provides environmental monitoring capabilities.

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 21 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 21 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of 6DOF IMU 21 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.

void application_init ( void )
{
log_cfg_t log_cfg;
c6dofimu21_cfg_t c6dofimu21_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
c6dofimu21_cfg_setup( &c6dofimu21_cfg );
C6DOFIMU21_MAP_MIKROBUS( c6dofimu21_cfg, MIKROBUS_1 );
err_t init_flag = c6dofimu21_init( &c6dofimu21, &c6dofimu21_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( C6DOFIMU21_ERROR == c6dofimu21_default_cfg ( &c6dofimu21 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
uint8_t dev_id = 0;
if ( C6DOFIMU21_DEVICE_ID != dev_id )
{
log_error( &logger, " Communication error " );
}
log_printf( &logger, " Device ID: 0x%.2X \r\n", ( uint16_t ) dev_id );
log_info( &logger, " Application Task " );
}

Application Task

Reading the accelerometer and gyroscope measurements, results are displayed on the USB UART every second.

void application_task ( void )
{
c6dofimu21_data_t accel_data;
c6dofimu21_data_t gyro_data;
c6dofimu21_read_accel_data( &c6dofimu21, &accel_data );
c6dofimu21_read_gyro_data( &c6dofimu21, &gyro_data );
log_printf( &logger, " Accel data | Gyro data \r\n" );
log_printf( &logger, " X: %.2f mg | %.2f mdps \r\n", accel_data.x_data, gyro_data.x_data );
log_printf( &logger, " Y: %.2f mg | %.2f mdps \r\n", accel_data.y_data, gyro_data.y_data );
log_printf( &logger, " Z: %.2f mg | %.2f mdps \r\n", accel_data.z_data, gyro_data.z_data );
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.C6DOFIMU21

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.


c6dofimu21_data_t
6DOF IMU 21 data object.
Definition: c6dofimu21.h:336
C6DOFIMU21_MAP_MIKROBUS
#define C6DOFIMU21_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: c6dofimu21.h:253
c6dofimu21_cfg_t
6DOF IMU 21 Click configuration object.
Definition: c6dofimu21.h:310
application_task
void application_task(void)
Definition: main.c:74
c6dofimu21_read_gyro_data
err_t c6dofimu21_read_gyro_data(c6dofimu21_t *ctx, c6dofimu21_data_t *gyro_data)
6DOF IMU 21 read gyro function.
c6dofimu21_init
err_t c6dofimu21_init(c6dofimu21_t *ctx, c6dofimu21_cfg_t *cfg)
6DOF IMU 21 initialization function.
c6dofimu21_software_reset
err_t c6dofimu21_software_reset(c6dofimu21_t *ctx)
6DOF IMU 21 software reset device function.
c6dofimu21_s
6DOF IMU 21 Click context object.
Definition: c6dofimu21.h:289
c6dofimu21_cfg_setup
void c6dofimu21_cfg_setup(c6dofimu21_cfg_t *cfg)
6DOF IMU 21 configuration object setup function.
c6dofimu21_data_t::z_data
float z_data
Definition: c6dofimu21.h:339
c6dofimu21_default_cfg
err_t c6dofimu21_default_cfg(c6dofimu21_t *ctx)
6DOF IMU 21 default configuration function.
c6dofimu21_data_t::x_data
float x_data
Definition: c6dofimu21.h:337
C6DOFIMU21_DEVICE_ID
#define C6DOFIMU21_DEVICE_ID
6DOF IMU 21 device ID setting.
Definition: c6dofimu21.h:202
application_init
void application_init(void)
Definition: main.c:29
C6DOFIMU21_REG_DEVICE_ID
#define C6DOFIMU21_REG_DEVICE_ID
Definition: c6dofimu21.h:83
c6dofimu21_generic_read
err_t c6dofimu21_generic_read(c6dofimu21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
6DOF IMU 21 data reading function.
c6dofimu21_data_t::y_data
float y_data
Definition: c6dofimu21.h:338
c6dofimu21_read_accel_data
err_t c6dofimu21_read_accel_data(c6dofimu21_t *ctx, c6dofimu21_data_t *accel_data)
6DOF IMU 21 read accel function.
C6DOFIMU21_ERROR
@ C6DOFIMU21_ERROR
Definition: c6dofimu21.h:350