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 (137100 times)
  2. FAT32 Library (70236 times)
  3. Network Ethernet Library (56125 times)
  4. USB Device Library (46434 times)
  5. Network WiFi Library (42077 times)
  6. FT800 Library (41388 times)
  7. GSM click (29116 times)
  8. mikroSDK (26562 times)
  9. PID Library (26496 times)
  10. microSD click (25487 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: 4483 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

Oximeter click

0

Oximeter click is a versatile photometric Click board�, perfectly suited for measuring the blood oxygen saturation. It employs ADPD105, a highly configurable photometric front end (AFE) device from Analog Devices.

[Learn More]

Accel 24 click

0

Accel 24 Click is a compact add-on board that contains an acceleration sensor. This board features the MXC6655XA, a 12-bit three-axis accelerometer from MEMSIC. It allows selectable full-scale acceleration measurements in ranges of ±2g, ±4g, or ±8g in three axes with a compatible I2C serial interface with 400KHz fast mode operation. Alongside low offset and temperature signal with high accuracy, the MXC6655XA also detects six orientation positions, X/Y shake, and shake directions with an appropriate interrupt signal for these states.

[Learn More]

13DOF click

5

13DOF Click is an advanced 13-axis motion tracking Click board, which utilizes three different sensor ICs onboard: BME680, a digital gas, humidity, pressure and temperature sensor and BMM150, a geomagnetic sensor and a BMI088, small, versatile 6DoF sensor module.

[Learn More]