-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BME280 module does not allow coexistence of two BME280s on the same I2C bus #2241
Comments
Just shift sda - scl wires to the second and call setup |
sigh. I'm shocked you're closing this with such a hack solution to a rather simple problem. The whole point of the I2c bus is to NOT have to do this. It's an acceptable short-term hack, but not really a fix. For example, when one has hundreds or thousands of setups and only 4 rather long wires leading to the sensors, while it is technically possible to split sensors up and switch the wires, it's really not worth the time. |
I too am facing the exact same issue, and using the same pin as clock for one and data for the other device seems really hacky to me aswell. |
Yeah, closing it might actually have discouraged some folks from fixing it properly. |
@TerryE I'll see what i can do 👍 |
I've got it working. Will open a PR soon. |
This adds an optional use-alternate-address- parameter to all read-methods of the bme280 module. if not set, the behaviour is unchanged and first available device will be used. If set to true, the device at address 0x77 will be used. This fixes nodemcu#2241
Expected behavior
The BME280 supports two different I2C addresses, so two BME280s can be used on the same bus. This should be possible under nodemcu
Actual behavior
The bme280 module doesn't allow the I2C address to be set and instead looks for devices on the first address, and failing to find one, looks on the second address. Therefore, if 2 devices are present, only the first can be used.
It would be better if BME280 functions had an optional address parameter to allow for multiple devices.
NodeMCU version
Dev: ed56d94
Hardware
WeMos D1 Mini, with two BME280s connected to the same i2c bus.
The text was updated successfully, but these errors were encountered: