TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137035 times)
  2. FAT32 Library (70167 times)
  3. Network Ethernet Library (56037 times)
  4. USB Device Library (46360 times)
  5. Network WiFi Library (41975 times)
  6. FT800 Library (41305 times)
  7. GSM click (29079 times)
  8. mikroSDK (26519 times)
  9. PID Library (26452 times)
  10. microSD click (25449 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 13 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.18

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 115 times

Not followed.

License: MIT license  

Accel 13 Click features an ultra-low power triaxial accelerometer sensor with embedded intelligence, labeled as the IIS2DLPC.

No Abuse Reported

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

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

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

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


Accel 13 click

Accel 13 Click features an ultra-low power triaxial accelerometer sensor with embedded intelligence, labeled as the IIS2DLPC.

accel13_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 Accel13 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 Accel13 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void accel13_cfg_setup ( accel13_cfg_t *cfg );

  • Initialization function.

    ACCEL13_RETVAL accel13_init ( accel13_t ctx, accel13_cfg_t cfg );

  • Click Default Configuration function.

    void accel13_default_cfg ( accel13_t *ctx );

Example key functions :

  • This function reads the status data and stores it in the status object.

    void accel13_get_status ( accel13_t ctx, accel13_status_t status);

  • This function reads the tap status data and stores it in the tap_status object.

    void accel13_get_tap_status ( accel13_t ctx, accel13_tap_t tap_status );

  • This function reads the 6D status data and stores it in the sixd_status object.

    void accel13_get_6d_status ( accel13_t ctx, accel13_6d_t sixd_status );

Examples Description

This application enables reading acceleration and tapping data on all 3 axes, using I2C or SPI communication.

The demo application is composed of two sections :

Application Init

Initializes driver init, Test communication, starts chip configuration for measurement and Temperature reads.


void application_init ( void )
{
    log_cfg_t log_cfg;
    accel13_cfg_t cfg;
    uint8_t device_id;
    float temperature;

    /** 
     * 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 ----\r\n" );

    //  Click initialization.

    accel13_cfg_setup( &cfg );
    ACCEL13_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    accel13_init( &accel13, &cfg );

    accel13_generic_read_bytes( &accel13, ACCEL13_REG_WHO_AM_I, &device_id, 1 );

    if ( device_id != ACCEL13_DEF_WHO_AM_I )
    {
        log_printf( &logger, "*\\*/*\\*/ Communication ERROR !!! \\*/*\\*/*" );
        for ( ; ; );
    }
    log_printf( &logger, "---- Communication OK!!! ----\r\n" );
    Delay_100ms( );

    // Configuration

    accel13_default_cfg ( &accel13 );

    accel13_generic_write_single_byte( &accel13, ACCEL13_REG_CTRL_6, ACCEL13_CTRL6_BW_FILT_ODR_2 |
                                                                     ACCEL13_CTRL6_FULL_SCALE_2g |
                                                                     ACCEL13_CTRL6_FDS_LOW_PASS |
                                                                     ACCEL13_CTRL6_LOW_NOISE_ENABLE );

    // Temperature

    temperature = accel13_get_temperature( &accel13 );
    log_printf( &logger, " Temperature : %f.2 \r\n", temperature);
}

Application Task

Reads Accelerometer data and detects tap on the axis


void application_task ( void )
{
    //  Task implementation.

    // Reads Accel data
    accel13_get_axis_data( &accel13, &axis );

    log_printf( &logger, "---- Accel axis data ----\r\n\n" );

    log_printf( &logger, "* X : %d \r\n", axis.x );

    log_printf( &logger, "* Y : %d \r\n", axis.y);

    log_printf( &logger, "* Z : %d \r\n", axis.z);
    log_printf( &logger, "-------------------------\r\n" );
    Delay_ms ( 300 );

    // Detections Tap on the axis
    accel13_get_tap_status( &accel13, &tap );

    if ( tap.tap_x == 0x01 )
    {
        log_printf( &logger, "---- Tap on the X axis ----\r\n" );
    }

    if( tap.tap_y == 0x01 )
    {
        log_printf( &logger,"---- Tap on the Y axis ----\r\n" );
    }

    if( tap.tap_z == 0x01 )
    {
        log_printf( &logger,"---- Tap on the Z axis ----\r\n" );
    }
}

Note

The example is the basic functionality of the IIS2DLPC sensor, it is possible to read the acceleration data and detect Tap on all 3 axes. For other settings and improvements in reading accuracy, you need to further set up the registers and set the sensor to your conditions.

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

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

Nano Power 3 click

0

Nano Power 3 Click is a compact add-on board that steps down voltages from its input (supply) to output (load). This board features the RPL-3.0-R, a buck converter with an integrated inductor from Recom Power. This thermally-enhanced converter uses, as input, voltage from 4 up to 18VDC, thus allowing 5V and 12V supply rails to be used.

[Learn More]

Thermo 28 click

0

Thermo 28 Click is a compact add-on board that accurately measures temperature. This board features the ams AG’s AS6221, a high-accuracy digital temperature sensor. The AS6221 consists of a Si bandgap temperature factory-calibrated sensor, 16-bit ADC, and a digital signal processor, offering a high accuracy of ±0.9°C. It provides temperature data to the host controller through a compatible I2C interface, reliability, user-selectable I2C addresses, and alert functionality, which triggers an interrupt to protect the device from excessive temperatures.

[Learn More]

Thermo 19 click

0

Thermo 19 Click is a compact add-on board that provides an accurate temperature measurement. This board features the MAX31825, a temperature sensor that provides 8-bit to 12-bit Celsius temperature measurements with better than ±1.75°C from -45°C to +145°C from Analog Devices. It has a unique 64-bit serial code stored in an on-chip ROM, an alarm output for detection of temperature faults, temperature resolution selection from 8 to 12 bits, and it allows temperature conversion to 10-bit digital word in a period of 80ms (max).

[Learn More]