TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139251 times)
  2. FAT32 Library (71749 times)
  3. Network Ethernet Library (57120 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28077 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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

Inclinometer Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.13

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 218 times

Not followed.

License: MIT license  

Inclinometer Click is a compact add-on board that offers best-in-class characteristics for inclination measurements. This board features the SCL3300, a high-performance inclinometer sensor component from Murata.

No Abuse Reported

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

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

Do you want to report abuse regarding "Inclinometer Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Inclinometer Click

Inclinometer Click is a compact add-on board that offers best-in-class characteristics for inclination measurements. This board features the SCL3300, a high-performance inclinometer sensor component from Murata.

inclinometer_click.png

Click Product page


Click library

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

Software Support

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

Standard key functions :

  • inclinometer_cfg_setup Config Object Initialization function.

    void inclinometer_cfg_setup ( inclinometer_cfg_t *cfg );
  • inclinometer_init Initialization function.

    err_t inclinometer_init ( inclinometer_t *ctx, inclinometer_cfg_t *cfg );
  • inclinometer_default_cfg Click Default Configuration function.

    err_t inclinometer_default_cfg ( inclinometer_t *ctx );

Example key functions :

  • inclinometer_get_axes Axes reading.

    err_t inclinometer_get_axes ( inclinometer_t *ctx, inclinometer_accel_t *axes_data );
  • inclinometer_get_angle Angle reading.

    err_t inclinometer_get_angle ( inclinometer_t *ctx, inclinometer_accel_t *angle_data );
  • inclinometer_get_temperature Temperature reading.

    err_t inclinometer_get_temperature ( inclinometer_t *ctx, float *temperature );

Example Description

This example showcases ability of device to configure it for resolution and read Axis/Angle/Temperature data.

The demo application is composed of two sections :

Application Init

Initialization of the Host communication modules(UART, SPI). Sets default configuration where powe-up sequence is done with selecting MODE1 and enabling output on Angle channels. Read status and checks WhoAmI register. In the end example type is selected( for reading Axes, Angles or Temperature data ).


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    inclinometer_cfg_t inclinometer_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.
    inclinometer_cfg_setup( &inclinometer_cfg );
    INCLINOMETER_MAP_MIKROBUS( inclinometer_cfg, MIKROBUS_1 );
    err_t init_flag  = inclinometer_init( &inclinometer, &inclinometer_cfg );
    if ( SPI_MASTER_ERROR == init_flag )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    //Powerup
    init_flag = inclinometer_default_cfg ( &inclinometer );
    if ( INCLINOMETER_ERROR == init_flag )
    {
        log_error( &logger, " Default configuration. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    example_type = EXAMPLE_AXIS;
    Delay_ms ( 1000 );
    log_info( &logger, " Application Task " );
}

Application Task

Depending on the example type selected task is reading different data. If EXAMPLE_AXIS selected it reads 3 axes values in range of -1<->1g. If EXAMPLE_ANGLE is slected it reads 3 angle values in range of -90<->90deg. EXAMPLE_TEMP reads temperature data from device in degC.


void application_task ( void )
{
    switch ( example_type )
    {
        case EXAMPLE_AXIS:
        {
            inclinometer_accel_t axes_data;
            inclinometer_get_axes( &inclinometer, &axes_data );
            log_printf( &logger, "> ACCEL X[g]: %.2f\r\n", axes_data.x );
            log_printf( &logger, "> ACCEL Y[g]: %.2f\r\n", axes_data.y );
            log_printf( &logger, "> ACCEL Z[g]: %.2f\r\n", axes_data.z );
            break;
        }
        case EXAMPLE_ANGLE:
        {
            inclinometer_accel_t angle_data;
            inclinometer_get_angle( &inclinometer, &angle_data );
            log_printf( &logger, "> ANGLE X[deg]: %.2f\r\n", angle_data.x );
            log_printf( &logger, "> ANGLE Y[deg]: %.2f\r\n", angle_data.y );
            log_printf( &logger, "> ANGLE Z[deg]: %.2f\r\n", angle_data.z );
            break;
        }
        case EXAMPLE_TEMP:
        {
            float temp_data = 0;
            inclinometer_get_temperature( &inclinometer, &temp_data );
            log_printf( &logger, "> Temperature[degC]: %.2f\r\n", temp_data );
            break;
        }
        default:
        {
            log_error( &logger, " Example type." );
            break;
        }
    }
    log_printf( &logger, "*************************************\r\n" );
    Delay_ms ( 100 );
}

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

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

4x4 RGB 2 Click

0

4x4 RGB 2 Click is a compact add-on board that contains a matrix of 16 intelligent RGB LEDs, forming a 4x4 display screen. This board features 16 IN-PC55TBTRGB, 5x5mm RGB LEDs with an integrated IC from Inolux. The LEDs feature an 8-bit color control in 256 steps (256-level greyscale) and a 5-bit brightness control in 32 steps. The intelligent LEDs are cascaded (daisy-chained); thus, every one of them can communicate with the host MCU using the same data lines.

[Learn More]

Angle 6 Click

0

Angle 6 Click is a compact add-on board that detects the absolute angular position of a permanent magnet, typically a diametrically magnetized cylinder on a rotating shaft. This board features the MAQ470GQE, a 12-bit contactless angle sensor with PWM output from Monolithic Power Systems. It supports a wide range of magnetic field strengths and spatial configurations, with both end-of-shaft and off-axis (side-shaft mounting), supported configurations. Fast data acquisition and processing provides accurate angle measurement at speeds from 0 to 60,000 rpm, alongside magnetic field strength detection with programmable thresholds.

[Learn More]

Qi RX Click

0

Qi RX Click is a compact add-on board made for the purpose of wireless power transfer. This board features the PIC16F15313, a general-purpose 8-bit MCU that makes a flexible, low-cost alternative to the wireless charging solutions based on ASICs from Microchip.

[Learn More]