TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (405 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (133 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (141580 times)
  2. FAT32 Library (74515 times)
  3. Network Ethernet Library (59057 times)
  4. USB Device Library (49059 times)
  5. Network WiFi Library (44832 times)
  6. FT800 Library (44379 times)
  7. GSM click (31067 times)
  8. mikroSDK (29927 times)
  9. microSD click (27493 times)
  10. PID Library (27491 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Accel 31 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-11-26

Package Version: 2.1.0.1

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 51 times

Not followed.

License: MIT license  

Accel 31 Click is a compact add-on board designed for precise motion and orientation detection in space-constrained devices. This board features the BMA580, a triaxial low-g accelerometer from Bosch Sensortec, which offers a 16-bit digital resolution with measurement ranges of ±2, ±4, ±8, and ±16 g, along with flexible output data rates from 1.56Hz to 6.4kHz, enabling high adaptability and accuracy. The BMA580 supports advanced power modes, including high-performance and low-power, self-wake-up functionality, and bone conduction-based voice activity detection.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Accel 31 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Accel 31 Click" changes.

Do you want to report abuse regarding "Accel 31 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Accel 31 Click

Accel 31 Click is a compact add-on board designed for precise motion and orientation detection in space-constrained devices. This board features the BMA580, a triaxial low-g accelerometer from Bosch Sensortec, which offers a 16-bit digital resolution with measurement ranges of ±2, ±4, ±8, and ±16 g, along with flexible output data rates from 1.56Hz to 6.4kHz, enabling high adaptability and accuracy. The BMA580 supports advanced power modes, including high-performance and low-power, self-wake-up functionality, and bone conduction-based voice activity detection.

accel31_click.png

Click Product page


Click library

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

Software Support

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

Standard key functions :

  • accel31_cfg_setup Config Object Initialization function.

    void accel31_cfg_setup ( accel31_cfg_t *cfg );
  • accel31_init Initialization function.

    err_t accel31_init ( accel31_t *ctx, accel31_cfg_t *cfg );
  • accel31_default_cfg Click Default Configuration function.

    err_t accel31_default_cfg ( accel31_t *ctx );

Example key functions :

  • accel31_get_data This function reads the accelerometer and temperature measurement data.

    err_t accel31_get_data ( accel31_t *ctx, accel31_data_t *data_out );
  • accel31_set_accel_odr This function sets the accel measurement output data rate.

    err_t accel31_set_accel_odr ( accel31_t *ctx, uint8_t odr );
  • accel31_set_accel_fsr This function sets the accel measurement full scale range.

    err_t accel31_set_accel_fsr ( accel31_t *ctx, uint8_t fsr );

Example Description

This example demonstrates the use of Accel 31 Click board by reading and displaying the accelerometer data (X, Y, and Z axis) and 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;  /**< Logger config object. */
    accel31_cfg_t accel31_cfg;  /**< Click config object. */

    /** 
     * 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.
    accel31_cfg_setup( &accel31_cfg );
    ACCEL31_MAP_MIKROBUS( accel31_cfg, MIKROBUS_1 );
    err_t init_flag = accel31_init( &accel31, &accel31_cfg );
    if ( ( I2C_MASTER_ERROR == init_flag ) || ( SPI_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( ACCEL31_ERROR == accel31_default_cfg ( &accel31 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Checks for a new data ready indication and then reads the accelerometer and temperature measurements. The results are displayed on the USB UART at 12.5 Hz output data rate.

void application_task ( void )
{
    accel31_data_t meas_data;
    if ( ACCEL31_OK == accel31_get_data ( &accel31, &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, " Temperature: %d degC\r\n\n", ( int16_t ) meas_data.temperature );
        Delay_ms ( 80 );
    }
}

Note

The Click board determines the communication protocol at the first communication check after power-up. In the case of I2C, the IC responds with NACK on the first check, which blocks the I2C bus on some MCUs. Re-running the program (without power cycling the Click board power supply) should unlock the communication and solve this issue.

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.Accel31

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.


ALSO FROM THIS AUTHOR

Bluetooth Switch

1

This example demonstrates wireless Bluetooth switch control, using clicker2 for STM32, Bluetooth click board and Android smart phone.

[Learn More]

GNSS RTK Click

0

GNSS RTK Click is a compact add-on board used to enhance the precision of position data derived from satellite-based positioning systems. This board features the ZED-F9P, a multi-band GNSS module with integrated multi-band Real Time Kinematics (RTK) technology offering centimeter-level accuracy from U-blox. This module concurrently uses GNSS signals from all four GNSS constellations (GPS, GLONASS, Galileo, and BeiDou), and provides multi-band RTK with fast convergence times, reliable performance, and easy integration. It also includes moving base support, allowing both base and rover to move while computing a centimeter-level accurate position between them.

[Learn More]

MCP251863 Click

0

MCP251863 Click is a compact add-on board representing a complete CAN solution used as a control node in a CAN network. This board features the MCP251863, IC representing a compact solution with a controller and a transceiver in one package, the MCP2518FD and ATA6563 from Microchip. The ATA6563, a low-level physical layer IC (PHY), provides a physical connection with the CAN bus itself, while the CAN controller MCP2518FD represents an interface between the MCU and the PHY. It features three operating modes with dedicated fail-safe features, remote wake-up via CAN, and ideally passive behavior when powered off on the CAN bus. This Click board™ is suitable for developing a wide range of automotive diagnostic applications, even on MCUs that don’t support CAN interface.

[Learn More]