# BME280 from Weather HAT

**URL:** <https://forums.pimoroni.com/t/bme280-from-weather-hat/19342>\
**Category:** Support\
**Created:** [April 19, 2022, 7:22pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342 "2022-04-19T19:22:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![neaton](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@neaton](https://forums.pimoroni.com/u/neaton)\
**Post date:** [April 19, 2022, 7:22pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/1 "2022-04-19T19:22:10Z")

</div>

Hi! I’ve had Python programs running pulling data from my WeatherHAT very nicely for a few weeks now.

I’ve just added an external BME280 connected to the i2c extension on the board. Ever since then I am getting an error when running the (previously working) programs:

* * *

## Traceback (most recent call last): File “/home/pi/weatherhat-python/examples/adafruit-io\_MPH.py”, line 2, in import weatherhat File “/usr/local/lib/python3.9/dist-packages/weatherhat/ **init**.py”, line 7, in from bme280 import BME280 ImportError: cannot import name ‘BME280’ from ‘bme280’ (/home/pi/weatherhat-python/examples/bme280.py)

I’ve done some Googling, and tried downgrading the bme280 library using:

sudo pip install pimoroni-bme280==0.0.2

This hasn’t made any difference. I’m pretty stuck at the moment, can anyone help a Python newbie?

Thanks!

Nigel

---

<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:** [April 19, 2022, 7:33pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/2 "2022-04-19T19:33:58Z")

</div>

You have to cut the address select jumper on the back of the bme280, you added to i2c. You can’t have two devices with the same i2c address. You will also have to adjust your code to use two bme280’s.

---

<div class="post-metadata">

**Author:** ![neaton](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@neaton](https://forums.pimoroni.com/u/neaton)\
**Post date:** [April 19, 2022, 8:00pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/3 "2022-04-19T20:00:57Z")

</div>

Ahah! Thanks very much for the info. I’ll look into what’s needed.

---

<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:** [April 19, 2022, 8:40pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/4 "2022-04-19T20:40:38Z")

</div>

This is code I used on a build I have that has two BME280’s wired up to i2c.

```auto
from bme280 import BME280

try:
    from smbus2 import SMBus
except ImportError:
    from smbus import SMBus

bus = SMBus(1)
bme_in = BME280(0x76) #default address, jumper not cut 
bme_out = BME280(0x77) #alternate address, jumper cut

```

Then to read them it goes something like this.

`temperature_in = bme_in.get_temperature()`  
`temperature_out = bme_out.get_temperature()`  
`humidity_in = bme_in.get_humidity()`  
`humidity_out = bme_out.get_humidity()`

etc.

EDIT: For me I just run the stock BME280 installer. They will both use the one library.  
`sudo pip install pimoroni-bme280 smbus`  
For you the weather hat installer should be enough to run both BME280’s

---

<div class="post-metadata">

**Author:** ![neaton](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@neaton](https://forums.pimoroni.com/u/neaton)\
**Post date:** [April 19, 2022, 8:53pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/5 "2022-04-19T20:53:20Z")

</div>

That’s great! Thanks so much. I’m trying to figure out how to change the address on the particular version I have. In the meantime, my original problem still happens with the “other” BME280 completely disconnected, which is very strange. I think I’m going to try a clean install on the pi to see if that gets me back to where I was.

Nigel

---

<div class="post-metadata">

**Author:** ![neaton](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@neaton](https://forums.pimoroni.com/u/neaton)\
**Post date:** [April 19, 2022, 9:13pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/6 "2022-04-19T21:13:21Z")

</div>

Well, I cloned the install from github again, and now it works so I’m starting from a good place again. Thanks for the steer on i2c addressing, that’s next on the list.

Nigel

---

<div class="post-metadata">

**Author:** ![neaton](https://avatars.discourse-cdn.com/v4/letter/n/9d8465/32.png) [@neaton](https://forums.pimoroni.com/u/neaton)\
**Post date:** [April 25, 2022, 9:32pm UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/7 "2022-04-25T21:32:37Z")

</div>

It works! Yay! I found that some cheap BME280s I bought on line just would not change address, it  
wasn’t possible to sever the link between the first two solder pads. I ponied up for a better one, and  
that works a treat. I think the documentation on the Weather Hat could be better, I was initially trying to make sense of, and connect to, the obvious connection on the front of the board. It was only later that I found the _actual_ i2c connector on the side of the board. Anyway, got there in the end, so thanks for your help.

---

<div class="post-metadata">

**Author:** ![hel](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/hel/32/6075_2.png) [@hel](https://forums.pimoroni.com/u/hel)\
**Post date:** [April 26, 2022, 9:01am UTC](https://forums.pimoroni.com/t/bme280-from-weather-hat/19342/8 "2022-04-26T09:01:29Z")

</div>

Glad you got it working! I’ve tidied up the bit of the shop page description that refers to where the ADC and I2C headers are located on Weather HAT to try and make it a bit clearer which is which.
