Skip to content

Temp/Pres/Hum/VOC Wireling Python Tutorial

TinyCircuits BME680 Wireling product photo

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).

Technical Details

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

Pressure Sensor

  • 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

Humidity Sensor

  • Response time 8 s
  • Accuracy tolerance ±3 % relative humidity
  • Hysteresis ±1.5% relative humidity

Gas Sensor

  • 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 
    • Current:
      • 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

    Materials

    Hardware

    Required Software

    • 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

    Hardware Assembly

    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.


    Programming

    Install the necessary Python package:

    pip3 install adafruit-circuitpython-bme680
    

    Then you can download (above under Software) the Ambient Light Sensor Wireling example:

    BME680_example.py
    # 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.


    Run Program

    Navigate in the terminal to the directory where you downloaded or saved the python example and run:

    python3 BME680_example.py
    

    Be sure pigpiod is running before you attempt to run the python program. This is done by running the following command:

    sudo pigpiod
    

    The program will print the temperature, VOC, humidity, pressure, and altitude readings from the sensor every 2 seconds.


    Downloads


    Contact Us

    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!