Time of Flight Laser Ranging Sensor SG S53 L0X

Time of Flight Laser Ranging Sensor SG-S53-L0X

Overview

This product uses I2C interface to achieve distance measurement, with a measurement distance of up to 2 meters; Supports Raspberry Pi models, as well as Arduino and STM32; We provide C and Python versions of Raspberry Pi demo codes, as well as Arduino and STM32 versions of demo codes. The demo codes can achieve three ranging working modes: single ranging, continuous ranging, and timed ranging, as well as four ranging configuration modes: default mode, high speed, high accuracy, and long range.

Parameters

Supply voltage3.3V/5V
Ranging distance30~2000mm
Ranging accuracy±5%( high speed mode),±3%(high accuracy mode)
Ranging time (min)20ms(short distance mode),200ms (medium/long distance mode)
Field of view25°
Laser wavelength940nm
Control ChipVL53L0X
Signal interfaceI2C
Size25mm(Length) x 18mm(width)
Weight2g
Laser Ranging Distance Sensor Module Size

Resource Profile

① PH2.0 terminal leads out control pin

② Lead out GPIO1 and XSHUT pins

③ VL53L0X ranging chipr

Usage

Raspberry Pi demo codes usage

Hardware interface configuration description

The module with Raspberry Pi motherboard wiring is defined in the following table:

PINDescribeRaspberry Pi
VCCPower supply positive(3.3V/5V)3.3V
GNDPower supply groundGND
SDAI2C data lineSDA1
SCLI2C clock lineSCL1
SHTshutdown control, can connects to IO pinNC
GP1Interrupt output, can connects to IO pinNC

Wiringpi library installation

sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb
#Version 4B upgrade of Raspberry Pi
sudo dpkg -i wiringpi-latest.deb
gpio -v 

If version 2.52 appears, the installation is successful

For the Bullseye branch system, use the following command:

git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v

Running "gpio - v" will result in version 2.70. If it does not appear, it indicates an installation error

If the error prompt "ImportError: No module named 'wiringpi'" appears when running the python version of the demo codes , run the following command

For Python 2. x version

pip install wiringpi

For Python 3. x version

pip3 install wiringpi

Note: If the installation fails, you can try the following compilation and installation:

git clone --recursive https://github.com/WiringPi/WiringPi-Python.git

Note: The -- recursive option can automatically pull the submodule, otherwise you need to download it manually.

Enter the WiringPi Python folder you just downloaded, enter the following command, compile and install:

For Python 2. x version

sudo python setup.py install

For Python 3. x version

sudo python3 setup.py install

If the following error occurs:

SG-S53-L0X

At this time, enter the command sudo apt install swig to install swig. After that, compile and install sudo python3 setup.py install. If a message similar to the following appears, the installation is successful.SG-S53-L0X

Turn on the I2C interface

sudo raspi-config

Enable I2C interface:

Interfacing Options -> I2C -> Yes

Restart the device.

sudo reboot

Run the command to check whether I2C and SPI are started.

lsmod

If i2c_bcm2835 and spi_bcm2835 are displayed, it means I2C, the SPI module is started.

SG-S53-L0X

Install the i2c-tools tool to confirm

sudo apt-get install i2c-tools

View connected I2C devices

i2cdetecty -y 1

Check the address and indicate that the module has successfully connected to Raspberry Pi, and the displayed address is 0X29;

SG-S53-L0X

Turn on the I2C interface

The demo codes uses the python 3 environment. To run the python demo codes , you need to install smbus:

sudo apt-get install -y python-smbus

2.1.5 Demo Codes

After downloading the demo codes, enter the Raspberry Pi/c directory and compile the code

sudo make clean
sudo make
sudo make example

The compiled code results are as follows.

SG-S53-L0X

After waiting for the program to compile, enter the bin directory

SG-S53-L0X

Run demo codes

sudo ./VL53L0X_single_example

Connect the module according to the demo codes description. After running the demo codes , the Raspberry Pi terminal outputs device information and measured distance (using a single ranging as an example)(Unit:mm).

SG-S53-L0X

Python Demo Codes

Enter the Raspberry Pi/Python directory

sudo make

Wait for the program compilation to complete, enter the example directory, and run the demo codes:

sudo python VL53L0X_singleexample.py

The routine phenomenon in the Python version is similar to that in the C language version, and the running results are shown in the following figure(Unit:mm):

SG-S53-L0X

Arduino Demo Codes Usage

Wiring instructions

PINDescribeArduino
VCCPower supply positive(3.3V/5V)5V
GNDPower supply groundGND
SDAI2C data lineSDA
SCLI2C clock lineSCL
SHTshutdown control, can connects to IO pinNC
GP1Interrupt output, can connects to IO pinNC

Demo codes usage

Open the project file demo_codes\Arduino\VL53L0X_single_example\VL53L0X_single_example.ino with the Arduino IDE, import API.zip from the Arduino directory into Arduino, as shown in the following figure.

SG-S53-L0X

Click Verify, and upload it to the development board after verification.

SG-S53-L0X

Click the tool, open the serial port monitor, set the baud rate to 115200, and observe the data changes.

SG-S53-L0X

Open the serial port monitor and the display is as follows. Set the baud rate to 115200 (as shown in "1" in the figure below). The program running results are shown in the figure below(Unit:mm):

SG-S53-L0X

STM32 Demo Codes Usage

Wiring instructions

PINDescribeArduino
VCCPower supply positive(3.3V/5V)3.3V
GNDPower supply groundGND
SDAI2C data linePB11
SCLI2C clock linePB10
SHTshutdown control, can connects to IO pinNC
GP1Interrupt output, can connects to IO pinNC

Demo codes usage

Use Keil uVision5 software to open the VL53L0X.uvprojx project file in the directory demo_codes\STM32\USER, and connect the module with STM32 according to the above table; download the program to the STM32 development board after compiling without errors;SG-S53-L0XThe debugging information output serial port in the demo codes is USART1, where PA9 is Tx and PA10 is Rx; After connecting the cable, open the Serial Port Debugging Assistant, select the serial port number, adjust the baud rate to 115200, click "Open", and the Serial Port Debugging Assistant window is shown as follows(Unit:mm):SG-S53-L0X

Resources

Schematic

Product

Data Sheet

VL53L0X

Demo Codes

Technical Support

Technical Support and Product Notes