Getting data from multiple BMP180's on I2C

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Berrypicker
 
Posts: 6
Joined: Sat Feb 15, 2014 6:20 am

Getting data from multiple BMP180's on I2C

Post by Berrypicker »

Hello Adafruit gurus,
Although the BMP085 and BMP180 are using the I2C circuit, each BMP sensor has the same address (0x77), so I have trouble addressing them individually.

I am successfully using the old BMP085 library to get data from multiple BMP085 sensors on I2C. I do this by setting a digital pin to LOW that is connected to XCLR on each sensor. This silences all the sensors that are set to XCLR --> digital LOW. When I want data from a sensor, I switch the XCLR digital pin for that individual sensor to input mode. I have to initiate each sensor when I want data from it. When I am done with that sensor, I set the digital pin to XCLR back to LOW.


I can also get data from a single BMP180 using the newer Adafruit_Sensor.h and Adafruit_BMP085_U.h libraries. Since the BMP180 does not have an XCLR pin, I was thinking I could just power each one individually with digital 5v only when I want data and initiate it before I ask for data - leaving the others powered off until I want data. But this doesn't seem to work. I'm setting the VIN pin on the BMP180 to digital HIGH (5v) only when I want data from that sensor and back to LOW when I am done. I even tried to use a separate variable name for each sensor and it's events (3 sensors). However, if I have more than one bmp180 sensor on the I2C channel, the serial monitor balks even when VIN to two of them are set to LOW. If I disconnect all but one sensor from I2C, the code runs, but of course its just the single sensor reporting for each initiation of the code. I can't understand how the sensor answers an I2C request when VIN is set to LOW. Is this value stored in the arduino variable until it is overwritten by fresh data? Perhaps I can flush the data from the variable? Any ideas will be appreciated.

In short, is there a software command to tell an individual BMP180 to shut up? or. Is there a way to set the address for each sensor via a software command in the Adafruit_BMP085_U.h library? My goal is to get pressure and temp data from 12 (or more) sensors onto one arduino through a single I2C channel.

I'm keen to use the BMP180s because they are 1/2 the price of the BMP085 and Adafruit promotes them as functional duplicates of BMP085. Also BMP085 is probably going away (I think Adafruit has already discontinued them).
Thanks in advance.
Berry

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

The BMP10's I2C address is hardwired, and its command interface has commands to start conversions and read data. There are no built-in options to use more than one with the same controller.

Your best option is probably to use a hardware multiplexer to select one of several SDA lines.

User avatar
kuhlmeier
 
Posts: 2
Joined: Thu Mar 13, 2014 6:03 am

Re: Getting data from multiple BMP180's on I2C

Post by kuhlmeier »

Hi,

Hope you can help out with this one!

I have the same issue. I would like to pull data from two Adafruit BMP180's
I have one connected to the default I2C-1 bus and the other to the P5 header I2C-0 (RPI revB).

When I run sudo i2cdetect -y 0 and sudo i2cdetect -y 1 I get the same response with both sensors connected.
It seems that they are both detected at the 0x77 address on each bus.
So far so good.
Running the Adafruit_BMP085_example.py works fine on sensor connected to I2C-1. I get a read out and the values are correct.

Next I thought it would be quite simple to hard code the bus version in Adafruit_I2C.py in order to read data from I2C-0
I .e. uncomment line 33 and comment out line 35 and 36:
self.bus = smbus.SMBus(0); # Force I2C0 (early 256MB Pi's)
# self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi's)
# self.bus = smbus.SMBus(
# busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())

But this does not work!?

I get the response back "Error accessing 0x77: Check your I2C address"

Am I going down the right track? BMP180 should be available on I2C-0 right?
Is there a need for external pull up resistors on P5? And how do I then connect these?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

All I2C buses need pull-up resistors. The I2C0 pins have internal pull-ups that can be enabled, and `i2cdetect` probably does that, but reports on the RasPi forums say you get better performance by adding external pull-ups.

User avatar
kuhlmeier
 
Posts: 2
Joined: Thu Mar 13, 2014 6:03 am

Re: Getting data from multiple BMP180's on I2C

Post by kuhlmeier »

The BMP180 works just fine on I2C-1 with no external pull ups.
Is I2C-0 different in that respect?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

They're no different inside the chip, but they're routed and connected differently on the PCB. That can make a difference.

User avatar
dixit1991
 
Posts: 4
Joined: Mon Jun 27, 2016 10:06 am

Re: Getting data from multiple BMP180's on I2C

Post by dixit1991 »

adafruit_support_mike wrote:The BMP10's I2C address is hardwired, and its command interface has commands to start conversions and read data. There are no built-in options to use more than one with the same controller.

Your best option is probably to use a hardware multiplexer to select one of several SDA lines.
Hello,

I have a question regarding the addressing of sensors to be used together in i2c.
(Adafruit HTU21D-F Temperature & Humidity Sensor Breakout Board)

Do you provide a unique address to us hardwired for infividual sensors??

Thanks,
Dixit

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

The address is set within the chip. We don't have any control over it.

User avatar
dixit1991
 
Posts: 4
Joined: Mon Jun 27, 2016 10:06 am

Re: Getting data from multiple BMP180's on I2C

Post by dixit1991 »

And that address is unique per chip?? I am saying because it is not obvious from the datasheet.

Thanks,
Dixit

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

No.

There are only about 120 possible I2C addresses. All BMP180s have the same address burned into the silicon.

User avatar
dixit1991
 
Posts: 4
Joined: Mon Jun 27, 2016 10:06 am

Re: Getting data from multiple BMP180's on I2C

Post by dixit1991 »

So, if we want to use several sensors together(like 10 temperature and humidity sensors) in a single project, how would we be addressing them?

Thanks,
Dixit

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Getting data from multiple BMP180's on I2C

Post by adafruit_support_mike »

You have no choice about the address. You have to use the one burned into the chip.

The fact that the address is fixed means you can only have one BMP180 connected to an I2C bus.

If you want to communicate with 10 BMP180s, you'll need 10 I2C buses. There are no other solutions.

An I2C multiplexer like the TCA9548A (https://www.adafruit.com/products/2717) makes it easier to manage communication with multiple I2C buses. That chip does have external address pins, so you can connect up to 8 of them to a single I2C bus, and those 8 chips will give you controllable connections to up to 64 separate I2C buses.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”