# VL53L0X Python interface on Raspberry Pi
This project provides a simplified python interface on Raspberry Pi to the ST VL53L0X API (ST Microelectronics).
Patterned after the cassou/VL53L0X_rasp repository (https://github.com/cassou/VL53L0X_rasp.git)
In order to be able to share the i2c bus with other python code that uses the i2c bus, this library implements the VL53L0X platform specific i2c functions through callbacks to the python smbus interface.
Version 1.0.2:
- Add support for TCA9548A I2C Multiplexer. Tested with https://www.adafruit.com/products/2717 breakout. (johnbryanmoore)
- Add python example using TCA9548A Multiplexer support (johnbryanmoore)
Version 1.0.1:
- Simplify build process (svanimisetti)
- Add python example that graphs the sensor output (svanimisetti)
- Update the build instructions (svanimisetti, johnbryanmoore)
Version 1.0.0:
- Add support for multiple sensors on the same bus utilizing the ST API call to change the address of the device.
- Add support for improved error checking such as I/O error detection on I2C access.
Version 0.0.9:
- initial version and only supports 1 sensor with limited error checking.
Notes on Multiple sensor support:
- In order to have multiple sensors on the same bus, you must have the shutdown pin of each sensor tied to individual GPIO's so that they can be individually enabled and the addresses set.
- Both the Adafruit and Pololu boards for VL53L0X have I2C pull ups on the board. Because of this, the number of boards that can be added will be limited to only about 5 or 6 before the pull-up becomes too strong.
- Changes to the platform and python_lib c code allow for up to 16 sensors.
- Address changes are volatile so setting the shutdown pin low or removing power will change the address back to the default 0x29.
Notes on using TCA9548A I2C Multiplexer:
- If limited on GPIO's that would be needed to set a new addresses for each sensor, using a TCA9548A I2C Multiplexer is a good option since it allows using up to 8 sensors without using GPIO's.
- The TCA9548A is also a good option if using multiple boards on the same I2C bus and the total of all the combined I2C pullups would cause the bus not to function.
- Theoretically you can connect mutltiple TCA9548A Multiplexers, each with up to 8 sensors as long each TCA9548A has a different address. This has not been tested but should work in theory.
(Please note that while the author is an embedded software engineer, this is a first attempt at extending python and the author is by no means a python expert so any improvement suggestions are appreciated).
### Installation
### Compilation
* To build on raspberry pi, first make sure you have the right tools and development libraries:
```bash
sudo apt-get install build-essential python-dev
```
Then use following commands to clone the repository and compile:
```bash
cd your_git_directory
git clone https://github.com/johnbryanmoore/VL53L0X_rasp_python.git
cd VL53L0X_rasp_python
make
```
* In the Python directory are the following python files:
VL53L0X.py - This contains the python ctypes interface to the ST Library
VL53L0X_example.py - This example accesses a single sensor with the default address.
VL53L0X_example_livegraph.py - This example plots the distance data from a single sensor in a live graph. This example requires matplotlib. Use `sudo pip install matplotlib` to install matplotlib.
VL53L0X_multi_example.py - This example accesses 2 sensors, setting the first to address 0x2B and the second to address 0x2D. It uses GPIOs 20 and 16 connected to the shutdown pins on the 2 sensors to control sensor activation.

VL53L0X_TCA9548A_example.py - This example accesses 2 sensors through a TCA9548A I2C Multiplexer with the first connected to bus 1 and the second on bus 2 on the TCA9548A.


t0_54coder
- 粉丝: 4452
最新资源
- Python飞机大战游戏源码
- 泰坦尼克号乘客生存预测【Python代码与文档说明】课程项目
- Python实现的行人重识别系统代码
- rabbitmq.conf
- rabbitmq.repo
- 基于半导体制造过程参数的产品质量预测系统_智能制造_工业大数据_半导体生产_质量检测_参数优化_实时监控_异常预警_工艺改进_产能提升_机器学习_回归预测_特征工程_模型调优_数据.zip
- 基于Yii2框架开发的电子商务平台_包含完整前后端分离架构_支持多终端访问的商城系统_提供商品管理_订单处理_会员中心_支付对接_物流跟踪等核心功能_适用于中小型电商企业快速搭建线.zip
- 基于Zookeeper和Redis的分布式事务协调框架_micro-tcc_支持SpringCloud_Dubbo_RestTemplate的TCC模式分布式事务解决方案_提供事务.zip
- 基于定点数long类型的Unity帧同步寻路解决方案_定点数寻路_帧同步一致性_Unity导航网格处理_多端同步寻路算法_高精度路径计算_网格规格化存储_空间划分优化_临点焊接.zip
- 基于分布式存储系统的Web应用服务器集群管理系统_支持文件上传下载用户注册登录功能_采用Nginx作为Web服务器_集成Redis缓存_FastDFS分布式文件存储_包含Track.zip
- 基于单片机的多屏幕中文显示解决方案_支持TFT和点阵屏的软字库实现_提供高效中文处理与显示功能_包含32位和64位编码字库生成工具_支持多种字号和字体切换_优化内存占用和显示性能_.zip
- 基于人工智能的推箱子游戏自动求解器_包含BFS广度优先搜索_DFS深度优先搜索_UCS统一代价搜索_A星启发式搜索算法_支持多级难度地图解析_提供完整路径解决方案_附带运行时间统计.zip
- 基于区块链技术的农业供应链全流程溯源与金融风控系统demo_农产品流转溯源_资金流信息流管理_金融贷款风控_订单结算支付_农户资产数字化_包装仓储物流中间环节_商户订单管理_多角色.zip
- 基于深度学习的多模态虚假新闻检测系统_融合文本图像视频音频社交网络传播特征_利用自然语言处理计算机视觉声纹识别图神经网络技术_实现跨平台多源异构数据采集清洗特征提取融合分析_构建端.zip
- 基于深度学习的COVID-19疫情期间微博用户情绪识别与分析系统_包含100万条标注与未标注微博数据_采用BERT_RoBERTa_TextCNN_LSTM等模型_结合数据清洗_特.zip
- 基于沙箱机制的浏览器虚拟host管理工具_支持多浏览器独立host环境切换_开发测试环境隔离对比工具_解决host切换烦恼的跨平台应用_极简说明一个通过沙箱技术实现浏览器独立ho.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


