TOP Contributors

  1. MIKROE (2642 codes)
  2. Alcides Ramos (347 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 (136218 times)
  2. FAT32 Library (69479 times)
  3. Network Ethernet Library (55705 times)
  4. USB Device Library (45989 times)
  5. Network WiFi Library (41639 times)
  6. FT800 Library (40780 times)
  7. GSM click (28788 times)
  8. PID Library (26327 times)
  9. mikroSDK (26051 times)
  10. microSD click (25139 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

LightRanger 10 click

Rating:

0

Author: MIKROE

Last Updated: 2024-01-31

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Optical

Downloaded: 75 times

Not followed.

License: MIT license  

LightRanger 10 Click is a compact add-on board suitable for range-finding and distance sensing applications. This board features the VL53L4CX, a ToF (time of flight) optical distance sensor with an extended target detection range from STMicroelectronics. Specifically designed for long-range and multi-target measurements, the VL53L4CX provides very accurate distance measurements up to 6m with excellent results over short distances and 18° FoV (Field of View), which improves performances under ambient light. Data processing is performed inside the VL53L4CX, providing distance information and confidence values through its I2C interface.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "LightRanger 10 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "LightRanger 10 click" changes.

Do you want to report abuse regarding "LightRanger 10 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


LightRanger 10 click

LightRanger 10 Click is a compact add-on board suitable for range-finding and distance sensing applications. This board features the VL53L4CX, a ToF (time of flight) optical distance sensor with an extended target detection range from STMicroelectronics. Specifically designed for long-range and multi-target measurements, the VL53L4CX provides very accurate distance measurements up to 6m with excellent results over short distances and 18° FoV (Field of View), which improves performances under ambient light. Data processing is performed inside the VL53L4CX, providing distance information and confidence values through its I2C interface.

lightranger10_click.png

click Product page


Click library

  • Author : Stefan Filipovic
  • Date : May 2022.
  • Type : I2C type

Software Support

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

Standard key functions :

  • lightranger10_cfg_setup Config Object Initialization function.

    void lightranger10_cfg_setup ( lightranger10_cfg_t *cfg );
  • lightranger10_init Initialization function.

    err_t lightranger10_init ( lightranger10_t *ctx, lightranger10_cfg_t *cfg );
  • lightranger10_default_cfg Click Default Configuration function.

    err_t lightranger10_default_cfg ( lightranger10_t *ctx );

Example key functions :

  • lightranger10_get_int_pin This function returns the INT pin logic state.

    uint8_t lightranger10_get_int_pin ( lightranger10_t *ctx );
  • lightranger10_clear_interrupts This function clears the interrupts.

    err_t lightranger10_clear_interrupts ( lightranger10_t *ctx );
  • lightranger10_get_distance This function reads the target object distance in millimeters.

    err_t lightranger10_get_distance ( lightranger10_t *ctx, uint16_t *distance_mm );

Example Description

This example demonstrates the use of LightRanger 10 click board by reading and displaying the target object distance in millimeters.

The demo application is composed of two sections :

Application Init

Initializes the driver, performs the click default configuration, and then calibrates the sensor to the object positioned at 200mm distance from the sensor.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    lightranger10_cfg_t lightranger10_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.
    lightranger10_cfg_setup( &lightranger10_cfg );
    LIGHTRANGER10_MAP_MIKROBUS( lightranger10_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == lightranger10_init( &lightranger10, &lightranger10_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( LIGHTRANGER10_ERROR == lightranger10_default_cfg ( &lightranger10 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_printf( &logger, " --- Sensor calibration --- \r\n" );
    log_printf( &logger, " Place an object at 200mm distance from sensor in the next 5 seconds.\r\n" );
    Delay_ms( 5000 );
    log_printf( &logger, " Sensor calibration is in progress...\r\n" );
    if ( LIGHTRANGER10_ERROR == lightranger10_calibrate_distance ( &lightranger10, 200 ) )
    {
        log_error( &logger, " Sensor calibration." );
        for ( ; ; );
    }

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

Application Task

Waits for the data ready interrupt, then clears the interrupt and reads the target distance in millimeters and displays the results on the USB UART every 200ms approximately.

void application_task ( void )
{
    while ( lightranger10_get_int_pin ( &lightranger10 ) );

    uint16_t distance_mm;
    if ( ( LIGHTRANGER10_OK == lightranger10_clear_interrupts ( &lightranger10 ) ) && 
         ( LIGHTRANGER10_OK == lightranger10_get_distance ( &lightranger10, &distance_mm ) ) )
    {
        log_printf ( &logger, " Distance: %u mm \r\n\n", distance_mm );
    }
}

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

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

Charger 16 click

0

Charger 16 Click is a compact add-on board that represents a single-cell battery charger. This board features the LT1571, a constant-current/constant-voltage battery charger with preset voltage and termination flag from Analog Devices.

[Learn More]

6DOF IMU 7 click

0

6DOF IMU 7 click is based on the ICM-20649, a high-performance, 6-axis MEMS MotionTracking™ IC from TDK Invensense. It is an advanced, integrated microelectromechanical gyroscope and accelerometer sensor (MEMS). This allows very high integration and very small dimensions, at an affordable cost.

[Learn More]

Angle 10 click

0

Angle 10 Click is a compact add-on board that detects the absolute angular position of a permanent magnet. This board features the AS5070A, a high-resolution angular position sensor with an analog output for precise absolute angle measurement from ams AG. Based on a Hall sensor technology, the AS5070A measures the orthogonal component of the flux density over a full-turn rotation and compensates for external stray magnetic fields with a robust architecture based on a 14-bit sensor array and analog front-end. Only a simple two-pole magnet rotating over the center of the AS5070A is required to measure the angle, providing an instant indication of the magnet’s angular position.

[Learn More]