Hi,
I’m getting erratic sensor readings from a black Pimori BME280 sensor (not the blue Adafruit). The temperature sometimes reads 4C high. This is a software issue NOT sensor picking up heat from the cpu. See below for details. Should I follow this up in this forum, or take it up with the developers on github?
Please see below for details.
DETAILS
Software installed from https://github.com/pimoroni/bme280-python with a pi zero
Using the example code all-values.py, I get output like this:
...
# Initialise the BME280
bus = SMBus(1)
bme280 = BME280(i2c_dev=bus)
while True:
temperature = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()
print('{:05.2f}*C {:05.2f}hPa {:05.2f}%'.format(temperature, pressure, humidity))
time.sleep(1)
pi@raspberrypi:~/bme280 $ python all-values.py
all-values.py - Read temperature, pressure, and humidity
Press Ctrl+C to exit!
20.10*C 733.97hPa 60.06%
24.01*C 1008.09hPa 40.92%
24.01*C 1008.11hPa 40.94%
24.00*C 1008.11hPa 40.92%
24.00*C 1008.12hPa 40.92%
The first temperatue reading (20.10C) looks correct, the other readings are about 4 degrees too high.
If I now move the constructor for the bme280 inside the loop I get the following:
# Initialise the BME280
bus = SMBus(1)
while True:
bme280 = BME280(i2c_dev=bus)
temperature = bme280.get_temperature()
pressure = bme280.get_pressure()
humidity = bme280.get_humidity()
print('{:05.2f}*C {:05.2f}hPa {:05.2f}%'.format(temperature, pressure, humidity))
time.sleep(1)
pi@raspberrypi:~/bme280 $ python all-values.py
all-values.py - Read temperature, pressure, and humidity
Press Ctrl+C to exit!
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
24.01*C 1008.09hPa 40.90%
24.00*C 1008.10hPa 40.87%
20.10*C 733.97hPa 60.06%
20.10*C 733.97hPa 60.06%
Most of the time the temperature looks correct, but occasionally I get an incorrect result (again, its the same error). I suspect it may be some form of timing issue or something to do with the initialisation of the bus, but have no real knowledege of the hardware side of things.
Has anyone seen anything similar or got any ideas how to follow this up?