TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 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 (139254 times)
  2. FAT32 Library (71751 times)
  3. Network Ethernet Library (57122 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42404 times)
  7. GSM click (29835 times)
  8. mikroSDK (28078 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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 9 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.17

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 177 times

Not followed.

License: MIT license  

The 6DOF IMU 9 Click is a Click board™ which features the IAM-20680, a 6-axis MotionTracking device that combines a 3-axis gyroscope and a 3-axis accelerometer, from TDK InvenSense.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


6DOF IMU 9 Click

The 6DOF IMU 9 Click is a Click board™ which features the IAM-20680, a 6-axis MotionTracking device that combines a 3-axis gyroscope and a 3-axis accelerometer, from TDK InvenSense.

6dofimu9_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : dec 2019.
  • Type : I2C/SPI type

Software Support

We provide a library for the 6DOFIMU9 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for 6DOFIMU9 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void c6dofimu9_cfg_setup ( c6dofimu9_cfg_t *cfg );

  • Initialization function.

    C6DOFIMU9_RETVAL c6dofimu9_init ( c6dofimu9_t ctx, c6dofimu9_cfg_t cfg );

Example key functions :

  • Set Gyro configuration function

    void c6dofimu9_set_gyro_config ( c6dofimu9_t *ctx, uint8_t gyro_config_data );

  • Set Gyro measurement range configuration function

    void c6dofimu9_set_gyro_measurement_range ( c6dofimu9_t *ctx, uint16_t gyro_full_scale_range );

  • Set Accel measurement range configuration function

    void c6dofimu9_set_accel_measurement_range ( c6dofimu9_t *ctx, uint8_t accel_full_scale_range );

Examples Description

This application measure 3-axis gyroscope and a 3-axis accelerometer.

The demo application is composed of two sections :

Application Init

Initialization driver enables - I2C, check device ID, configure accelerometer and gyroscope, also write log.


void application_init ( void )
{
    log_cfg_t log_cfg;
    c6dofimu9_cfg_t cfg;
    uint8_t device_id;

    /** 
     * 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.

    c6dofimu9_cfg_setup( &cfg );
    C6DOFIMU9_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    c6dofimu9_init( &c6dofimu9, &cfg );

    log_printf( &logger, "       Driver  Initialization        \r\n" );
    log_printf( &logger, "-------------------------------------\r\n" );
    Delay_100ms( );

    device_id = c6dofimu9_get_device_id( &c6dofimu9 );

    if ( device_id == C6DOFIMU9_DEVICE_ID )
    {
        log_printf( &logger, "       SUCCESS        \r\n" );
        log_printf( &logger, "-------------------------------------\r\n" );
    }
    else
    {
        log_printf( &logger, "                ERROR              \r\n" );
        log_printf( &logger, "            RESET DEVICE           \r\n" );
        log_printf( &logger, "-----------------------------------\r\n" );
        for ( ; ; );
    }

    c6dofimu9_set_gyro_config_lp_mode( &c6dofimu9, C6DOFIMU9_GYRO_AVERAGE_1x );
    c6dofimu9_set_gyro_measurement_range( &c6dofimu9, C6DOFIMU9_GYRO_FULL_SCALE_250dps );
    c6dofimu9_set_accel_measurement_range( &c6dofimu9, C6DOFIMU9_ACCEL_FULL_SCALE_2g );
    c6dofimu9_set_accel_avg_filter_mode( &c6dofimu9, C6DOFIMU9_ACCEL_AVERAGE_4_SAMPLES );

    log_printf( &logger, "            Start measurement             \r\n" );
    log_printf( &logger, "-------------------------------------\r\n" );
    Delay_100ms( );
}

Application Task

This is an example which demonstrates the use of 6DOF IMU 9 Click board. Measured and display Accel and Gyro data coordinates values for X-axis, Y-axis and Z-axis. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 1 sec.


void application_task ( )
{
    int16_t accel_axis_x;
    int16_t accel_axis_y;
    int16_t accel_axis_z;
    int16_t gyro_axis_x;
    int16_t gyro_axis_y;
    int16_t gyro_axis_z;

    c6dofimu9_get_accel_data( &c6dofimu9, &accel_axis_x, &accel_axis_y, &accel_axis_z );
    Delay_10ms( );
    c6dofimu9_get_gyro_data( &c6dofimu9, &gyro_axis_x,  &gyro_axis_y, &gyro_axis_z );
    Delay_10ms( );

    log_printf( &logger, " Accel X : %d ", accel_axis_x );
    log_printf( &logger, "    |     ");
    log_printf( &logger, " Gyro X : %d \r\n", gyro_axis_x );

    log_printf( &logger, " Accel Y : %d ", accel_axis_y );
    log_printf( &logger, "    |     ");
    log_printf( &logger, " Gyro Y : %d \r\n", gyro_axis_y);

    log_printf( &logger, " Accel Z : %d ", accel_axis_z );
    log_printf( &logger, "    |     ");
    log_printf( &logger, " Gyro Z : %d \r\n", gyro_axis_z);

    log_printf(&logger, "-------------------------------------\r\n");
    Delay_1sec( );
} 

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.6DOFIMU9

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


ALSO FROM THIS AUTHOR

MCP251863 Click

0

MCP251863 Click is a compact add-on board representing a complete CAN solution used as a control node in a CAN network. This board features the MCP251863, IC representing a compact solution with a controller and a transceiver in one package, the MCP2518FD and ATA6563 from Microchip. The ATA6563, a low-level physical layer IC (PHY), provides a physical connection with the CAN bus itself, while the CAN controller MCP2518FD represents an interface between the MCU and the PHY. It features three operating modes with dedicated fail-safe features, remote wake-up via CAN, and ideally passive behavior when powered off on the CAN bus. This Click board™ is suitable for developing a wide range of automotive diagnostic applications, even on MCUs that don’t support CAN interface.

[Learn More]

DAC click

0

This example demonstrates usage of the DAC click board in mikroBUS form factor. Board features 12-bit Digital-to-Analog Converter MCP4921 that features SPI interface and an optional double buffered output.

[Learn More]

SPI Isolator 8 Click

0

SPI Isolator 8 Click is a compact add-on board representing a digital isolator optimized for a serial peripheral interface. This board features the ISOW7743, a quad-channel digital isolator from Texas Instruments. This device has a maximum data rate of 100Mbps and transfers digital signals between circuits with different power domains featuring reinforced isolation for a withstand voltage rating of 5kVRMS for 60 seconds.

[Learn More]