accel6  2.0.0.0
Main Page

Accel 6 click

Accel 6 click is a three-axis acceleration sensor with many features. It uses the BMA280, a 14bit triaxial acceleration sensor with intelligent on-chip motion triggered interrupt controller, from Bosch Sensortec.

click Product page


Click library

Software Support

We provide a library for the Accel6 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 Accel6 Click driver.

Standard key functions :

Example key functions :

Examples Description

This application allows acceleration measurement in three perpendicular axes.

The demo application is composed of two sections :

Application Init

Initializes Driver init and settings accelerometer data range, bandwidth, mode and sleep timer which are necessary for the init chip.

void application_init ( void )
{
log_cfg_t log_cfg;
// Logger initialization.
log_cfg.level = LOG_LEVEL_DEBUG;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
ACCEL6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
accel6_init( &accel6, &cfg );
accel6_soft_reset( &accel6 );
Delay_1sec();
log_info( &logger, "---- Device reset done ----" );
log_info( &logger, "---- Device configuration done ----" );
Delay_1sec();
}

Application Task

Reads the accel X / Y / Z axis data in mg, Temperature data in C, detects the orientation of the X,Y and Z axis and checking on which axis the tap is detected. All data logs on usb uart for every 500 ms.

{
uint8_t tap_detect;
uint8_t orient;
uint8_t z_orient;
uint8_t xy_orient;
float f_axis = 0.0;
float temp = 0.0;
f_axis = accel6_get_axis ( &accel6, ACCEL6_AXIS_X );
log_printf( &logger, " X axis: %f mg \r\n ", f_axis );
f_axis = accel6_get_axis ( &accel6, ACCEL6_AXIS_Y );
log_printf( &logger, " Y axis: %f mg \r\n ", f_axis );
f_axis = accel6_get_axis ( &accel6, ACCEL6_AXIS_Z );
log_printf( &logger, " Z axis: %f mg \r\n ", f_axis );
temp = accel6_get_temperature( &accel6 );
log_printf( &logger, " Temperature: %.2f C \r\n ", temp );
accel6_get_orient( &accel6, &z_orient, &xy_orient );
switch ( z_orient )
{
case 1:
{
log_printf( &logger, " Z orient : UPWARD looking \r\n " );
break;
}
case 2:
{
log_printf( &logger, " Z orient : DOWNWARD looking \r\n " );
break;
}
default:
{
break;
}
}
switch ( xy_orient )
{
case 1:
{
log_printf( &logger, " XY orient : UPSIDE DOWN \r\n " );
break;
}
case 2:
{
log_printf( &logger, " XY orient : LANDSCAPE LEFT \r\n " );
break;
}
case 3:
{
log_printf( &logger, " XY orient : LANDSCAPE RIGHT \r\n " );
break;
}
case 4:
{
log_printf( &logger, " XY orient : UPRIGHT \r\n " );
break;
}
default:
{
break;
}
}
tap_detect = accel6_get_tap_status( &accel6 );
switch ( tap_detect )
{
case 1:
{
log_printf( &logger, " Tap status : X negative \r\n " );
break;
}
case 2:
{
log_printf( &logger, " Tap status : Y negative \r\n " );
break;
}
case 3:
{
log_printf( &logger, " Tap status : Z negative \r\n " );
break;
}
case 4:
{
log_printf( &logger, " Tap status : X positive \r\n " );
break;
}
case 5:
{
log_printf( &logger, " Tap status : Y positive \r\n " );
break;
}
case 6:
{
log_printf( &logger, " Tap status : Z positive \r\n " );
break;
}
default:
{
break;
}
}
log_printf( &logger, " \r\n" );
Delay_ms( 2000 );
}

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:

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.