ESP32 With VL53L0X Realizes IoT Artificial Intelligence Vehicle
Key Features of the VL53L0X Chip:
1.Fully Integrated Miniature Module
-
940nm laser VCSEL
-
VCSEL driver
-
Distance measurement sensor with advanced embedded microcontroller
-
4.4mmx2.4mmx1.0mm
-
Fast and accurate distance measurement
-
Measures absolute distances up to 2m
-
Reported distances are not affected by target reflectivity
-
Operates in high infrared light environments
-
Advanced embedded optical crosstalk compensation to simplify glass enclosure design.
2.Human Eye Safety
- Class 1 laser equipment in accordance with the latest standard IEC 60825-1:2014 (3rd edition)
3.Easy to Integrate
-
Reflowable components
-
No additional optics required
-
Single power supply
-
I2C interface for device control and data transfer
-
Xshutdown and interrupt GPIOs
-
Operating Voltage: 3.3V/5V
4.Parameters of VL53L0X:
-
Product Size: 4.4mm × 2.4mm × 1.0mm
-
Distance measurement range: 30 ~ 2000mm
-
Distance Measuring Accuracy: ±5% (High Speed Mode), ±3% (High Accuracy Mode)
-
Measuring time (min): 20ms (high speed mode), 200ms (high precision mode)
-
Ranging Angle: 25
-
Laser wavelength: 940nm
-
Operating temperature: -20 ~ 70°C
The VL53L0X Sensor Provides 3 Measurement Modes
-
Single Measurement Mode: In this measurement mode, a single trigger performs only one distance measurement, and after the measurement is finished, the VL53L0X sensor will return to standby and wait for the next trigger.
-
Continuous Measurement Mode: In this mode the distance measurement is executed in a continuous manner. When one measurement is finished, the next one will be started immediately, and the user must stop the distance measurement to return to standby mode, the last measurement is finished before stopping.
-
Timed Measurement Mode: This mode is actually a continuous measurement mode with specified time intervals. When a measurement is completed, the next measurement is initiated after a user-defined delay time. The user must stop ranging to return to standby, and the last measurement is completed before stopping.
The VL53L0X Sensor Also Offers 4 Different Accuracy Modes:
Precision mode
|
Measurement TimeBudget Range (ms)
|
Ranging distance (m)
|
Typical application scenarios
|
default
|
30
|
1.2
|
standard
|
high pre cision
|
200
|
1.2 (accuracy <± 3%)
|
Accuratemeзsurement
|
long distance
|
33
|
2
|
Long distance, only for dark no infrared conditions
|
high spoed
|
20
|
1.2 (accuracy <
± 5%)
|
Highrspoed, precision not a priarity
|
Interface | Description |
VCC | Power Positive (3.3V/5V Power Input) |
GND | Power Ground |
SDA | I2C Data Pin |
SCL | I2C Clock Pin |
SHUT | Pin, Connectable to IO Port |
INT | Interrupt Output Pin, Connectable to IO Port |
Laser Distance Measurement Module | ESP32 Module |
VCC | +5V |
GND | GND |
SDA | P21 |
SCL | P22 |
Specific Operation Process
-
Open the library management panel of the Arduino IDE, enter VL53L0X in the search box, and then choose to install the Adafruit_VL53L0X library, as shown below.
-
The next step is to look at a simple template program for the single measurement mode. This is shown below:ESP32 with VL53L0X Realizes IoT Artificial Intelligence Vehicle -simple template program
As you can see in the code above, these steps are required to complete a single measurement of the laser distance measurement module:
(1) Create an instance of the Adafruit_VL53L0X object
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
Call the begin() method to complete the initialization of the laser distance measurement module
(3) Create an instance of VL53L0X_RangingMeasurementData_t structure that saves the measurement results.
(4) Call the rangingTest() method to complete a measurement.
(5) The RangeStatus attribute of the measurement result object indicates the status of the measurement result, and the value of the RangeMilliMeter attribute is the measured distance (in millimeters).
For continuous measurement, the difference with the above single measurement is that after calling begin() to complete the initialization of the module, you have to call startRangeContinuous() method to switch the laser distance measurement module to continuous measurement mode. The difference in reading data is to use the isRangeComplete() method to determine whether the laser range module has completed a measurement, and then readRange() method to read the results of the measurement. The program template is shown below:ESP32 with VL53L0X Realizes IoT Artificial Intelligence Vehicle -continuous measuremen