I had been eyeing a few temperature sensors on Adafruit for a while: I wanted to add a couple of sensors to get temperature and humidity. One sensor in particular would give me data that I don’t have so far: barometric pressure. This sensor is the BME280
I didn’t want to buy straight off Adafruit as the shipping costs were more expensive than the sensor itself (since they ship from the USA). I however found a retailer in the UK: Proto-Pic
It was pretty straight forward to add the sensor to the Raspberry Pi: 4 wires to solder on the sensor, and to the I2C / Power on the Pi.
Once connected, a quick check to confirm the I2C address of the sensor:
pi@raspberrypi $ sudo i2cdetect -y 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77
(Note you may need to replace the 0 with a 1 depending on the version of your Raspberry Pi)
By default, the i2c address is 0x77. If you add a jumper from SDO to GND, the address will change to 0x76. See Adafruit’s tutorial for more info.
From there on, I just skipped to the last page to get the python script. Downloaded, installed, and it’s working.
One point to note is that I actually ordered a BMP280 from Proto-Pic which does not provide humidity data:
pi@raspberrypi $ sudo python Adafruit_BME280_Example.py Timestamp = 124328.000 Temp = 24.3 deg C Pressure = 1000 hPa Humidity = 0 %