TOP Contributors

  1. MIKROE (2781 codes)
  2. Alcides Ramos (377 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139593 times)
  2. FAT32 Library (72044 times)
  3. Network Ethernet Library (57270 times)
  4. USB Device Library (47636 times)
  5. Network WiFi Library (43232 times)
  6. FT800 Library (42569 times)
  7. GSM click (29933 times)
  8. mikroSDK (28313 times)
  9. PID Library (26936 times)
  10. microSD click (26309 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

6DOF IMU 18 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.9

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 101 times

Not followed.

License: MIT license  

6DOF IMU 18 Click is a compact add-on board with a 6-axis inertial measurement unit. This board features the ICM-42605, a high-performance 6-axis MotionTracking™ IMU from TDK InvenSense.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "6DOF IMU 18 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "6DOF IMU 18 Click" changes.

Do you want to report abuse regarding "6DOF IMU 18 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


6DOF IMU 18 Click

6DOF IMU 18 Click is a compact add-on board with a 6-axis inertial measurement unit. This board features the ICM-42605, a high-performance 6-axis MotionTracking™ IMU from TDK InvenSense.

6dofimu18_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Jan 2023.
  • Type : I2C/SPI type

Software Support

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

Standard key functions :

  • c6dofimu18_cfg_setup Config Object Initialization function.

    void c6dofimu18_cfg_setup ( c6dofimu18_cfg_t *cfg );
  • c6dofimu18_init Initialization function.

    err_t c6dofimu18_init ( c6dofimu18_t *ctx, c6dofimu18_cfg_t *cfg );
  • c6dofimu18_default_cfg Click Default Configuration function.

    err_t c6dofimu18_default_cfg ( c6dofimu18_t *ctx );

Example key functions :

  • c6dofimu18_set_reg_bank 6DOF IMU 18 set register bank function.

    err_t c6dofimu18_set_reg_bank( c6dofimu18_t *ctx, uint8_t bank );
  • c6dofimu18_get_int1_state 6DOF IMU 18 read INT1 pin state function.

    uint8_t c6dofimu18_get_int1_state ( c6dofimu18_t *ctx );
  • c6dofimu18_get_data_from_register 6DOF IMU 18 read data function.

    err_t c6dofimu18_get_data_from_register ( c6dofimu18_t *ctx, float *temperature_data, c6dofimu18_data_t *accel_data, c6dofimu18_data_t *gyro_data, uint32_t *tmst_data );

Example Description

This library contains API for 6DOF IMU 18 Click driver. The library initializes and defines the I2C and SPI bus drivers to write and read data from registers, as well as the default configuration for reading gyroscope and accelerator data, and temperature.

The demo application is composed of two sections :

Application Init

Initializes the driver after that resets the device and performs default configuration and reads the device id.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    c6dofimu18_cfg_t c6dofimu18_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    c6dofimu18_cfg_setup( &c6dofimu18_cfg );
    C6DOFIMU18_MAP_MIKROBUS( c6dofimu18_cfg, MIKROBUS_1 );
    err_t init_flag = c6dofimu18_init( &c6dofimu18, &c6dofimu18_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    Delay_ms ( 100 );

    uint8_t id = 0;
    c6dofimu18_reg_read( &c6dofimu18, C6DOFIMU18_BANK0_SEL, C6DOFIMU18_REG_WHO_AM_I, &id, 1);
    log_printf( &logger, " Device ID : 0x%.2X \r\n", ( uint16_t ) id );
    if ( C6DOFIMU18_WHO_AM_I_VALUE != id )
    {
        log_error( &logger, " Communication error." );
        for ( ; ; );
    }
    Delay_ms ( 100 );

    if ( C6DOFIMU18_OK != c6dofimu18_default_cfg ( &c6dofimu18 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

This example demonstrates the use of the 6DOF IMU 18 Click board by measuring and displaying acceleration and gyroscope data for X-axis, Y-axis, and Z-axis as well as temperature in degrees Celsius.

void application_task ( void )
{
    if ( c6dofimu18_get_int1_state( &c6dofimu18) )
    {       
        c6dofimu18_data_t accel_data;
        c6dofimu18_data_t gyro_data;
        float temp_data;
        uint32_t tmst_data;

        c6dofimu18_get_data_from_register( &c6dofimu18, &temp_data, &accel_data, &gyro_data, &tmst_data );
        log_printf( &logger, " TEMP: %.2f \r\n", temp_data );
        log_printf( &logger, " GYRO: x:%d y:%d z:%d \r\n", gyro_data.data_x,gyro_data.data_y,gyro_data.data_z );
        log_printf( &logger, " ACCEL: x:%d y:%d z:%d \r\n", accel_data.data_x,accel_data.data_y,accel_data.data_z );
        log_printf( &logger, "========================== \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.6DOFIMU18

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.


ALSO FROM THIS AUTHOR

USB UART 2 Click

0

USB UART 2 Click provides USB isolation and carries the ADUM4160BRWZ USB port isolator. The Click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over UART interface, with additional functionality provided the following pins on the mikroBUS™ line: RST, CS, PWM, INT.

[Learn More]

Tamper 2 click

5

Tamper 2 click contains a levered D2HW-A221Dswitch by Omron, which outputs signal in both positions - pressed and released. The most common use of the Tamper 2 click is door opening or closing detection, detecting the end of travel of a linear actuator, a Morse code input device, etc.

[Learn More]

Magneto 10 Click

0

Magneto 10 Click is a compact add-on board that contains a 3D magnetometer. This board features the MLX90392, a +/-5mT range magnetometer for low-noise applications from Melexis Technologies. The MLX90392, specially designed for micropower applications, measures magnetic fields along the three axes (X, Y being in a plane parallel to the surface of the die, and Z being perpendicular to the surface).

[Learn More]