The VL53L0x or its sister / brother, the VL53L1X is a very precise and relatively inexpensive laser distance sensor. With this, distances can be measured almost at millimeter accuracy.
In one of my other projects (see ESPEasy – level sensor with VL53L0X / VL53L1X) I am already using this sensor to, for example, monitor the level of a rain barrel.
Like many others, this sensor can be integrated into ESPEasy easily.
How to configure your ESPEasy so that it can read out the VL53L0X / VL53L1X is described in the following article.
Safety instructions
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
Affiliate links / advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, Nerdiy.de receives a commission from the online store or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Requirements
Helpful Articles:
You can find additional tips on ESPEasy in the following articles.
- ESPEasy - Execute commands and actions via HTTP, MQTT, UDP and directly
- ESPEasy - Compile firmware, flash it and configure WiFi access data
- Category - ESPEasy
Required tools:
Required material:
Connect the VL53L0X / VL53L1X to the ESP8266
The VL53L0X / VL53L1X is connected to the ESP8266 or Wemos D1 Mini via the I2C bus.
Configuration of the VL53L0X / VL53L1X in ESPEasy
So that the VL53L0X / VL53L1X can be configured in ESPEasy, the ESPEasy firmware should already be installed on the ESP8266 and accessible. You can find information about this in the article ESPEasy - Compiling, flashing and configuring WLAN access data.

First open the configuration website of your ESP8266 programmed with ESPEasy by entering its IP address in your web browser. Information on how to find out the IP address is also summarized in the article Displaying / Finding out the IP address of the devices in the network.
As soon as you have opened the configuration website, you have to switch to the "Devices" tab. To do this, click on the "Devices" button.

You will then be automatically redirected to the view shown and can select here which device you want to create.
Select the entry “Distance – VL53L0X [TESTING]”.

This will redirect you to an overview page.
Here you can make all settings regarding the VL53L0X.
If you have used the circuit diagram shown above, you can use the settings shown.
If you use a different I2C address on your sensor, you can adjust it under "I2C Address".
With the "Range" option you can set the range of the sensor. Here you can achieve a little more range, but this also reduces the accuracy a little. You can find information on this in the data sheet of the VL53L0X / VL53L1X.
Display the measured values of the VL53L0X / VL53L1X
After you have configured the VL53L0X / VL53L1X you can test it easily.

In the overview of the configured devices, the measured values can be seen in the line of the VL53L0X / VL53L1X on the right-hand side.
These are updated every 60 seconds at the latest. This interval can be set in the configuration of the VL53L0X / VL53L1X in the "Interval" section.
Send sensor data via MQTT
You can now also send the collected sensor data to your SmartHome via MQTT and process it there if necessary. What you have to configure is described in the following article.
Additional sensors for connection to the ESP8266 / ESP32
You can find an overview of other articles for connecting sensors and actuators to ESPEasy in the following category.
Have fun with the project
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate that I share this information with you, I would be happy about a small donation to the coffee box. 🙂
Hi,
where did you get espeasy .bin (firmware) from where the sensor is already in there.
LG TC
Hi TC,
I compiled the version myself. I once prepared and uploaded a binary for it. You can find them at: https://github.com/Nerdiyde/NerDIYs_STLs/tree/main/STLs/water_level_sensor/binary
Best regards
Fabian
Hello
I received the firmware ESP8266_4M_17.02.2021, unfortunately it doesn't work with this VL53L1X: http://www.cqrobot.wiki/index.php/VL53L1X_Distance_Sensor
Hello,
I downloaded your firmware installed on a wemos D1 mini with a CQrobot brand VL53L1X sensor but the sensor is not sending any data but the I2c address is correct.
Sensor Wiki:
I ordered another brand to test again. All connections have been checked several times
Hi Doryphore,
Can you use the I2C scanner under Tools to check whether the sensor is also found? 🙂
Best regards
Fabian
Hello,
Here is the result of the scan, unfortunately the VL53L1X does not appear
https://nsa40.casimages.com/img/2021/03/07/210307081128704569.jpg
When trying with a different firmware it showed:
https://www.casimages.com/i/210305045829585917.jpg.html
(Sorry if my messages are duplicated. Every time I post I get a Captcha error message : "...Error: You have entered an incorrect reCAPTCHA value.
Click the BACK button on your browser and try again….”)
Hello Doryphore,
that's weird. I'll try to reproduce the whole thing. Then I can better understand what may have gone wrong. 🙂
Best regards
Fabian
Hello,
It's nice of you because I'm stuck with this sensor and would like to use it with Espeasy. I tried another brand VL53L1X sensor: Same result on I2c scan, the sensor doesn't show up. Obviously I checked the I2c connections in SDA and SDL in D1 and D2 of the wemos d1 mini several times.
cordially,
doryphore
Boom! Exactly what I was looking for. thanks
Thanks first… The VL53L0X goes with your .bin.
Unfortunately I need the VL53L1X and unfortunately I can't get it to work. Others above have had the same problem. Has anyone solved this or does anyone know where it is involved?
Greetings Ralph
Good morning Ralph,
Unfortunately, I'm still waiting for the VL53L1X from China. As soon as it's here I'll take a look. 🙂
Best regards
Fabian
That would be great. Then I could continue with my project.
Unfortunately, the VL53L0X is not quite enough for me in terms of range.
I will follow up if you get mail and have success.
Greetings Ralph
Hello Fabian, a great article and a great project. I also got the VL53L0X sensor working with it.
Now I had bought a VL53L1X sensor (bluedot.space). Unfortunately, it doesn't work with your last ESPEasy.bin version.
The sensor requires the Pololu VL53L1X Library. I am currently struggling as a beginner with the arduino ino and am trying in vain to compile the plugin for a D1Mini ESP8266. However, so far without success.
https://www.bluedot.space/products/vl53l1x/
Best regards
Olaf
Hey Olaf,
yes with the VL53L1X the plugin does not seem to run properly. I hope one day I can take care of it. :/
What problems do you have when compiling? maybe I can help you with that. 🙂
Best regards
Fab
Hello Fabian, thanks for the feedback!
Unfortunately, I can't add the Pololu library to the ESPEasy with the Arduino IDE and compile a *.bin file. The bin file is to be flashed onto a Wemos D1 mini.
... I've already tortured myself through so many instructions and videos and unfortunately I can't get any further with the Arduino IDE.
The right library for my VL53L1x is available directly from the manufacturer.
https://www.bluedot.space/products/vl53l1x/
I would also like to send you something for your efforts.
Greetings
Olaf
Good evening Olaf,
I'd like to try that. My biggest problem right now is lack of time. :/
Did you already start with something that you can possibly build on? 🙂
Best regards
Fabian
Hi I think the project is really great, unfortunately the sensor shows me a completely wrong value in your housing, outside it runs without a problem, but I also need the VL53L1X with a 4m range, can I change your housing a bit. I will attach the sensor from the outside or, if necessary, draw my own housing. I would like to use it to monitor whether the electric tailgate is open and is pending at the garage door so that the garage door cannot be opened and a message is output in the IoBroker and on the echo.
Hey Alex,
oh ok That's weird. Didn't really have any problems with it during testing. Could also be due to the VL53L1X.
Of course, you can also change the housing. 🙂
Best regards
Fab
Great HowTo,
so I was able to rebuild a level indicator cheaply and without previous knowledge. Thanks a lot for this.
I have one problem though. As soon as the ESP was de-energized, the sensor is no longer recognized. The error then occurs for all IC addresses: "Unknown error at address xxxx".
I can only fix it by deactivating the sensor under Devices, disconnecting the ESP from the power again and then reactivating the sensor...
hi the old man,
I've actually observed similar behavior on some of my breakout boards. But it doesn't happen to everyone.
In the end, I really “solved” the problem by buying a different sensor. :/
Best regards
Fabian