# Using 2 BME280

**URL:** <https://forums.pimoroni.com/t/using-2-bme280/13916>\
**Category:** Support\
**Created:** [May 16, 2020, 12:12am UTC](https://forums.pimoroni.com/t/using-2-bme280/13916 "2020-05-16T00:12:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![janek](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@janek](https://forums.pimoroni.com/u/janek)\
**Post date:** [May 16, 2020, 12:12am UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/1 "2020-05-16T00:12:19Z")

</div>

How to pass the I2C address to Python code, so I can use 2 x BME280 or 2 x BME680?

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 20, 2020, 10:58am UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/2 "2020-05-20T10:58:34Z")

</div>

I’m pretty sure that’s been asked and answered on the forum, but I’ll be darned if I can find it?  
It goes something like  
bme2801 = BME280(i2c\_dev=bus)  
bme2802 = BME280(i2c\_dev=alt\_add) \< not sure on that one?  
If you figure it out please post the answer as I may be trying this at some point to get indoor outdoor temps.

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [May 20, 2020, 8:28pm UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/3 "2020-05-20T20:28:52Z")

</div>

In the library the constructor seems to be:

```auto
class BME280:
    def __init__ (self, i2c_addr=I2C_ADDRESS_GND, i2c_dev=None):

```

So you should be able to instantiate it as something like:

```auto
from bme280 import BME280

sensor = BME280(i2c_addr=0x77)

```

> bme2802 = BME280(i2c\_dev=alt\_add) \< not sure on that one?

In the module they’re described as

```auto
I2C_ADDRESS_GND = 0x76
I2C_ADDRESS_VCC = 0x77

```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 20, 2020, 9:18pm UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/4 "2020-05-20T21:18:03Z")

</div>

Nice hunting @Shoe. I went looking but my coding skills aren’t anything to brag about so I may have seen the answer and not recognized it. =(  
I was hoping if I bumped the thread somebody like you would chime in. ;)

---

<div class="post-metadata">

**Author:** ![Shoe](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Shoe](https://forums.pimoroni.com/u/Shoe)\
**Post date:** [May 20, 2020, 9:39pm UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/5 "2020-05-20T21:39:48Z")

</div>

Well hunting for stuff like that is how your skills improve! That’s how I learnt this stuff, that and trying to write my own modules for hardware like this.

---

<div class="post-metadata">

**Author:** ![janek](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@janek](https://forums.pimoroni.com/u/janek)\
**Post date:** [May 20, 2020, 10:37pm UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/7 "2020-05-20T22:37:18Z")

</div>

Yes, it’s time for me to learn Python.

I2C\_ADDRESS\_GND = 0x76  
I2C\_ADDRESS\_VCC = 0x77

# Initialise the BME280

bus = SMBus(1)  
bme280\_a = BME280(i2c\_dev=bus, i2c\_addr=I2C\_ADDRESS\_VCC)  
bme280\_b = BME280(i2c\_dev=bus, i2c\_addr=I2C\_ADDRESS\_GND)

while True:  
temperature\_a = bme280\_a.get\_temperature()  
pressure\_a = bme280\_a.get\_pressure()  
humidity\_a = bme280\_a.get\_humidity()

```
    temperature_b = bme280_b.get_temperature()
    pressure_b = bme280_b.get_pressure()
    humidity_b = bme280_b.get_humidity()
```

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 21, 2020, 8:33am UTC](https://forums.pimoroni.com/t/using-2-bme280/13916/8 "2020-05-21T08:33:01Z")

</div>

@Shoe , that’s why I went looking, hoping I could learn a little more. ;)
