pimoroni / breakout-garden

Documentation, software, and examples for the Breakout Garden ecosystem.
https://shop.pimoroni.com/products/breakout-garden-hat
MIT License
72 stars 14 forks source link

Issue with running BME680 and MLX90640 Simultaneously #21

Closed sylchw closed 5 years ago

sylchw commented 5 years ago

Hi, I tried to run the example codes of the BME680 (read-all.py) and MLX90640 (hotspot.cpp) together in parallel on the raspberry pi, but both crashes upon attempting to run them simultaneously.

The error shown on the read-all.py script is this: Traceback (most recent call last): File "read-all.py", line 58, in if sensor.get_sensor_data(): File "build/bdist.linux-armv7l/egg/bme680/init.py", line 264, in get_sensor_data File "build/bdist.linux-armv7l/egg/bme680/init.py", line 248, in set_power_mode File "build/bdist.linux-armv7l/egg/bme680/init.py", line 304, in _set_bits File "build/bdist.linux-armv7l/egg/bme680/init.py", line 319, in _get_regs IOError: [Errno 5] Input/output error

From what I'm aware, they're on different i2c addresses, with the MLX90640 at 0x33 and BME680 at 0x76.

Does anyone know how this issue can be resolved?

Thank you

Gadgetoid commented 5 years ago

What speed are you running the i2c bus for the MLX90640?

Bear in mind that I2C is also not thread-safe, so if you run the two scripts together with nothing to prevent them both trying to talk over I2C then you're going to end up with a mess of interleaved, half-complete commands at best.

Note: should probably continue discussion here since these duplicate issues clog up my inbox https://github.com/pimoroni/mlx90640-library/issues/26