adafruit / Adafruit_BME280_Library

Arduino Library for BME280 sensors
Other
333 stars 304 forks source link

I2C address for BME280 GYBMEP 0x76 #15

Closed techi602 closed 7 years ago

techi602 commented 7 years ago

Thanks for awesome library. However I had some hard time to make my sensor working. The default I2C address is set to 0x77 - (which is also default for BMP180) I have noticed there are several variants of the sensor

Mine however is running on 0x76 address (many thanks to I2C scanner)

BME280

Means that this library works fine when changing the default I2C address I have also found this reference in bosch library https://github.com/BoschSensortec/BMP280_driver/blob/master/bmp280.h as BMP280_I2C_ADDRESS1

Perhaps I would create PR which allows to set I2C address in constructor ( with commented macro i.e. BME280_ADDRESS_GYBMEP )

not sure how common issue is it but I believe someone else may appreciate it

golvellius commented 7 years ago

Thanks a lot techi602 ...

It's very usefull to me ...

Deliaz commented 7 years ago

Thanks, it helped me.

rogerclarkmelbourne commented 7 years ago

Similar issue applies to the BMP280 lib as well

Bruce17 commented 7 years ago

Thanks! I have the same issue with the same sensor 😉

ladyada commented 7 years ago

yes, the code supports passing in alternate i2c addresses already :)

https://github.com/adafruit/Adafruit_BME280_Library/blob/master/Adafruit_BME280.h#L133

Bluebrain2000 commented 7 years ago

Thanks! Helped me too!

DooMMasteR commented 7 years ago

By the way, it is pretty easy to change the address. Of the 3 solder pads the first 2 are connected, rip the connection with a knife and connect the center one with the last pad instead, this will pull the SDO pin of the BME280 up and change the base address to 0x77 which is convenient if you want to use 2 BME280 on the same bus. CHECK if you have ripped the connection properly or you will short VCC to GND :P

According to these schematics, the creator intended to have a switch on the pads to allow for convenient changing of the address. https://ae01.alicdn.com/kf/HTB1LnM.JFXXXXbAXFXXq6xXFXXXC/10pcs-DC1-8-5V-I2C-BME280-Digital-Barometric-Pressure-Altitude-Sensor-Temperature-Humidity-Module-for-Arduino.jpg

Bender-Ender commented 7 years ago

Of the 3 solder pads the first 2 are connected, rip the connection with a knife and connect the center one with the last pad instead

Thanks DooMMasteR. I thought that might be the case but couldn't find anywhere that said that conclusively.

sruthikrahulk commented 6 years ago

Did i get the lpc1768 code for BMP280

kukyarce commented 6 years ago

with this
https://github.com/Seeed-Studio/Grove_BME280 works with no traumatic board work https://www.youtube.com/watch?v=PidE-pJiIXY i have low level of knowledge....only a copy+paste and first shot and after think...sorry

Povilasgtar commented 6 years ago

Thank you for a link to Seeed, really useful, just worth mentioning, that I am using a BMP sensor attached to a GY-91 module instead of a BME sensor, but it has the same address as BME (0x76), so all that I had to do is just download and install the BMP280 zip also change the address entry in the library file in the sketch folder and everything works perfectly!

estevE11 commented 5 years ago

Man, thank you so fvcking much. Honestly without this thread I was done. Thanks.

JasonG-FR commented 5 years ago

For anyone having the same issue, here is how I managed to make it work : I simply replaced status = bme.begin(); by status = bme.begin(0x76); in the bme280test.ino sketch.

877dev commented 5 years ago

@JasonG-FR thanks for the comment, it really helped me! Was having trouble getting two sensors to read in i2c, I needed to use:

bool status;

status = bme1.begin(0x77); status = bme2.begin(0x76);

Cheers :)

ColomeDisco commented 5 years ago

Hi, Is possible to connect 4 devices at the same i2c bus? I want to make a project to diferential values like a pitot Tube tanks

JasonG-FR commented 5 years ago

@ColomeDisco yes it's possible to connect more than 4 devices on the i2c bus.

The issue is to get each one a unique address.

If you want to use 4 BME280, the Adafruit ones have 2 jumper solder pads that could be used to change their address, so 4 unique addresses in total.

ColomeDisco commented 5 years ago

Ok, Thanks for the response, but I not have clear documentation how to do it... do you have some link or information about it? thanks again!!

JasonG-FR commented 5 years ago

@ColomeDisco Sorry I made a mistake, you can only connect 2 Adafruit module on the i2c bus at the same time : https://forums.adafruit.com/viewtopic.php?f=22&t=128043 If you want to use 4 at the same time, you could use SPI instead:

If you want to connect multiple BME280's to one microcontroller, have them share the SDI, SDO and SCK pins. Then assign each one a unique CS pin.

from https://learn.adafruit.com/adafruit-bme280-humidity-barometric-pressure-temperature-sensor-breakout/pinouts

giacomolanzi commented 4 years ago

For who has the same issue and search for a quick solution:

simply use bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c, address=0x76)

from https://circuitpython.readthedocs.io/projects/bme280/en/latest/

dan0delellis commented 3 years ago

I was getting OSError: [Errno 121] Remote I/O error and ValueError: No I2C device at address: 77 after my sensor made contact with condensation in a gravity-assisted experiment failure. This cleared the errors right up!

joaofgoncalves commented 4 months ago

Worked for me as well with bme.begin(0x76)