Temp/Pres/Hum/VOC Wireling Python Tutorial
This Wireling lets you measure Temperature, Pressure, Humidity, and Volatile Organic Compounds (VOCs) via the BME680. This Wireling sensor is an upgrade from the Pressure & Humidity Wireling that uses the BME680 to measure relative humidity, barometric pressure, ambient temperature and gas (VOC).
Bosch BME680 Sensor Specs
- Digital interface I²C (up to 3.4 MHz) and SPI (3 and 4 wire, up to 10 MHz)
- Operating range -40 - +85°C, 0-100 % r.H., 300-1100 hPa
- Humidity, Pressure, Gas sensor can be independently enabled / disabled
- RoHS compliant, halogen-free, MSL1
- RMS Noise 0.12 Pa, equiv. to 1.7 cm
- Offset temperature coefficient ±1.3 Pa/K, equiv. to ±10.9 cm at 1 °C temperature change
- Response time 8 s
- Accuracy tolerance ±3 % relative humidity
- Hysteresis ±1.5% relative humidity
- Response time < 1s (for new sensors)
- Power consumption < 0.1mA in ultra-low power mode
- Output data processing: direct index for air quality (IAQ) output
TinyDuino Power Requirements
- Voltage: 3.0V - 5.5V
- 2.1 µA @ 1 Hz humidity and temperature
- 3.1 µA @ 1 Hz pressure and temperature
- 3.7 µA @ 1 Hz humidity, pressure, and temperature
- 0.15 µA in sleep mode
- Raspberry Pi and any other cables you'll need!
- Wireling Pi Hat
- (1) Wireling Cable
- TMP/PRES/HUM/VOC Wireling
- Python 3 (Python 2 is not supported!)
- All Python packages mentioned in the Pi Hat setup tutorial (tinycircuits-wireling, adafruit-circuitpython-bme680, adafruit-circuitpython-ads1x15, and adafruit-circuitpython-busdevice)
- BME680 Python Example
Plug your Wireling into the port you plan on using! The default in the included program is port 0.
If you want to use a different port, you just need to change the port value in the program mentioned later.
Install the necessary Python package:
pip3 install adafruit-circuitpython-bme680
Then you can download (above under Software) the Ambient Light Sensor Wireling example:
# TinyCircuits Temp/Press/Hum/VOC BME680 Wireling Example # Prints values of temperature, VOC, humidity, pressure, # and altitude read by the sensor every 2 seconds. # Initialized: 01-21-2020 # Last Updated: 01-21-2020 from busio import I2C import adafruit_bme680 import time import board import tinycircuits_wireling # Initialize and enable power to Wireling Pi Hat wireling = tinycircuits_wireling.Wireling() # Toggle this variable to use the Wireling on a different port (0-3) port = 0 wireling.selectPort(port) # Create library object using our Bus I2C port i2c = I2C(board.SCL, board.SDA) bme680 = adafruit_bme680.Adafruit_BME680_I2C(i2c, 0x76) # our Wireling has an address of 0x76 # change this to match the location's pressure (hPa) at sea level bme680.sea_level_pressure = 1013.25 while True: print("\nTemperature: %0.1f C" % bme680.temperature) print("Gas: %d ohm" % bme680.gas) print("Humidity: %0.1f %%" % bme680.humidity) print("Pressure: %0.3f hPa" % bme680.pressure) print("Altitude = %0.2f meters" % bme680.altitude) time.sleep(2)
The program by default is written to work with Port 0 on the Wireling Pi Hat.
Navigate in the terminal to the directory where you downloaded or saved the python example and run:
Be sure pigpiod is running before you attempt to run the python program. This is done by running the following command:
The program will print the temperature, VOC, humidity, pressure, and altitude readings from the sensor every 2 seconds.
If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.
Thanks for making with us!