Intermediate
30 min

Dive into the natural and intuitive HMI world with KMX63 and PIC32MZ2048EFM100

Your path to perfect balance

6DOF IMU 11 Click with Curiosity PIC32 MZ EF

Published Sep 16, 2023

Click board™

6DOF IMU 11 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Add movement and rotation detection to your projects for unparalleled precision.

A

A

Hardware Overview

How does it work?

6DOF IMU 11 Click is based on the KMX63, a tri-axis accelerometer, tri-axis magnetometer, and temperature sensor on a single-chip combo solution from Kionix. The Accelerometer and Magnetometer data can be accumulated in an internal 384-byte FIFO buffer and transmitted to the application processor. Acceleration sensing is based on the principle of a differential capacitance arising from acceleration induced motion of the sense element, which utilizes common mode cancellation to decrease errors from process variation, temperature, and environmental stress. Capacitance changes are amplified and converted into digital signals which are processed by a dedicated digital signal processing unit. The digital signal processor applies filtering, bias, and sensitivity adjustments, as well as temperature compensation. Magnetic sensing is based on the principle of magnetic impedance. The magnetic

sensor detects very small magnetic fields by passing an electric pulse through a special electron spin aligned amorphous wire. Due to the high Curie temperature of the wire, the sensor’s thermal performance shows excellent stability. Noise performance is excellent with bias stability over temperature. Bias errors resulting from assembly can be trimmed digitally by the user. These sensors can accept supply voltages between 1.7V and 3.6V, and digital communication voltages from the MCU between 1.2V and 3.6V. The Kionix KMX63 digital sensor can communicate on the I2C digital serial interface bus. This flexibility allows for easy system integration by eliminating analog-to-digital converter requirements and by providing direct communication with system processors. The I2C interface is compliant with high-speed mode, fast mode, and standard mode I2C protocols. With 6DOF IMU 6 click you may

communicate by using I2C serial interface. The I2C is primarily used for serial communication between a Master device and one or more Slave devices. The KMX63 always operates as a Slave device during standard Master-Slave I2C operation. Given all of the possibilities its features offer, the 6DOF IMU 11 click can be used for applications which require movement and orientation features, such as screen orientation, navigation, game playing, machine/vibration analysis, and more. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

6DOF IMU 11 Click top side image
6DOF IMU 11 Click bottom side image

Features overview

Development board

Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
General-Purpose I/O
RPE8
PWM
General-Purpose I/O
RF13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

6DOF IMU 11 Click Schematic schematic

Step by step

Project assembly

Curiosity PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
Thermo 28 Click front image hardware assembly
Prog-cut hardware assembly
Curiosity PIC32 MZ EF MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Curiosity PIC32 MZ EF MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for 6DOF IMU 11 Click driver.

Key functions:

  • c6dofimu11_config_accel - Configuration Accel function

  • c6dofimu11_config_mag - Configuration Magnetometer function

  • c6dofimu11_get_axis - Get axis data function

  • c6dofimu11_get_accel_data - Read Accel X-axis, Y-axis and Z-axis function

  • c6dofimu11_get_mag_data - Read Magnetometer X-axis, Y-axis and Z-axis function

  • c6dofimu11_read_accel - Get Accel range X, Y and Z value ( g ) function

  • c6dofimu11_read_mag - Get Magnetometer magnetic field strength X, Y and Z value ( nT ) function

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief 6DofImu11 Click example
 * 
 * # Description
 * Designed to strike a balance between current consumption and noise performance with excellent bias stability over temperature
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization driver enables - I2C, check device ID, sets default configuration, also write log.
 * 
 * ## Application Task  
 * This is an example which demonstrates the use of 6DOF IMU 11 Click board.
 * Measured and display Accel and Magnetometer magnetic field 
 * strength values for X-axis, Y-axis and Z-axis. 
 * Results are being sent to the Uart Terminal where
 * you can track their changes. 
 * All data logs write on USB uart changes for every 2 sec.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "c6dofimu11.h"

// ------------------------------------------------------------------ VARIABLES

static c6dofimu11_t c6dofimu11;
static log_t logger;

void application_init ( void )
{
    log_cfg_t log_cfg;
    c6dofimu11_cfg_t cfg;

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

    c6dofimu11_cfg_setup( &cfg );
    C6DOFIMU11_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    c6dofimu11_init( &c6dofimu11, &cfg );

    if ( c6dofimu11_check_id( &c6dofimu11 ) == C6DOFIMU11_CHECK_ID_SUCCESS )
    {
        log_printf( &logger, "         SUCCESS          \r\n" );
        log_printf( &logger, "--------------------------\r\n" );
    }
    else
    {
        log_printf( &logger, "          ERROR           \r\n" );
        log_printf( &logger, "     Reset the device     \r\n" );
        log_printf( &logger, "--------------------------\r\n" );
        for ( ; ; );
    }

    c6dofimu11_default_cfg(  &c6dofimu11 );

    log_printf( &logger, "    Set default config    \r\n" );
    log_printf( &logger, "--------------------------\r\n" );
    Delay_ms( 100 );
}

void application_task ( void )
{
   c6dofimu11_mag_t mag_data;
   c6dofimu11_accel_t accel_data;
   
    c6dofimu11_read_accel ( &c6dofimu11, &accel_data );
    Delay_ms( 10 );
    c6dofimu11_read_mag ( &c6dofimu11, &mag_data );
    Delay_ms( 10 );

    log_printf( &logger, " Accel X : %.2f g\r\n", accel_data.x  );

    log_printf( &logger, " Accel Y : %.2f g\r\n", accel_data.y  );

    log_printf( &logger, " Accel Z : %.2f g\r\n", accel_data.z  );

    
    log_printf( &logger, "\r\n" );

    
    log_printf( &logger, " Mag X : %.2f uT\r\n", mag_data.x  );

    log_printf( &logger, " Mag Y : %.2f uT\r\n", mag_data.y  );
    
    log_printf( &logger, " Mag Z : %.2f uT\r\n", mag_data.z  );
    
 
    log_printf( &logger, "--------------------------\r\n" );

    Delay_ms( 2000 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.