Skip to main content

vl53l1x distance sensor driver for Raspberry Pi

Project description


Python library for the VL53L1X Laser Ranger.


sudo pip install smbus2
sudo pip install vl53l1x


import VL53L1X

# Open and start the VL53L1X sensor.
# If you've previously used then you
# should use the new i2c address here.
# If you're using a software i2c bus (ie: HyperPixel4) then
# you should `ls /dev/i2c-*` and use the relevant bus number.
tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)

# Optionally set an explicit timing budget
# These values are measurement time in microseconds,
# and inter-measurement time in milliseconds.
# If you uncomment the line below to set a budget you
# should use `tof.start_ranging(0)`
# tof.set_timing(66000, 70)

tof.start_ranging(1)  # Start ranging
                      # 0 = Unchanged
                      # 1 = Short Range
                      # 2 = Medium Range
                      # 3 = Long Range

# Grab the range in mm, this function will block until
# a reading is returned.
distance_in_mm = tof.get_distance()


See examples for more advanced usage.


  • Enhancement: support for ROI thanks to @jinnie


  • Enhancement: support for tca9548a, for #13
  • Enhancement: support for i2c address change, for #14
  • Enhancement: support for setting timing budget, for #16
  • Synced API code with latest release from ST


  • Fix: Use i2c_bus param for use with alternate buses/soft i2c


  • Improved search for .so file to pick up arch-specific files


  • Initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for VL53L1X, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size VL53L1X-0.0.5-cp27-cp27mu-linux_armv7l.whl (148.8 kB) File type Wheel Python version cp27 Upload date Hashes View
Filename, size VL53L1X-0.0.5-cp35-cp35m-linux_armv7l.whl (121.6 kB) File type Wheel Python version cp35 Upload date Hashes View
Filename, size VL53L1X-0.0.5-cp37-cp37m-linux_armv7l.whl (149.1 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size VL53L1X-0.0.5.tar.gz (182.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page