Skip to content

Commit 9a505f2

Browse files
josemottafrenck
authored andcommitted
Create sensor.tof (#8672)
* Create sensor.tof * Review documentation * Fix i2c address typo * update ha release from launch * Add i2c_bus to configuration * Update source/_components/sensor.tof.markdown Co-Authored-By: josemotta <josemotta@bampli.com> * Update source/_components/sensor.tof.markdown Co-Authored-By: josemotta <josemotta@bampli.com> * Update sensor.tof.markdown * Add VL53L1X docs and schematic * Update sensor.tof.markdown * Update sensor.tof.markdown * Update sensor.tof.markdown * Update sensor.tof.markdown * Update sensor.tof.markdown * ✏️ Tweaks * Moves page from platform page to component page Signed-off-by: Franck Nijhof <frenck@addons.community>
1 parent 1b071fe commit 9a505f2

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

source/_components/tof.markdown

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
layout: page
3+
title: "Time of Flight sensor using VL53L1X"
4+
description: "Instructions on how to integrate a VL53L1X ToF sensor into Home Assistant."
5+
date: 2019-02-21 00:00
6+
sidebar: true
7+
comments: false
8+
sharing: true
9+
footer: true
10+
logo: raspberry-pi.png
11+
ha_category:
12+
- DIY
13+
- Sensor
14+
ha_release: "0.90"
15+
ha_iot_class: Local Polling
16+
---
17+
18+
The Time of Flight sensor uses an invisible laser to measure distance with millimeter resolution.
19+
20+
Tested devices:
21+
22+
- [Raspberry Pi](https://www.raspberrypi.org/)
23+
- [VL53L1X](https://www.st.com/en/imaging-and-photonics-solutions/vl53l1x.html)
24+
- [Schematic](https://cdn.sparkfun.com/assets/3/5/c/e/2/Qwiic_Distance_Sensor_-_VL53L1X.pdf)
25+
26+
## {% linkable_title Configuration %}
27+
28+
To use the VL53L1X sensor in your installation, add to your `configuration.yaml`:
29+
30+
```yaml
31+
# Example configuration.yaml entry
32+
sensor:
33+
- platform: tof
34+
```
35+
36+
{% configuration %}
37+
name:
38+
description: Name of the sensor.
39+
required: false
40+
default: VL53L1X
41+
type: string
42+
i2c_bus:
43+
description: I2c bus used.
44+
required: false
45+
default: 1, for Raspberry Pi 2 and 3.
46+
type: integer
47+
i2c_address:
48+
description: I2c address of the sensor.
49+
required: false
50+
default: "0x29"
51+
type: string
52+
xshut:
53+
description: GPIO port used to reset device.
54+
required: false
55+
default: 16
56+
type: integer
57+
{% endconfiguration %}
58+
59+
## {% linkable_title Example %}
60+
61+
The distance is measured in millimeters, according to the VL53L1X specifications.
62+
63+
```yaml
64+
# Example of customized configuration.yaml entry
65+
sensor:
66+
- platform: tof
67+
name: ToF sensor
68+
i2c_address: 0x29
69+
xshut: 16
70+
```
71+
Several devices may be attached and a GPIO port from RPI is used for reset. XSHUT signal is generated pulsing LOW at initialization and after that, it is kept HIGH all time. This version uses VL53L1X long-range mode that may reach up to 4 meters.
72+
73+
## {% linkable_title Directions for installing i2c on Raspberry Pi %}
74+
75+
Enable the I2c interface with the Raspberry Pi configuration utility:
76+
77+
```bash
78+
# pi user environment: Enable i2c interface
79+
$ sudo raspi-config
80+
```
81+
82+
Select `Interfacing options->I2C` choose `<Yes>` and hit `Enter`, then go to `Finish` and you'll be prompted to reboot.
83+
84+
Install dependencies for use the `smbus-cffi` module and enable your _homeassistant_ user to join the _i2c_ group:
85+
86+
```bash
87+
# pi user environment: Install i2c dependencies and utilities
88+
$ sudo apt-get install build-essential libi2c-dev i2c-tools python-dev libffi-dev
89+
90+
# pi user environment: Add homeassistant user to the i2c group
91+
$ sudo addgroup homeassistant i2c
92+
93+
# pi user environment: Reboot Raspberry Pi to apply changes
94+
$ sudo reboot
95+
```
96+
97+
### {% linkable_title Check the i2c address of the sensor %}
98+
99+
After installing `i2c-tools`, a new utility is available to scan the addresses of the connected sensors:
100+
101+
```bash
102+
$ /usr/sbin/i2cdetect -y 1
103+
```
104+
105+
It will output a table like this:
106+
107+
```text
108+
0 1 2 3 4 5 6 7 8 9 a b c d e f
109+
00: -- -- -- -- -- -- -- -- -- -- -- -- --
110+
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
111+
20: -- -- -- 23 -- -- -- -- -- 29 -- -- -- -- -- --
112+
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
113+
40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
114+
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
115+
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
116+
70: -- -- -- -- -- -- -- --
117+
```
118+
119+
So you can see the sensor address what you are looking for is **0x29** (there are more i2c sensors in this Raspberry Pi).

0 commit comments

Comments
 (0)