I want to connect two bme680 sensors to a raspberry pi zero. How do connect up two sensors to a Pi zero? In python how can I set up two sensors with a Pi zero?
Thanks - geoman
On the back side you should see an ADDR+1 with two solder pads. Solder a wire across those two pads or bridge them with solder and you will change the i2c address for that BME680. Do this on one of them only. Once that’s done they will each have a different i2c address and show up as two separate devices.
I’m not 100% sure on this but in python I think it goes something like this.
Change
sensor = bme680.BME680()
to
sensor1 = bme680.BME680(0x76)
and
sensor2 = bme680.BME680(0x77)
If (0x76) doesn’t work change it to just (76)
That’s my best guess, I tried to Google it but didn’t find much. There is a way, @gadgetoid will likely know the correct way its done if I got it wrong. I don’t have two BME680’s to test with. Been toying with making an indoor outdoor weather station so I’ll have to figure it out at some point.
I’ve been hunting around trying to find how you setup the two identical sensors (with different addresses) in python and have got nowhere? Likely because My search terms suck I guess. All kinds of hits for “identical sensors with the same address”, that lead to hardware solutions, adding components to alter one device address.
If you find something please post it. My above post is just a big guess on my part.
The only thing you can do for devices that use the same address, and cannot be changed, that doesn’t require any additional hardware is to use the bitbanged i2c kernel module: i2c-gpio.
eg (in /boot/config.txt
):
dtoverlay=i2c-gpio,i2c_gpio_sda=23,i2c_gpio_scl=24,i2c_gpio_delay_us=8
And now, with appropriate pull resistors (okay that’s technically extra hardware) you have an i2c bus on BCM23/24 likely named /dev/i2c-3
Ok, but what do you do if they have two different addresses. Like two BME680’s, one with the address jumper set. I believe that was the original question, and my replies kind of muddied the water so to speak.
Your answer was correct- just import the driver and instantiate it with a different address specified for each device. Albeit the way of doing this will vary from device to device and for many libraries it may not even be possible.
I’m working on a suite of i2c device drivers based on my i2cdevice
DSL which don’t currently deal with this problem well, so it’s good you’re bringing it to mind :D
I like to build “singleton” libraries which, when imported, just talk to one device and don’t need messy instantiation. This is great for beginners but really disrupts advanced usage. There must be some pattern that adapts well to both use cases.
Ok, cool. I thought I had saved said info on how to do that somewhere but couldn’t find it? So I reverted to memory, that doesn’t always work out so well though, lol.
At some point I’m going to build an indoor outdoor weather station type thingy using two BME680’s. Indoor temp and humidity, outdoor temp and humidity, and one pressure reading.
I think our documentation is a little lacking in this respect!
Hi!
I don’t know if this topic is still alive. But if so.
I’m planning to build an environment control system that would use more than just two sensors.
The BME680 address can be changed by a little folding.
But could it be changed by one of the GPIO pins?
If I could line up multiple BME680s on an I2C bus. Have their Addr pins controlled by separate GPIO pins.
In this setup the SW can first select which sensor it wants to read - activate the relevant GPIO pin - and read from the secondary address.
What do you think?