proximity16 2.1.0.0
Main Page

Proximity 16 click

‍Proximity 16 Click is a compact add-on board that contains a close-range proximity sensing solution. This board features the VL53L5CX, a Time-of-Flight (ToF) multizone ranging sensor from STMicroelectronics. The VL53L5CX integrates a SPAD array, physical infrared filters, and diffractive optical elements (DOE) to achieve the best-ranging performance in various ambient lighting conditions with different cover glass materials. It allows absolute distance measurement, whatever the target color and reflectance, provides accurate ranging up to 400cm, and can work at fast speeds (60Hz). Also, multizone distance measurements are possible with either 4x4 or 8x8 separate zones with broad 63° diagonal software-configurable Field-of-View (FoV).

click Product page


Click library

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

Software Support

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

Standard key functions :

Example key functions :

Example Description

‍This example demonstrates the use of Proximity 16 click board by reading and displaying 8x8 zones measurements on the USB UART.

The demo application is composed of two sections :

Application Init

‍Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
proximity16_cfg_t proximity16_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
proximity16_cfg_setup( &proximity16_cfg );
PROXIMITY16_MAP_MIKROBUS( proximity16_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == proximity16_init( &proximity16, &proximity16_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( PROXIMITY16_ERROR == proximity16_default_cfg ( &proximity16 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define PROXIMITY16_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition proximity16.h:191
void application_init(void)
Definition main.c:29
@ PROXIMITY16_ERROR
Definition proximity16.h:256

Application Task

‍Reads all zone measurements approximately every 500ms and logs them to the USB UART as an 8x8 map. The silicon temperature measurement in degrees Celsius is also displayed.

void application_task ( void )
{
if ( !proximity16_get_int_pin ( &proximity16 ) )
{
uint8_t resolution, map_side;
err_t error_flag = proximity16_get_resolution ( &proximity16, &resolution );
error_flag |= proximity16_get_ranging_data ( &proximity16, &results );
if ( PROXIMITY16_OK == error_flag )
{
map_side = ( PROXIMITY16_RESOLUTION_4X4 == resolution ) ? 4 : 8;
log_printf ( &logger, "\r\n %ux%u MAP (mm):\r\n", ( uint16_t ) map_side, ( uint16_t ) map_side );
for ( uint16_t cnt = 1; cnt <= resolution; cnt++ )
{
log_printf ( &logger, " %u\t", results.distance_mm[ cnt - 1 ] );
if ( 0 == ( cnt % map_side ) )
{
log_printf ( &logger, "\r\n" );
}
}
log_printf ( &logger, " Silicon temperature : %d degC\r\n", ( int16_t ) results.silicon_temp_degc );
}
}
}
#define PROXIMITY16_RESOLUTION_4X4
Proximity 16 resolution setting.
Definition proximity16.h:122
void application_task(void)
Definition main.c:65
@ PROXIMITY16_OK
Definition proximity16.h:255
int16_t distance_mm[PROXIMITY16_RESOLUTION_8X8]
Definition proximity16.h:273
int8_t silicon_temp_degc
Definition proximity16.h:267

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

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.