vl53l1x distance sensor driver for Raspberry Pi
Project description
# vl53l1x-python
Revised Python library for the VL53L1X Laser Ranger.
# Installing
```
sudo pip3 install smbus2
sudo pip3 install VL53L1X2
```
# Usage
```python
import VL53L1X
tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)
tof.open() # Initialise the i2c bus and configure the sensor
tof.start_ranging(1) # Start ranging, 1 = Short Range, 2 = Medium Range, 3 = Long Range
distance_in_mm = tof.get_distance() # Grab the range in mm
tof.stop_ranging() # Stop ranging
```
See examples and tests for more advanced usage.
0.1.2
-----
* @josemotta ported it to python 3.6 as part of a homeassistant component.
Please see basic sample:
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['smbus2==0.2.2', 'VL53L1X2==0.1.2']
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the sensor platform."""
add_devices([TofSensor()])
class TofSensor(Entity):
"""Representation of a Sensor."""
def __init__(self):
"""Initialize the sensor."""
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'VL53L1X'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
def update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""
self._state = 23
0.0.3
-----
* @NagyAttila upgrade focusing on working with more than 1 range sensors, also changed quit a lot to make it bit more robust.
0.0.2
-----
* Improved search for .so file to pick up arch-specific files.
0.0.1
-----
* Initial release.
Revised Python library for the VL53L1X Laser Ranger.
# Installing
```
sudo pip3 install smbus2
sudo pip3 install VL53L1X2
```
# Usage
```python
import VL53L1X
tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)
tof.open() # Initialise the i2c bus and configure the sensor
tof.start_ranging(1) # Start ranging, 1 = Short Range, 2 = Medium Range, 3 = Long Range
distance_in_mm = tof.get_distance() # Grab the range in mm
tof.stop_ranging() # Stop ranging
```
See examples and tests for more advanced usage.
0.1.2
-----
* @josemotta ported it to python 3.6 as part of a homeassistant component.
Please see basic sample:
from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity
REQUIREMENTS = ['smbus2==0.2.2', 'VL53L1X2==0.1.2']
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the sensor platform."""
add_devices([TofSensor()])
class TofSensor(Entity):
"""Representation of a Sensor."""
def __init__(self):
"""Initialize the sensor."""
self._state = None
@property
def name(self):
"""Return the name of the sensor."""
return 'VL53L1X'
@property
def state(self):
"""Return the state of the sensor."""
return self._state
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
def update(self):
"""Fetch new state data for the sensor.
This is the only method that should fetch new data for Home Assistant.
"""
self._state = 23
0.0.3
-----
* @NagyAttila upgrade focusing on working with more than 1 range sensors, also changed quit a lot to make it bit more robust.
0.0.2
-----
* Improved search for .so file to pick up arch-specific files.
0.0.1
-----
* Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
VL53L1X2-0.1.5.tar.gz
(80.3 kB
view details)
Built Distributions
File details
Details for the file VL53L1X2-0.1.5.tar.gz
.
File metadata
- Download URL: VL53L1X2-0.1.5.tar.gz
- Upload date:
- Size: 80.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01e0abee2a81742874726bd82001d20c6a282b021250f64f1ce4ab1be507e896 |
|
MD5 | 5810b91be2c819e9386fbb3a86a5cd21 |
|
BLAKE2b-256 | 603c561d51963f74d1cdfb47449850b47461710b5c573ef2029a270f0e3b0caf |
File details
Details for the file VL53L1X2-0.1.5-cp37-cp37m-linux_armv7l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp37-cp37m-linux_armv7l.whl
- Upload date:
- Size: 118.1 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b906f7aeec80c4680a175b715ff8781d45ea5ec2fff292a4c3be2d289a1de54 |
|
MD5 | a3575f52630863262771c998af9404ba |
|
BLAKE2b-256 | cb972be4defa74e0ccc450c0a484f3fc3d308694bced3a14f870d2d1daf66abe |
File details
Details for the file VL53L1X2-0.1.5-cp37-cp37m-linux_armv6l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp37-cp37m-linux_armv6l.whl
- Upload date:
- Size: 118.1 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1376b2686200fdb549ce1f38f5a99e986279926de22211a8dd08d423e4685664 |
|
MD5 | 0f738a62e221edcdbe9c7e2ab2a97b98 |
|
BLAKE2b-256 | 52c46704c180c1008d0f66beef14c5942ab8165f748b51a665e7ffc9acb2bffe |
File details
Details for the file VL53L1X2-0.1.5-cp36-cp36m-linux_armv7l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp36-cp36m-linux_armv7l.whl
- Upload date:
- Size: 120.0 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fb449c67f3f1920b3ef8c9ae14b47856f86bd04dffd6ed616c66727302a96bd |
|
MD5 | f17994801de4938b72e40b9ff91d25f2 |
|
BLAKE2b-256 | 5ef455016e3dc793482e6afb7d1e935544f1ebe880abba59b9a16bff66413420 |
File details
Details for the file VL53L1X2-0.1.5-cp36-cp36m-linux_armv6l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp36-cp36m-linux_armv6l.whl
- Upload date:
- Size: 118.1 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0057691d54149cfaa32acf38d5a9e998e3cc58fa9af105bbed520773a8160768 |
|
MD5 | ccb3e73028b10cd23264a25cecaaede6 |
|
BLAKE2b-256 | 023ff0816c13ed32de49de8b4bd7954252440680e4be9e9768f3dfb8246af5a4 |
File details
Details for the file VL53L1X2-0.1.5-cp35-cp35m-linux_armv7l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp35-cp35m-linux_armv7l.whl
- Upload date:
- Size: 131.3 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/3.5.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc1c814e055feadac64d003f7e3f38306779b27a37939f350096065bdf285d02 |
|
MD5 | 650bb7eebbf564e58b62523121a74eee |
|
BLAKE2b-256 | fea499b6e672da204d51ce34aa4b641d810d774baca9e1aae9178f312e0ede09 |
File details
Details for the file VL53L1X2-0.1.5-cp35-cp35m-linux_armv6l.whl
.
File metadata
- Download URL: VL53L1X2-0.1.5-cp35-cp35m-linux_armv6l.whl
- Upload date:
- Size: 131.3 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7bc227d0285ae4ae25c62235e17d0d88fc46c67acfe680d807d1aac13f1e4ec1 |
|
MD5 | a34fb06c3e77df883a116666c6db0966 |
|
BLAKE2b-256 | 3db6f93ea01d421fbd7ed285329c4c77483d5cd1f472c78659120fcb3c382f8f |