Measure acceleration forces and achieve precise monitoring of an object's movement and its changes in velocity over time
A
A
Hardware Overview
How does it work?
Accel 8 Click is based on the MPU6050, a motion tracking sensor IC, from TDK Invensense. It is an advanced, integrated microelectromechanical gyroscope and accelerometer sensor (MEMS), combined with the powerful data processing engine. There is a respective accelerometer or gyroscope MEMS on each axis. The output of each MEMS is processed and digitized by a separate sigma-delta 16-bit A/D converter (ADC). The outputs can be processed by a programmable low-pass filter, while their sample rate can be selected by the user. Three-axis gyroscope MEMS can be programmed to measure the rotation about each axis, in four different ranges of rotational speed (degrees per angle, DPS): ±250, ±500, ±1000, and ±2000. Three-axis accelerometer MEMS can be programmed to measure the acceleration along each axis, in four different acceleration ranges: ±2g, ±4g, ±8g, and ±16g. The user can select an optimal range for both properties, depending on the application requirements. The embedded Digital Motion Processor™ can process complex 6-axis motion detection and gesture recognition algorithms without taking up processing cycles of the host microcontroller (MCU), making it perfectly suited
for different kinds of low-power applications. The DMP engine offers a high output data rate (ODR), improving measurement accuracy. Due to DMP hardware-accelerated motion detection algorithms, MPU60x0 are very popular motion tracking ICs and there are many different designs using both MPU6050 and MPU6000 (e.g. MPU IMU click). Unlike the MPU6000, the MPU6050 uses the I2C communication interface. MPU6050 incorporates a powerful programmable interrupt engine. The interrupt engine can generate a signal on the interrupt pin for several interrupt sources, including FIFO Buffer overflow, Data Ready, I2C Master Error, and I2C Slave Error. The interrupt is routed to the INT pin of the mikroBUS™. A FIFO buffer helps to further reduce the processing load, offering temporary storage for the output data. The MPU6050 features a FIFO buffer with the capacity of 1024 bytes. The user can select which data will be stored in the FIFO buffer: gyro data, accel data, temperature readings, and auxiliary sensor readings. Once the FIFO buffer is full, it will start discarding the oldest data, allowing new data to be written. The FIFO buffer overflow condition can be used to trigger an interrupt, alerting the host MCU about its status. Another powerful
feature of the MPU6050 is its ability to be interfaced with an additional sensor, such as the 3-axis compass. By utilizing the MotionFusion™ firmware on the chip, along with the run-time calibration, it offers the complete 9-axis motion sensing solution. This sensor can be connected to the auxiliary I2C pins, routed to the mikroBUS™. Aux I2C clock pin is routed to the RST pin of the mikroBUS™ and it is labeled as CL, while the Aux I2C data pin is routed to the AN pin of the mikroBUS™, labeled as DA. Besides the compass sensor, other general-purpose sensors that use I2C interface can be connected, too. An interrupt can be generated if there is an error in the communication between the MPU6050 and the auxiliary sensor. The I2C address of the MPU6050 can be selected by the ADD SEL jumper. This SMD jumper is used to select the least significant bit (LSB) of the 7-bit I2C address. The value of the LSB is decided by the position of this jumper. Accel 8 click uses the I2C communication interface. It has pull-up resistors connected to the mikroBUS™ 3.3V rail. Proper conversion of logic voltage levels should be applied before the Click board™ is used with MCUs operated with 5V.
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.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC32
MCU Memory (KB)
2048
Silicon Vendor
Microchip
Pin count
100
RAM (Bytes)
524288
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project 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.
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™.
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.
Software Support
Library Description
This library contains API for Accel 8 Click driver.
Key functions:
accel8_get_accel_axis
- This function reads Accel axis dataaccel8_get_gyro_axis
- This function reads Gyro axis dataaccel8_get_interrupt
- This function returns Interupt state
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 Accel8 Click example
*
* # Description
* This application measures accelermeter and gyroscopic data and temperature.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initialization driver init, reset chip and start configuration chip for measurement.
*
* ## Application Task
* Reads Accel X/Y/Z axis, Gyro X/Y/Z axis and device Temperature.
* All data logs on the USBUART every 2 sec.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "accel8.h"
// ------------------------------------------------------------------ VARIABLES
static accel8_t accel8;
static log_t logger;
static range_retval_t range;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
accel8_cfg_t cfg;
uint8_t temp_write;
/**
* 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.
accel8_cfg_setup( &cfg );
ACCEL8_MAP_MIKROBUS( cfg, MIKROBUS_1 );
temp_write = accel8_init( &accel8, &cfg );
if ( temp_write == ACCEL8_INIT_ERROR )
{
log_info( &logger, "ERROR\r\n" );
for ( ; ; );
}
log_printf( &logger, " *-* Device Reset *-* \r\n");
temp_write = ACCEL8_PM1_DEVICE_RESET;
accel8_generic_write( &accel8, ACCEL8_REG_PWR_MGMT_1, &temp_write, 1 );
Delay_ms( 500 );
temp_write = ACCEL8_GYRO_RESET | ACCEL8_ACCEL_RESET | ACCEL8_TEMP_RESET;
accel8_generic_write( &accel8, ACCEL8_REG_SIGNAL_PATH_RESET, &temp_write, 1 );
Delay_ms( 500 );
log_printf( &logger, " *-* Device Configuration *-* \r\n" );
accel8_default_cfg ( &accel8, ACCEL8_ACCEL_CFG_FULL_SCALE_RANGE_2g, ACCEL8_GYRO_CFG_FULL_SCALE_RANGE_250dbs, &range);
Delay_ms( 1000 );
log_printf( &logger, " --- Start Measurement --- \r\n" );Delay_ms( 100 );
}
void application_task ( void )
{
float temperature;
int16_t x_gyro_axis;
int16_t y_gyro_axis;
int16_t z_gyro_axis;
int16_t x_accel_axis;
int16_t y_accel_axis;
int16_t z_accel_axis;
// Task implementation.
accel8_get_accel_axis( &accel8,&x_accel_axis, &y_accel_axis, &z_accel_axis );
accel8_get_gyro_axis( &accel8, &x_gyro_axis, &y_gyro_axis , &z_gyro_axis );
temperature = accel8_get_temperature( &accel8 );
// LOGS DATA
log_printf( &logger, "________________ Accel 8 click _________\r\n" );
log_printf( &logger, "| Data | X axis | Y axis | Z axis | Range |\r\n" );
log_printf( &logger, "|______|______|______|_____|________|\r\n" );
log_printf( &logger, "| Accel | %d | %d | %d | %dg |\r\n", x_accel_axis, y_accel_axis, z_accel_axis, &range.accel_range );
log_printf( &logger, "|_______|______|_____|_______|_______|\r\n" );
log_printf( &logger, "| Gyro | %d | %d | %d | %ddps |\r\n", x_gyro_axis, y_gyro_axis, z_gyro_axis, &range.gyro_range );
log_printf( &logger, "|_______|_______|______|______|________|\r\n" );
log_printf( &logger, "| Temp | %.2f C |\r\n" , temperature);
log_printf( &logger, "|_______|____________|\r\n" );
log_printf( &logger, " \r\n" );
Delay_ms( 2000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END