TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (136874 times)
  2. FAT32 Library (70000 times)
  3. Network Ethernet Library (55999 times)
  4. USB Device Library (46305 times)
  5. Network WiFi Library (41922 times)
  6. FT800 Library (41206 times)
  7. GSM click (29012 times)
  8. PID Library (26423 times)
  9. mikroSDK (26396 times)
  10. microSD click (25386 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 6 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.17

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 100 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Accel 6 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Accel 6 click" changes.

Do you want to report abuse regarding "Accel 6 click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


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.

accel6_click.png

click Product page


Click library

  • Author : MikroE Team
  • Date : dec 2019.
  • Type : I2C/SPI type

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 :

  • Config Object Initialization function.

    void accel6_cfg_setup ( accel6_cfg_t *cfg );

  • Initialization function.

    ACCEL6_RETVAL accel6_init ( accel6_t ctx, accel6_cfg_t cfg );

  • Click Default Configuration function.

    void accel6_default_cfg ( accel6_t *ctx, uint8_t range_data, uint8_t bw_data, uint8_t lpw_data );

Example key functions :

  • Functions for set offset

    void accel6_data_offset ( accel6_t ctx, uint8_t set_offset, float offset_data );

  • Functions for read orient

    void accel6_get_orient ( accel6_t ctx, uint8_t z_orient, uint8_t *xy_orient );

  • Functions for read axis data

    float accel6_get_axis ( accel6_t *ctx, uint8_t axis );

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;
    accel6_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.

    accel6_cfg_setup( &cfg );
    ACCEL6_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    accel6_init( &accel6, &cfg );

    accel6_soft_reset( &accel6 );
    Delay_1sec();
    log_info( &logger, "---- Device reset done ----" );

    accel6_default_cfg( &accel6, ACCEL6_PMU_RANGE_4g, 
                                          ACCEL6_PMU_BW_125Hz, 
                                          ACCEL6_PMU_LPW_NORMAL_MODE | 
                                          ACCEL6_PMU_LPW_SLEEP_10ms );

    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.


void application_task ( )
{
    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 ( 1000 );
    Delay_ms ( 1000 );
}

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:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Accel6

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.


ALSO FROM THIS AUTHOR

NFC 5 click

0

NFC 5 Click is a compact add-on board designed for advanced NFC applications. This board features the ST25R3918, a multipurpose NFC transceiver from STMicroelectronics. This Click board™ is built to cater to the growing needs of the Internet of Things (IoT) ecosystem, providing robust NFC reader functionalities, passive peer-to-peer communication, and card emulation modes with outstanding analog performance. Its notable features include exceptional read range with minimal power output, advanced noise reduction, and compatibility with ISO14443, ISO15693, and NFC Forum Tag types 1, 2, 4, and 5.

[Learn More]

Button PLAY click

0

Button PLAY click is a very interesting interactive gadget on a Click board™. It is an integrated capacitive touch sensor display in the form of a button. By utilizing an advanced capacitive touch sensing technology, the CTHS15CIC05ARROW sensor can successfully replace the traditional mechanical button, allowing very simplified yet reliable user interfaces to be developed. Besides the touch detection, this sensor also features a green arrow icon with backlight, which makes the Click board™ very useful for building various stylized and visually appealing interfaces.

[Learn More]

Motion 2 click

0

Motion 2 Click is a Click board™ based on EKMC1607112, PIR motion sensor from Panasonic Corporation that's used as human motion detector. Also featured on Motion 2 Click bord is TLP241A photorelay from Toshiba that is used to provide a reinforced galvanic isolation for the external signals used to drive some external high power electronic equipment when motion is detected. It's allowing up to 40V between the SSR contacts in OFF state, and currents up to 2A while in ON state, thanks to a very low ON-state resistance. Motion 2 Click board™ is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.

[Learn More]