0% found this document useful (0 votes)
325 views8 pages

Using The BME280 I2C Temperature and Pressure Sensor in Python

The document explains how to use the BME280 temperature, pressure, and humidity sensor with a Raspberry Pi in Python. It describes downloading a Python library to interface with the sensor over I2C, verifying the sensor is detected correctly, and reading out temperature, pressure, and humidity values using the library calls. Example Python code is provided to print out the sensor readings.

Uploaded by

Steve Attwood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
325 views8 pages

Using The BME280 I2C Temperature and Pressure Sensor in Python

The document explains how to use the BME280 temperature, pressure, and humidity sensor with a Raspberry Pi in Python. It describes downloading a Python library to interface with the sensor over I2C, verifying the sensor is detected correctly, and reading out temperature, pressure, and humidity values using the library calls. Example Python code is provided to print out the sensor readings.

Uploaded by

Steve Attwood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.

uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

1 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

2 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

wget-O bme280.py http://bit.ly/bme280py

wgethttps://bitbucket.org/MattHawkinsUK/rpispy-misc/raw/master/python/bme280.py

python bme280.py

3 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

1 import bme280
2
3 (chip_id, chip_version) = bme280.readBME280ID()
4 print "Chip ID :", chip_id
5 print "Version :", chip_version
6
7 temperature,pressure,humidity = bme280.readBME280All()
8 Select Month
9 print "Temperature : ", temperature, "C"
10 print "Pressure : ", pressure, "hPa"
11 print "Humidity : ", humidity, "%"

4 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

5 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

6 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

7 of 8 5/4/17, 10:00 PM
Using the BME280 I2C Temperature and Pressure Sensor in Python http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/

8 of 8 5/4/17, 10:00 PM

You might also like