BME680 Environmental Sensor
This documentation includes installation guidelines and sample code for your hardware.
Python Library
Turta_BME680 library is responsible for communicating with BME680 sensor.
To install the library from the (PyPI) Python Package Index, enter the following command to the console.
Add the following statement to the top of your Python code.
Then, create an instance of the Turta_BME680 class.
Now you're ready to access the library by calling the bme680 instance.
Initialization
The library automatically initializes the required components when its instance is being created, so there is no need to do a manual initialization.
Basic Members
Read Temperature
Reads the temperature in Celsius.
Parameters
None
Returns
Float: Temperature reading.
Read Humidity
Reads the relative humidity.
Parameters
None
Returns
Float: Relative humidity reading.
Read Pressure
Reads the pressure in Pa.
Parameters
None
Returns
Float: Air pressure in Pa.
Read Altitude
Reads the altitude from the sea level in meters.
Parameters
Float meanSeaLevelPressureInBar: Mean sea level pressure in bar.
Returns
Float: Altitude from the sea level.
Read Gas Resistance
Reads the gas resistance.
Parameters
None
Returns
Float: Gas resistance in Ohms.
Samples
You can copy the example code from https://github.com/Turta-io/IoTHAT/tree/master/Samples/Raspbian/Python address, and then copy it to the Raspberry Pi. There is one example of this library.
BME680 Sample App
This application demonstrates temperature, humidity, pressure, altitude and gas resistance readings.
To run the example:
Copy the library and sample code to a folder on the Raspberry Pi.
Open terminal, and go to the folder you copied the codes.
Run the sample with the following command:
Sample Code
Result
When you run the sample, it prints sensor readings to the terminal. The example output should be like this:
To stop the Python script, just press CTRL + C.
Last updated