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 (141237 times)
  2. FAT32 Library (74038 times)
  3. Network Ethernet Library (58662 times)
  4. USB Device Library (48767 times)
  5. Network WiFi Library (44489 times)
  6. FT800 Library (44034 times)
  7. GSM click (30784 times)
  8. mikroSDK (29606 times)
  9. PID Library (27342 times)
  10. microSD click (27223 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 16 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.8

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 220 times

Not followed.

License: MIT license  

Accel 16 Click is a compact add-on board that contains an acceleration sensor. This board features the ADXL363, a micropower three-sensor combination including acceleration and temperature from Analog Devices. This device combines a 3-axis MEMS accelerometer, a temperature sensor, and an analog-to-digital converter (ADC) input for synchronized conversions of external signals.

No Abuse Reported

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

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

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

  • Information
  • Comments (0)

mikroSDK Library Blog


Accel 16 Click

Accel 16 Click is a compact add-on board that contains an acceleration sensor. This board features the ADXL363, a micropower three-sensor combination including acceleration and temperature from Analog Devices. This device combines a 3-axis MEMS accelerometer, a temperature sensor, and an analog-to-digital converter (ADC) input for synchronized conversions of external signals.

accel16_click.png

Click Product page


Click library

  • Author : Luka Filipovic
  • Date : Sep 2021.
  • Type : SPI type

Software Support

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

Standard key functions :

  • accel16_cfg_setup Config Object Initialization function.

    void accel16_cfg_setup ( accel16_cfg_t *cfg );
  • accel16_init Initialization function.

    err_t accel16_init ( accel16_t *ctx, accel16_cfg_t *cfg );
  • accel16_default_cfg Click Default Configuration function.

    err_t accel16_default_cfg ( accel16_t *ctx );

Example key functions :

  • accel16_get_axes Get axes data.

    err_t accel16_get_axes ( accel16_t *ctx, accel16_axes_t *axes );
  • accel16_filter_configuration Filter configuration.

    err_t accel16_filter_configuration ( accel16_t *ctx, accel16_gain_t gain, accel16_output_rate_t odr );
  • accel16_get_temperature Get temperature data.

    err_t accel16_get_temperature ( accel16_t *ctx, float *temperature );

Example Description

This showcases ability of the Click board to read x, y, and z axes data in different resolution, read IC temperature and also have additional functionality to read ADC data. Device also has ability to store data in internal fifo buffer.

The demo application is composed of two sections :

Application Init

Initialization of communication modules(SPI, UART) and additional interrupt pins. Reads device ID's and revision. Then configures device to work in FIFO mode or to read data from the registers, sets 2g resolution, 12.5Hz output data rate, sets interrupt 1 active low, powers on device, and calibrates temperature.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    accel16_cfg_t accel16_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.
    accel16_cfg_setup( &accel16_cfg );
    ACCEL16_MAP_MIKROBUS( accel16_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == accel16_init( &accel16, &accel16_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    accel16.application_type = ACCEL16_APPLICATION_REG;

    uint8_t temp_buf[ 4 ] = { 0 };

    accel16_multiple_reg_read( &accel16, ACCEL16_REG_DEVID_AD, temp_buf, 4 );
    log_printf( &logger, " > ID0: 0x%.2X\r\n > ID1: 0x%.2X\r\n > ID2: 0x%.2X\r\n > REV: 0x%.2X\r\n", 
                ( uint16_t ) temp_buf[ 0 ], ( uint16_t ) temp_buf[ 1 ], 
                ( uint16_t ) temp_buf[ 2 ], ( uint16_t ) temp_buf[ 3 ] );


    if ( ACCEL16_ERROR == accel16_default_cfg ( &accel16 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

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

Application Task

Depending of the application mode selects example.

  • If fifo example is selected waits for the interrupt to indicate that data is ready in fifo buffer and reads number of fifo entries. Data that should be read are X, Y, Z axes and temperature.
  • If register example is selected also waits for interrupt to indicate that data is ready to read. Then reads X, Y, Z axes, temperature, and ADC data.

void application_task ( void )
{   
    if ( ACCEL16_APPLICATION_FIFO == accel16.application_type )
    {
        accel16_read_fifo_data( );
    }
    else if ( ACCEL16_APPLICATION_REG == accel16.application_type )
    {
        accel16_read_reg_data( );
    }

    log_printf( &logger, "********************************************************\r\n" );
    Delay_ms ( 300 );
}

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

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

Expand 2 click

6

Expand 2 click is an accessory board in mikroBUS form factor. It includes a 16-bit I/O expander MCP23017 with SPI clock speeds up to 10 MHz for higher throughput applications. Three HARDWARE ADDRESS SEL jumpers allow you to configure board address and connect up to eight devices on the bus.

[Learn More]

Compass 5 Click

0

Compass 5 Click is a compact add-on board that contains a 3-axis magnetometer device suitable for compass application. This board features the AK09918C, a 3-axis electronic compass with high sensitive Hall sensor technology from AKM Semiconductor.

[Learn More]

RTC 18 Click

0

RTC 18 Click is a compact add-on board that accurately keeps the time of a day. This board features the RV-3032-C7, an I2C-configurable real-time clock module that incorporates an integrated CMOS circuit and an XTAL from Micro Crystal AG. The RV-3032-C7 is a temperature compensated RTC with premium accuracy (0.22 sec/day) and extremely low power consumption, allowing it to be used with a single button cell battery for an extended period. It can measure temperature with a typical accuracy of ±1°C and a resolution of 0.0625°C/step with a programmable alarm on top and bottom temperature limits. It features standard RTC functions with automatic leap year correction, and standard interrupt for Periodic Countdown Timer and Periodic Time Update (seconds, minutes), date/hour/minute alarm, and an external event.

[Learn More]