HowTo: ESPEasy - Connecting the VL53L0X / VL53L1X distance sensor to the ESP8266 / ESP32 and reading it out

Der VL53L0x bzw. seine Schwester/Bruder, der VL53L1X ist ein sehr genauer und relativ günstiger Laser Abstandssensor. Mit diesem lassen sich Abstände fast auf den Millimeter genau messen.

In einem meiner anderen Projekte (siehe ESPEasy – Füllstandssensor mit VL53L0X / VL53L1X) verwende ich diesen Sensor auch schon um, zum Beispiel, den Füllstand einer Regentonne zu überwachen.

Dieser Sensor lässt sich, wie viele andere auch in ESPEasy einbinden, auslesen und dessen Daten versenden.

Wie Ihr ESPEasy so konfiguriert, dass es den VL53L0X / VL53L1X auslesen kann, ist im folgenden Artikel beschrieben.


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

Affiliate links/advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
Additional tips on ESPEasy can be found in the following articles.

Required tool:

Required material:


Den VL53L0X / VL53L1X an den ESP8266 anschließen

Der VL53L0X / VL53L1X wird über den I2C Bus mit dem ESP8266 bzw. Wemos D1 Mini verbunden.

If the I2C bus is configured by default, you can use the shown schematic as orientation.


Configuration of the VL53L0X / VL53L1X in ESPEasy

Damit der VL53L0X / VL53L1X in ESPEasy konfiguriert werden kann sollte die ESPEasy Firmware schon auf den ESP8266 bzw. ESP32 aufgespielt und erreichbar sein. Informationen dazu findet Ihr auch im Artikel ESPEasy - Compile firmware, flash and configure WLAN access data.

First open the configuration website of your ESP8266 programmed with ESPEasy by entering its IP address into your web browser. Information on how to find out the IP address can also be found in the article Display/find out the IP address of the devices in the network summarized.

Sobald Ihr die Konfigurationswebseite geöffnet habt, müsst Ihr auf den “Devices”-Tab wechseln. Klickt dazu auf den “Devices”-Button.

Im “Devices”-Tab müsst Ihr nun auf den “Add”-Button in einer der noch leeren Zeilen klicken.

Ihr werdet dann automatisch zu der dargestellten Ansicht weitergeleitet und könnt hier auswählen, welches Device Ihr erstellen wollt.

Wählt hier den Eintrag “Distance – VL53L0X [TESTING]” aus.

This will redirect you back to an overview page.

Hier könnt Ihr Alle Einstellungen bezüglich des VL53L0X vornehmen.

If you have used the circuit diagram shown above, you can use the settings shown.

Falls Ihr Euer VL53L0X eine andere I2C Adresse verwendet könnt Ihr diese unter “I2C Address” anpassen.

Mithilfe der Option “Range” könnt Ihr die Reichweite des Sensors einstellen. Hier könnt Ihr etwas mehr Reichweite erreichen, was aber auch etwas die Genauigkeit verringert. Infos dazu findet Ihr im Datenblatt des VL53L0X.

Nachdem Ihr alle Einstellungen vorgenommen habt, könnt Ihr die Einstellungen durch einen Klick auf “Submit” bestätigen.


Messwerte des VL53L0X / VL53L1X anzeigen lassen

Nachdem Ihr den VL53L0X / VL53L1X konfiguriert habt könnt Ihr Ihn direkt testen.

In der Übersicht der konfigurierten Devices sind in der Zeile des VL53L0X / VL53L1X auf der rechten Seite die Messwerte zu sehen.

Diese aktualisieren sich spätestens alle 60 Sekunden. Dieses Intervall lässt sich in der Konfiguration des VL53L0X / VL53L1X im Abschnitt “Interval” einstellen.


Sensordaten per MQTT versenden

Die gesammelten Sensordaten könnt Ihr nun auch per MQTT an Euer SmartHome senden und dort ggf. weiter verarbeiten. Was Ihr dazu konfigurieren müsst ist im folgenden Artikel beschrieben.


Additional sensors for connection to the ESP8266 / ESP32

An overview of other articles for connecting sensors and actuators to ESPEasy can be found in the following category.


Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

20 comments

  1. 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

    1. Hi Doryphore,
      Can you use the I2C scanner under Tools to check whether the sensor is also found? 🙂
      Best regards
      Fabian

  2. 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
    (Es tut mir leid, wenn meine Nachrichten dupliziert werden. Jedes Mal, wenn ich etwas poste, erhalte ich eine Captcha-Fehlermeldung : “…Error: You have entered an incorrect reCAPTCHA value.
    Click the BACK button on your browser and try again….”)

    1. 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

  3. 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

  4. 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

    1. 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

  5. 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

  6. 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

    1. 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

      1. 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

        1. 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

  7. 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.

    1. 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

  8. Great HowTo,
    so I was able to rebuild a level indicator cheaply and without previous knowledge. Thanks a lot for this.
    Ein Problem habe ich allerdings. Sobald der ESP stromlos war, wird der Sensor nicht mehr erkannt. Es kommt dann bei allen IC Adressen zu dem Fehler: “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...

    1. hi the old man,
      I've actually observed similar behavior on some of my breakout boards. But it doesn't happen to everyone.
      Richtig “gelöst” hatte ich das Problem letztendlich durch den Kauf eines anderen Sensors. :/
      Best regards
      Fabian

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert


The reCAPTCHA verification period has expired. Please reload the page.