smartdof5  2.1.0.0
Main Page

Smart DOF 5 click

Smart DOF 5 Click is a compact add-on board designed for precise motion and orientation detection in automotive applications. This board features the ASM330LHHXG1, a high-accuracy 6-axis inertial measurement unit (IMU) from STMicroelectronics. It features a 3-axis accelerometer and a 3-axis gyroscope and supports dual operating modes (high-performance and low-power) with flexible communication options through SPI or I2C interfaces. Additionally, it includes the Click Snap format, enabling the autonomous use of the Snap section and integration of external sensors via the I2C Master interface.

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jul 2024.
  • Type : I2C/SPI type

Software Support

We provide a library for the Smart DOF 5 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 from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Smart DOF 5 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of Smart DOF 5 click board by reading and displaying

the accelerometer and gyroscope data (X, Y, and Z axis) as well as a temperature measurement in degrees Celsius.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
smartdof5_cfg_t smartdof5_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
smartdof5_cfg_setup( &smartdof5_cfg );
SMARTDOF5_MAP_MIKROBUS( smartdof5_cfg, MIKROBUS_1 );
err_t init_flag = smartdof5_init( &smartdof5, &smartdof5_cfg );
if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( SMARTDOF5_ERROR == smartdof5_default_cfg ( &smartdof5 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Waits for a data ready indication and then reads the accelerometer, gyroscope, and temperature

measurements. The results are displayed on the USB UART at 12.5 Hz output data rate.

void application_task ( void )
{
smartdof5_data_t meas_data;
if ( smartdof5_get_int_pin ( &smartdof5 ) )
{
if ( SMARTDOF5_OK == smartdof5_get_data ( &smartdof5, &meas_data ) )
{
log_printf( &logger, " Accel X: %.3f g\r\n", meas_data.accel.x );
log_printf( &logger, " Accel Y: %.3f g\r\n", meas_data.accel.y );
log_printf( &logger, " Accel Z: %.3f g\r\n", meas_data.accel.z );
log_printf( &logger, " Gyro X: %.1f dps\r\n", meas_data.gyro.x );
log_printf( &logger, " Gyro Y: %.1f dps\r\n", meas_data.gyro.y );
log_printf( &logger, " Gyro Z: %.1f dps\r\n", meas_data.gyro.z );
log_printf( &logger, " Temperature: %.2f degC\r\n\n", meas_data.temperature );
}
}
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.SmartDOF5

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. UART terminal is available in all MikroElektronika compilers.


smartdof5_set_accel_fsr
err_t smartdof5_set_accel_fsr(smartdof5_t *ctx, uint8_t fsr)
Smart DOF 5 set accel fsr function.
smartdof5_cfg_setup
void smartdof5_cfg_setup(smartdof5_cfg_t *cfg)
Smart DOF 5 configuration object setup function.
SMARTDOF5_OK
@ SMARTDOF5_OK
Definition: smartdof5.h:566
application_task
void application_task(void)
Definition: main.c:67
smartdof5_init
err_t smartdof5_init(smartdof5_t *ctx, smartdof5_cfg_t *cfg)
Smart DOF 5 initialization function.
SMARTDOF5_ERROR
@ SMARTDOF5_ERROR
Definition: smartdof5.h:567
smartdof5_cfg_t
Smart DOF 5 Click configuration object.
Definition: smartdof5.h:516
smartdof5_axes_t::x
float x
Definition: smartdof5.h:542
smartdof5_s
Smart DOF 5 Click context object.
Definition: smartdof5.h:493
smartdof5_default_cfg
err_t smartdof5_default_cfg(smartdof5_t *ctx)
Smart DOF 5 default configuration function.
smartdof5_axes_t::y
float y
Definition: smartdof5.h:543
smartdof5_data_t::temperature
float temperature
Definition: smartdof5.h:556
application_init
void application_init(void)
Definition: main.c:30
smartdof5_get_data
err_t smartdof5_get_data(smartdof5_t *ctx, smartdof5_data_t *data_out)
Smart DOF 5 get data function.
SMARTDOF5_MAP_MIKROBUS
#define SMARTDOF5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: smartdof5.h:458
smartdof5_data_t
Smart DOF 5 Click data structure.
Definition: smartdof5.h:553
smartdof5_data_t::gyro
smartdof5_axes_t gyro
Definition: smartdof5.h:555
smartdof5_axes_t::z
float z
Definition: smartdof5.h:544
smartdof5_data_t::accel
smartdof5_axes_t accel
Definition: smartdof5.h:554
smartdof5_get_int_pin
uint8_t smartdof5_get_int_pin(smartdof5_t *ctx)
Smart DOF 5 get int pin function.