|
| 1 | +VL53L1X Time Of Flight Distance Sensor |
| 2 | +====================================== |
| 3 | + |
| 4 | +.. seo:: |
| 5 | + :description: Instructions for setting up VL53L1X distance sensors in ESPHome. |
| 6 | + :image: vl53l1x.jpg |
| 7 | + :keywords: VL53L1X |
| 8 | + |
| 9 | +The ``vl53l1x`` sensor platform allows you to use VL53L1X optical time of flight |
| 10 | +(`datasheet <https://www.st.com/resource/en/datasheet/vl53l1x.pdf>`__, |
| 11 | +`ST <https://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html>`__) with ESPHome |
| 12 | +to measure distances. The sensor works optically by emitting short infrared pulses |
| 13 | +and measuring the time it takes the light to be reflected back |
| 14 | + |
| 15 | +The sensor can measure distances up to 2 meters, though that figure depends significantly |
| 16 | +on several conditions like surface reflectance, field of view, temperature etc. In general |
| 17 | +you can expect surfaces up to 73cm to work, after that you need to make sure the surface is reflecting |
| 18 | +well enough (see also section 3.5 of datasheet). |
| 19 | + |
| 20 | +.. figure:: images/vl53l1x.png |
| 21 | + :align: center |
| 22 | + :width: 100.0% |
| 23 | + |
| 24 | +The :ref:`I²C Bus <i2c>` is required to be set up in your configuration for this sensor to work. |
| 25 | + |
| 26 | +- ``VCC`` connects to 3V3 (``3V3`` will output 3.3V), or directly connect ``VCC`` to 3.3V |
| 27 | +- ``GND`` connects to ground |
| 28 | +- ``SCL`` connects I2C SCL (clock) |
| 29 | +- ``SDA`` connects I2C SDA (data) |
| 30 | +- ``GPIO1`` is not used by ESPHome |
| 31 | +- ``XSHUT`` connects to free GPIO pin. Enable/disable device. This is optional if there is only one |
| 32 | + VL53L1X sensor on the I²C bus and the default ``0x29`` address is used. Otherwise this is required. |
| 33 | + |
| 34 | +.. code-block:: yaml |
| 35 | +
|
| 36 | + # Simple configuration entry example |
| 37 | + sensor: |
| 38 | + - platform: vl53l1x |
| 39 | + name: "VL53L1x Distance" |
| 40 | + address: 0x29 |
| 41 | + update_interval: 60s |
| 42 | + distance_mode: long |
| 43 | +
|
| 44 | +Configuration variables: |
| 45 | +------------------------ |
| 46 | + |
| 47 | +- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the |
| 48 | + sensor. Defaults to ``60s``. |
| 49 | +- **distance_mode** (*Optional*): Set the distance mode. Long distance mode allows the longest possible ranging |
| 50 | + distance of 4 m to be reached. However, this maximum ranging distance is impacted by ambient light. |
| 51 | + Short distance mode is more immune to ambient light, but its maximum ranging distance is typically limited to |
| 52 | + 1.3m. One of ``short``, ``medium``, or ``long``. Defaults to ``long``. |
| 53 | +- **address** (*Optional*, int): Manually specify the i2c address of the sensor. Defaults to ``0x29``. |
| 54 | + If an address other the ``0x29`` is specified, the sensor will be dynamically re-addressed at startup. |
| 55 | + A dynamic re-address of sensor requires the ``enable_pin`` configuration variable to be assigned. |
| 56 | + If more then one VL53L1X sensor is used on the same i2c bus, a unique address must be specified per sensor. |
| 57 | +- **enable_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The pin connected to XSHUT |
| 58 | + on vl53l1x to enable/disable sensor. **Required** if not using address ``0x29`` which is the cause if you |
| 59 | + have multiple VL53L1X on the same i2c bus. In this case you have to assign a different pin to each VL53L1X. |
| 60 | +- **timeout** (*Optional*, :ref:`config-time`): Sensor setup timeout. Default to ``10ms``. |
| 61 | +- All other options from :ref:`Sensor <config-sensor>`. |
| 62 | + |
| 63 | + |
| 64 | +.. code-block:: yaml |
| 65 | +
|
| 66 | + # Muliple VL53L1X sensors on same i2c bus |
| 67 | + # Example configuration entry |
| 68 | + sensor: |
| 69 | + - platform: vl53l1x |
| 70 | + name: "distance1" |
| 71 | + id: distance1 |
| 72 | + address: 0x41 |
| 73 | + enable_pin: GPIOXX |
| 74 | + timeout: 200us |
| 75 | + update_interval: 500ms |
| 76 | + unit_of_measurement: "m" |
| 77 | +
|
| 78 | + - platform: vl53l1x |
| 79 | + name: "distance2" |
| 80 | + id: distance2 |
| 81 | + address: 0x42 |
| 82 | + enable_pin: GPIOXX |
| 83 | + timeout: 200us |
| 84 | + update_interval: 500ms |
| 85 | + unit_of_measurement: "m" |
| 86 | +
|
| 87 | +
|
| 88 | +
|
| 89 | +See Also |
| 90 | +-------- |
| 91 | + |
| 92 | +- :ref:`sensor-filters` |
| 93 | +- :doc:`vl53l0x` |
| 94 | +- :apiref:`vl53l1x/vl53l1x_sensor.h` |
| 95 | +- `vl53l1x-arduino library <https://github.com/pololu/vl53l1x-arduino/>`__ by `Pololu <https://github.com/pololu>`__ |
| 96 | +- :ghedit:`Edit` |
0 commit comments