Code: Select all
# Sensor Red Pitaya Extension connector
# VIN E1 - +3V3
# GND E1 - GND
# SDA E2 - I2C_SDA
# SCL E2 - I2C_SCL
The Python script relies on a couple of libraries: smbus2 and RPi.bme280. smbus2 lets us set the i2c bus to 0, which is the correct bus number for the STEMlab125-14. RPi.bme280 is a driver for the BME280 sensor. It abstracts us from all the gory details of talking to the sensor over i2c. When you install the RPi.bme280 library, it will also install smbus2 for you. To install on your Stemlab, type this from the command line:
Code: Select all
pip3 install rpi.bme280
Code: Select all
python3 ./RPitaya_bme280.py
Code: Select all
root@rp-f06578:~/jedi/plugins# python3 ./RPitaya_bme280.py
metric:id=bme280-office1231,n=Temperature,vd=69.95,u=F
metric:id=bme280-office1231,n=Humidity,vd=38.50,u=%
metric:id=bme280-office1231,n=Pressure,vd=29.70,u=inHg
Code is here: https://gist.github.com/machinechat/40f ... 10c787d3e4
Daryl