Professional Documents
Culture Documents
Infrared Ranging Module User ManualV1.0
I. Overview
GY‑53L1 It is a low‑cost digital infrared ranging sensor module. Operating Voltage3‑5v, Low
power consumption, small size and easy installation. Its working principle is that infraredled
Glows, after illuminating the measured object, the return light passesMCUtake over,MCU
Calculate the time difference and get the distance. Output the distance value directly. For
this module, there are two ways to read data, namely serial portUART(TTL Level)+PWM
(Switching value) or chip IICMode, the baud rate of the serial port is 9600bps and
115200bps, Configurable, there are two modes of continuous and inquiry output, and the settings can be
saved after power‑off. supplyarduino,51,stm32 MCU communication program. The schematic diagram
and the source code of the internal microcontroller are not provided.
The module can also set the operating mode of a separate sensor chip,
As a simple sensor module,MCUDo not participate in data processing work. The module is newly added to set the switch output mode.
After the warning distance is set by the host computer, the test distance is lower than the set value, and the pin outputs low level.
2. Product features
(1), high cost performance
(2), built‑inMCU Calculate the distance (3), serial communication format,PWM,
Set the distance switch output. (4), with corresponding upper computer software
Three, technical parameters
name parameter
Measuring range 5cm‑4m
Response frequency 22ms(Highest)
Operating Voltage 3~5 V
Working current 0.2~20mA
Operating temperature ‑20°~ 85°
Storage temperature ‑40°~ 125°
size 25mmX15.6mm
Sensor chip VL53L1X
Four, product application
(1),smart robot
(2), teaching laboratory equipment
(3), production line product inspection
(4), infrared ranging
1
Five, pin description
Pin3 TX Serial portUSART_TX(TTL Level)
Pin4 RX serial portUSART_RX(TTL Level)
Pin5 PWM / OUT Distance conversion PWMForm output, or switch output
Pin6 PS Serial port/chip IICMode conversion (default serial port)
Notice:PS Hardware selection module working mode
ps=1(Default high level) Serial portUART model,Pin3 for TX, Pin4 forRX, TTL Level,PWMOutput work or switch output work.
ps=0(catchGNDTime) IICMode, users can operate the chip by themselves, the module comes withMCUDo not operate on the chip,PWMThe output is not working.
Six, communication protocol
Serial port protocol: whenGY‑53L1 Module hardware ps=1 When to use
(1), serial communication parameters (default baud rate value 9600bps, Can be set by software)
(2), module output format, each frame contains 8‑13 Bytes (hexadecimal):
➀.Byte0: 0x5A Frame header flag
2
Byte6 The meaning of the representative:
0: Indicates that the distance value is reliable;
1:Indicating the influence of ambient light;
2: Indicates that the returned signal is weak;
4: Indicates that the measurement range is exceeded;
5: Indicates a hardware failure;
7: Indicates that there is interference noise in the surrounding environment;
8: Overflow or overflow of internal algorithm;
14: Invalid measurement.
Refer to the original opinion in Englishpicture1, The English version shall prevail.
bit3~bit2 Indicates the measurement time of the module. The larger the value, the better the ranging effect.
0:55ms;
1:110ms;(default)
2:200ms;
3:300ms;
bit1~bit0 Indicates the measurement mode. The smaller the value, the better the anti‑interference from the surrounding environment.
1: Short‑distance mode, ranging from 40~1300 mm, 25mm; 2: Middle
distance mode, ranging range is 40~3000 mm, 25mm;(default)
3: Long‑distance mode, ranging from 40~4000 mm, 25mm;
picture1:
Data calculation method:
Distance calculation method:Distance= (Byte4<<8) | Byte5 unitmm
Module return status:RangeStatus= (Byte6>>4)&0x0f;
measure time:Time=(Byte6>>2)&0x03;
Measurement mode:Mode=Byte6&0x03;
3
Example: One frame of data
<5A‑ 5A‑ 15‑ 03‑ 0A‑ 20‑ 06‑ FC>
Distance =(0x0A<<8)|0x20=2592 mm(Distance value 2.592 m)
RangeStatus=(0x06>>4)&0x0f=0;(Reliable distance value)
Time=(0x06>>2)&0x0f=1; (The measurement time is 110ms)
Mode = 0x06&0x03=2; (The measurement mode is the middle distance mode, and the range is 50~4000mm)
(3), command byte, sent by the external controller toGY‑53L1 Module (hexadecimal)
Ordinary serial port command command: command format:0xA5+command+sum
➀, output mode setting instruction:
0xA5+0x45+0xEA ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑Continuous output distance data
0xA5+0x15+0xBA ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑Query output distance data
➁, save configuration instructions:
0xA5+0x25+0xCA ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑Save the current configuration after power‑off; including baud rate (valid after power‑on), measurement mode
Mode, measurement time, output mode setting
➂,Measurement mode setting instruction:
0xA5+0x51+0xF6 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑Short‑distance measurement mode
0xA5+0x52+0xF7 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑Middle distance measurement mode (default)
0xA5+0x53+0xF8 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑Long‑distance measurement mode
➃, Baud rate configuration:
0xA5+0x61+0x06 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑measure time 110ms(default)
0xA5+0x62+0x07 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑measure time 200ms
0xA5+0x63+0x08 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑measure time 300ms
0xA5+0x64+0x09 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑measure time 55ms
➄, baud rate configuration:
0xA5+0xAE+0x53 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑9600(default)
0xA5+0xAF+0x54 ‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑115200
Special serial port command instructions:The Pin5 pin of this module has two output modes, one is PWM mode, and the other is warning
threshold mode. The mode is switched by setting the distance command. The module defaults to the PWM mode of Pin5 at the factory.
Command format:0xA5+0x A5+Thresholds/2 +sum
Thresholds/2:Indicates that the set distance threshold is divided by 2, Hexadecimal representation, the unit is cm.
Sum:Indicates that the first three bytes of the special serial port command are accumulated and taken low 8 Bit.
➀ PWM Output:
When setting Thresholds>400cmWhen the module Pin5 pin mode is set to PWM mode. I.e. send instructions0xA5+0x A5+
Distance+sum, Distance>0xC8 At that time, the modules are all in PWM mode. For example, the serial port sends
commands: 0xA5+0xA5+0xF0+0x3A, the module is based onThresholds=0xF0*2=480>400cm, set Pin5 to PWM mode.
The period of the square wave output by this pin is 20Hz.
The time of high level corresponds to the measured distance.
Formula: distance (mm)=High level time (ms)*100=High level time (us)/10
For example: the measured high level time is 10000us,but Distance=10000/10=1000mm
4
➁Warning threshold mode:
When setting Thresholds<400cmWhen the module's Pin5 pin mode is set to alert threshold mode. I.e. send instructions0xA5+0x
A5+Distance+sum, Distance <0xC8 At that time, the modules are in the alert threshold mode. ModulePin5 Will be set according to
Thresholds Change the level with real‑time ranging distance. When the real‑time ranging distance is less thanThresholds,Pin5 Will
output low level, when the real‑time ranging distance exceeds Thresholds 4cmHour,Pin Will return to high level. For example:
settings1mThe threshold distance of, the command sent is: 0xA5+0xA5+0x32+0x7C 0x32 is equal to 50 in decimal, 50X2=100,
representing Thresholds=100mm, within 1 meter Pin5 Output low level
All setting commands need to be sent if they are to be saved after power‑off 0xA5+0x25+0xCASave the current configuration when power off;
Seven, module usage
The module is a serial port and chip IIC output module, the default module isSerial mode.
Serial port mode (default):The PS pin is pulled high, the module is powered on, and the default configuration is 9600 baud rate, medium distance measurement, and connection
Continued output mode; the corresponding setting of the module can be conveniently carried out by using the upper computer matched with the module; before the upper computer is usedPlease first
Select the port and baud rate, and then click "open serial port"Button, at this time, the host computer will display the corresponding data, click
Click the "Help" button, and the specific button usage will be displayed in the status bar at the bottom of the host computer.
Note that all setting commands will only be saved after the save command is sent. Please do not frequently configure the save after power‑off..
Only use sensor chip IIC mode:The PS port is connected to GND. In this mode, the MCU of the module does not set and
Read,PWM, Set the distance switch value does not work, it can be regarded as the MCU does not exist. You can directly manipulate the chip pins. when
It can be used as a simple chip module. In this mode, customers are required to search for information and chip programs on the Internet. It is no longer provided here.
In the query mode, the module sends a query command (A5 15 BA), the module performs a ranging, so that the module can be reduced
The overall power consumption of the block. When Pin5 is in PWM mode, the current when the module is idle (not measuring) is about 2 mA.
When it is in the guard mode, the idle current of the module is about 0.2mA.
Note: When the module is in query mode, the period of the command sent must be greater than the current measurement time of the module. Such as the current mode
The block measurement time is 110ms, and the cycle of the query command needs to be greater than 110ms.
5
Module andmcu orUSB Turn ttl,Connection Diagram:
Serial portUSBTurn ttl:
PWMcatchmcu:
Screenshot of the host computer (please pay attention to the prompt in the lower left corner when sending instructions):
Eight, the end
Module I/O Yes TTL Level, can be directly connected to the serial port of the microcontroller, and can be directly connected to the
PL2303, CH340, FT232 Wait for the chip to be connected, but it cannot be directly connected to the computer's nine‑pin serial port.
6
Module size chart: