jveverka / rpi-projects

Drivers and home automation projects for Raspberry PI.
Apache License 2.0
23 stars 2 forks source link

Repeated read of BME280 causing RPi to hang #6

Open mbcoder opened 1 year ago

mbcoder commented 1 year ago

I don't think this problem is specific to this library, but using the BME280 class when I'm repeatedly reading temperature, pressure and humidity I'm finding that after a short time the Raspberry Pi hangs. I'm using a Pimoroni BME280

I believe this is an issue with reading the sensor in forced mode as I can reproduce this using other libraries such as from Pimoroni.

Is there a way of not using forced mode using the API?

mbcoder commented 1 year ago

Using this library, I've found a way of making the repeated reading from the sensor reliable. After every read, I'm calling reset.

Without this the Raspberry Pi hangs after a few minutes. Having added in the reset my app has remained stable for about 12 hours.

mbcoder commented 1 year ago

Having tried my reset hack after each read, it turns out that I'm still seeing the Raspberry Pi hang still.

I'm pretty sure the Pimoroni BME280 doesn't like being used in forced mode.

The links in this repository point to the Adafriuit BME280 module. Is this what this API has been tested against? Has anyone seen hangs with the Adafruit version of hardware?

I'm temped to get an Adafriut sensor if this reliably works when read repeatedly. I'm wanting to read the sensor every few seconds. @jveverka does the Adafruit BME280 work reliably when read repeatedly for you?