Intermediate
30 min

Experience next-generation of motion sensing through IIS3DWB and PIC32MZ1024EFH064

Precision in every dimension: Elevate your motion sensing experience

Accel 14 Click with PIC32MZ clicker

Published Oct 08, 2023

Click board™

Accel 14 Click

Dev Board

PIC32MZ clicker

Compiler

NECTO Studio

MCU

PIC32MZ1024EFH064

We aim to empower your projects with the precision of three-axis acceleration technology, allowing you to measure, analyze, and excel in motion-related tasks

A

A

Hardware Overview

How does it work?

Accel 14 Click is based on the IIS3DWB, an ultra-wide bandwidth, low-noise, 3-axis digital vibration sensor from STMicroelectronics. The wide bandwidth, low noise, and very stable and repeatable sensitivity, together with the capability of operating over an extended temperature range, make this device particularly suitable for vibration monitoring in industrial applications. The IIS3DWB has a selectable full-scale acceleration range of ±2/±4/±8/±16 g and is capable of measuring accelerations with a bandwidth of up to 6 kHz with an output data rate of 26.7 kHz. A 3 kB first-in, first-out (FIFO) buffer is integrated into the device to avoid any data loss and limit the host processor's intervention. Accel 14 Click offers two possible operating configurations: Power-Down and Normal Mode. IIS3DWB has a voltage supply range from 2.1V to 3.6V. To avoid potential conflicts, it is recommended to set the lines connected to the device IO pins to a high-impedance state on the

host side during the power-on sequence. Furthermore, to guarantee the proper power-off of the device, it is recommended to maintain the duration of the VDD line to GND for at least 100 μs. After the power supply is applied, the IIS3DWB performs a 10 ms boot procedure to load the trimming parameters. After the boot is completed, the accelerometer is automatically configured in Power-Down mode. When the sensor is in Power-Down mode, almost all internal blocks of the device are switched off. The SPI digital interface remains active to allow communication with the device. The content of the configuration registers is preserved, and the output data registers are not updated, keeping the last data sampled in memory before going into Power-Down mode. When Accel 14 Click is set in Normal Mode, all three axes (X, Y, Z) are simultaneously active, and acceleration data can be read from the sensor concurrently for the 3-axis. The sensor provides

acceleration data at an output data rate of 26.667kHz. The IIS3DWB has been specifically designed to provide a wide bandwidth with a very flat frequency response in the passband and very high attenuation in the stopband to eliminate any frequency aliasing virtually. The device's functionality and measured acceleration data are accessible through the SPI interface. Also, the user can completely program functions such as the threshold and the timing of the two interrupt pins through the SPI digital interface. 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.

Accel 14 Click top side image
Accel 14 Click bottom side image

Features overview

Development board

PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under

any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard

and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

PIC32MZ clicker double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

1024

Silicon Vendor

Microchip

Pin count

64

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
Interrupt 2
RE5
RST
SPI Chip Select
RG9
CS
SPI Clock
RG6
SCK
SPI Data OUT
RG7
MISO
SPI Data IN
RG8
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Interrupt 1
RB5
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Accel 14 Click Schematic schematic

Step by step

Project assembly

PIC32MZ clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the PIC32MZ clicker as your development board.

PIC32MZ clicker front image hardware assembly
Thermo 26 Click front image hardware assembly
Prog-cut hardware assembly
Micro B Connector clicker - 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
Flip&Click PIC32MZ 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

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

Software Support

Library Description

This library contains API for Accel 14 Click driver.

Key functions:

  • accel14_check_accel_data_ready - Check accel data ready function

  • accel14_get_temperature - Get temperature function

  • accel14_read_accel - Read Accel data 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 Accel14 Click example
 * 
 * # Description
 * This application measures accelermeter data.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * SPI, check device ID, sets default configuration, also write log.
 * 
 * ## Application Task  
 * This is an example which demonstrates the use of Accel 14 Click board.
 * Measured and display Acceleration data 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.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "accel14.h"

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

static accel14_t accel14;
static log_t logger;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    accel14_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.

    accel14_cfg_setup( &cfg );
    ACCEL14_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    accel14_init( &accel14, &cfg );

    Delay_ms( 100 );

    log_printf( &logger, "   Driver init done   \r\n" );
    log_printf( &logger, "--------------------- \r\n" );
    log_printf( &logger, " Communication check  \r\n" );

    if ( accel14_check_communication( &accel14 ) == ACCEL14_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 ( ; ; );
    }

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

    log_printf( &logger, "  Acceleration data:  \r\n" );
    log_printf( &logger, "--------------------- \r\n" );
}

void application_task ( void )
{
    accel14_accel_t accel_data;
    uint8_t data_ready_flag;

    data_ready_flag = accel14_check_accel_data_ready( &accel14 );
    Delay_ms( 10 );

    if ( data_ready_flag == ACCEL14_NEW_DATA_AVAILABLE )
    {
        accel14_get_data ( &accel14, &accel_data );

        log_printf( &logger, "  Accel X : %d \r\n", accel_data.x );
        log_printf( &logger, "  Accel Y : %d \r\n", accel_data.y );
        log_printf( &logger, "  Accel Z : %d \r\n", accel_data.z );
        log_printf( &logger, "--------------------- \r\n" );
        Delay_ms( 1000 );
    }
}

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.