TOP Contributors

  1. MIKROE (2652 codes)
  2. Alcides Ramos (351 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 (136600 times)
  2. FAT32 Library (69803 times)
  3. Network Ethernet Library (55879 times)
  4. USB Device Library (46209 times)
  5. Network WiFi Library (41856 times)
  6. FT800 Library (41065 times)
  7. GSM click (28941 times)
  8. PID Library (26400 times)
  9. mikroSDK (26306 times)
  10. microSD click (25322 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: 4442 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

Proximity 13 click

5

Proximity 13 Click based on SI1153-AB09-GMR IC from Silicon Labs that can be used as an proximity, and gesture detector with I2C digital interface and programmable-event interrupt output. The host can send command the Proximity 13 click to initiate on-demand proximity measurements.

[Learn More]

Air quality 2 click

5

Air quality 2 click carries the iAQ-Core Indoor Air Quality sensor that measures VOC levels and provides CO2 equivalent and TVOC equivalent predictions. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target MCU over I2C.

[Learn More]

SwipeSwitch click

0

SwipeSwitch click is capacitive touch, gesture, and proximity sensing Click board™, which is equipped with the IQS266, an integrated trackpad controller circuit which features ProxSense® and IQ Switch® technologies. This IC consists of a 2x3-channel capacitive trackpad controller, and a single self-capacitive proximity sensor, which can be used to wake up the device. This ensures very low power consumption, as the device is able to stay in the Sleep mode when not used. The IQS266 can detect a number of various configurable swipe and tap gestures. An Automatic Tuning Implementation (ATI) feature ensures an optimized performance in various conditions.

[Learn More]