-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: BME680 sensor | ||
categories: [Hardware, Sensor] | ||
tags: [sensor, temperature, humidity, pressure, altitude] | ||
|
||
image: | ||
path: /assets/img/bme680.webp | ||
src: /assets/img/bme680.webp | ||
alt: "BME680 sensor header image" | ||
|
||
device_types: [temperature, humidity, pressure, altitude] | ||
device_address: "[I2C Address],[I2C Bus](/TerrariumPI/hardware#i2c-bus) <br />Ex: `0x3f,3`" | ||
device_url: https://shop.pimoroni.com/products/bme680-breakout?variant=12491552129107 | ||
--- | ||
|
||
## Information | ||
|
||
The BME680 is the first gas sensor that integrates high-linearity and high-accuracy gas, pressure, humidity and temperature sensors. It is especially developed for mobile applications and wearables where size and low power consumption are critical requirements. The BME680 guarantees - depending on the specific operating mode - optimized consumption, long-term stability and high EMC robustness. In order to measure air quality for personal wellbeing the gas sensor within the BME680 can detect a broad range of gases such as volatile organic compounds (VOC). | ||
|
||
{% include_relative _sensor_detail.md %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from . import terrariumI2CSensor | ||
|
||
# pip install bme680 | ||
import bme680 | ||
|
||
class terrariumBME680Sensor(terrariumI2CSensor): | ||
HARDWARE = 'bme680' | ||
TYPES = ['temperature','humidity','altitude','pressure'] | ||
NAME = 'BME680 sensor' | ||
|
||
def _get_data(self): | ||
data = None | ||
with self._open_hardware() as i2c_bus: | ||
sensor = bme680.BME680(self.device[0], i2c_bus) | ||
|
||
if sensor.get_sensor_data(): | ||
data = {} | ||
data['temperature'] = sensor.data.temperature | ||
data['humidity'] = sensor.data.humidity | ||
data['pressure'] = sensor.data.pressure | ||
# What to do with this data... | ||
data['gas'] = sensor.data.gas_resistance | ||
|
||
# https://github.com/avislab/sensorstest/blob/master/BME280/BME280.py#L176 | ||
data['altitude'] = data['pressure'] / 101325.0 | ||
data['altitude'] = 1 - pow(data['altitude'], 0.19029) | ||
data['altitude'] = round(44330.0 * data['altitude'], 3) | ||
|
||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters