TOP Contributors

  1. MIKROE (2663 codes)
  2. Alcides Ramos (358 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 (137081 times)
  2. FAT32 Library (70222 times)
  3. Network Ethernet Library (56094 times)
  4. USB Device Library (46413 times)
  5. Network WiFi Library (42032 times)
  6. FT800 Library (41375 times)
  7. GSM click (29109 times)
  8. mikroSDK (26555 times)
  9. PID Library (26487 times)
  10. microSD click (25486 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 4 click

Rating:

5

Author: MIKROE

Last Updated: 2018-09-30

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optical

Downloaded: 4476 times

Not followed.

License: MIT license  

Light Ranger 4 click is an accurate distance measurement Click boardâ„¢ based on a ToF (Time of Flight) measurement principle. The FlightSense enabled VL53L1X rangefinder module from STMicroelectronics is a complete measurement stack on the chip.

No Abuse Reported

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

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

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

  • mikroSDK Library 2.0.0.0
  • Comments (1)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

LightRanger 4 click

LightRanger 4 click

Native view of the LightRanger 4 click board.

View full image
LightRanger 4 click

LightRanger 4 click

Front and back view of the LightRanger 4 click board

View full image

Library Description

The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in registers and reading data from registers. The library includes functions for full Configuration chip, sets measurement distance mode, inter measurement period, timing budget and user Roi. The user has the functions available for softReset, power on procedure, read distance of the object in front of the sensor

Key functions:

  • uint8_t lightranger4_deviceConfiguration() - Functions for device configuration
  • void lightranger4_startMeasurement(uint32_t period_ms) - Functions for start measurement
  • uint16_t lightranger4_getDistance() - Function reads distance of the object in front of the sensor

Example description

The application is composed of three sections:

  • System Initialization - Initializes I2C module and set INT pin as INPUT and RST pin as OUTPUT
  • Application Initialization - Initializes the driver init, chip configuration, adjusts the LONG mode (distance measurement up to 4 meters), sets the time budget and start measurement with the adjustment of inter measurements period.
  • Application Task - (code snippet) - Reads the distance of the object in front of the sensor and logs distance to USBUART every 500 ms.
void applicationTask()
{
 while(lightranger4_newDataReady() != 0)
 {
 Delay_1ms();
 }

 distance = lightranger4_getDistance();
 IntToStr(distance, demoText);
 mikrobus_logWrite(" - Distance : ", _LOG_TEXT);
 mikrobus_logWrite(demoText, _LOG_TEXT);
 mikrobus_logWrite(" mm ", _LOG_LINE);

 measurementStatus = lightranger4_getRangeStatus();
 switch (measurementStatus)
 {
 case _LR4_MRESP_SIGNAL_FAIL:
 {
 mikrobus_logWrite( "Signal fail.", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_PHASE_OUT_OF_VALID_LIMITS:
 {
 mikrobus_logWrite( "Phase out of valid limits", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_SIGMA_FAIL:
 {
 mikrobus_logWrite( "Sigma Fail. ", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_WRAP_TARGET_FAIL:
 {
 mikrobus_logWrite( "Wrap target fail.", _LOG_LINE);
 break;
 }
 case _LR4_MRESP_MINIMUM_DETECTION_THRESHOLD:
 {
 mikrobus_logWrite( "Target is below minimum detection threshold. ", _LOG_LINE);
 break;
 }
 default:
 {
 break;
 }
 }

 Delay_ms( 500 );
}


Other mikroE Libraries used in the example:

  • I2C

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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

MIC33153 click

0

MIC33153 click is a DC-DC adjustable step-down (buck) converter that is designed to deliver a substantial amount of current to very demanding loads, with the voltage output up to 3.5V.

[Learn More]

DAC 4 click

5

DAC 4 Click carries Microchip’s MCP4728 IC, a Quad Digital-to-Analog Converter with nonvolatile (EEPROM) Memory. The digital value is converted to the appropriate voltage level in the range between GND and VCC, which is proportional to the received 12-bit number.

[Learn More]

LightHz click

0

LightHz Click is a compact add-on board that effectively measures ambient light intensity. This board features the TL2L30BR, a programmable light-to-frequency converter from ams. The sensor outputs either a pulse train or a square wave (50% duty cycle) with a frequency directly proportional to light intensity (irradiance). It has programmable sensitivity and full-scale output frequency and could be used as a rough color detector with a selectable frequency range.

[Learn More]