For Christmas, I put together the Weather Hat kit with a Raspberry PI 3. I’m using this indoors (for now), mounted on a PVC pipe, and held up with a Christmas Tree stand. I’ve got everything working according to the “Getting Started” guide.
I have an additional BME280 that I would like to mount to the “tree” and run all the cables inside to the RPI+Weather. I would mount this next to the window where the cables come in.
How do add additional sensors? I see mention of the I2C Extension Header in the Breakout Garden with pins (PI_3V3, SDA, SCI, RG_INT, GND).
One BME280 I have has pins (VIN, 3Vo, GND, SCK, SDO, SD1, CS).
Another HW-611 280 I have has pins (VCC, GND, SCL, SDA, CSB, SDO).
Both support I2C and SPI. The labeling of the pins is a bit misleading so you should search the internet. I think “SD1” is in fact “SDI”. For I2C, you would probably need SCK=SCL and SDA=SDO
Note: don’t be surprised if you don’t have BME280s but BMP280s. The latter has the same pinout and size, but only has temp/pressure. Chinese makers often sell these breakouts as “BME/BMP280” and give you the cheaper BMP280. You can distinguish both by reading the chip-id.
What you usually do: you create the appropriate software-objects for the sensors, passing in the I2C-address of the device. So you should check the code you are using and copy the relevant lines and adapt them.
One thing to watch out: on an I2C-bus, every device has to have a unique device-id (formally called slave-id). So if you want to hook up multiple BME280, you have to make sure the devices use different IDs. The BME280 supports two different IDs, but the second ID is identical to the ID of the BMP280. An alternative is to use multiple I2C-busses, which is possible on a RasPi, but requires some additional steps.
If you want multiple sensors, life is much easier if you use different devices. I would recommend the AHT20, it is cheap and easy to use.
BTW: I checked the datasheet of the BMP280/BME280, and you should wire SDI as SDA (in contrast to what I said in my first post). With SDO you can select the I2C-device address (GND->0x76,Vdd->0x77).
I often use two BME280 breakouts. In Pimoroni’s uf2 / libraries, it goes something like this. bme_one = BreakoutBME280(i2c,0x76) bme_two = BreakoutBME280(i2c,0x77)
I cut the address select jumper on one of the two.
To get your readings you do something like this. temp_one, press_one, hum_one = bme_one.read() temp_two, press_two, hum_two = bme_two.read()
Apologies, for some reason I was thinking PICO not Pi, Enviro not Weather Hat.
It’s the same procedure in Python as Micro Python, you differentiate the two devices by their i2c address. The one on the weather hat will be using 0x76 or 0x77, probably 0x76.
Running sudo i2cdetect -y 1 will show you what ones are in use. I’d unplug the added one, run i2cdetect, then hook it up and run again, looking for differences.
Multiple devices can be connected to i2c, as long as no two devices share the same i2c address.
The INT pin is a Pimoroni thing, you won’t be using it. The ones your concerned with are SDA and SCL, 3.3V and Ground. That being said, make sure your external i2c device will work with 3.3V and that it uses 3.3V logic. From the picture you have it connected incorrectly. Remove the yellow jumper , at the device end, and replace it with the Blue one.
Thank you very —VERY— much. I removed the Hat and followed a tutorial to wire just the BMP280 to the RPI. It works with… bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c, address = 0x76)
I did the i2cdetect command and this verified it. I did the same test you recommended with just the Hat and it is using the same 0x76 address. :-(
However, I wired my Adafruit BME280 to the RPI and was able to follow a similar tutorial and verified it’s using 0x77.
Next, I wired the Adafruit BME280 to the Hat (using the Blue wire this time) and was able to verify both 0x76 and 0x77 as active. Using the BME280 test script, I can switch between the two (Onboard and the Adafruit). Very cool.
I think I have the hardware figured out!
Next, where do I modify the Weather Hat scripts to use 0x77?
In init.py, I see: self._bme280 = BME280(i2c_dev=self._i2c_dev)
I’m not sure what to do with that.
It would be nice to press a button and switch between them.