Multiple HTU21D-F sensors on one I2C bus?

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
adruino
 
Posts: 15
Joined: Wed Aug 20, 2014 8:56 am

Multiple HTU21D-F sensors on one I2C bus?

Post by adruino »

Hi,
I am evaluating a bunch of temperature and humidity sensors at the moment and I'm trying to run 2 of each type of sensor I can get my hands on to get an idea of how well not only each sensor agrees with other sensors, but also how well each sensor agrees with other sensors of it's own type.

I'd like to get 2x HTU21D-F's running off the same bus but am not sure how.
The Adafruit_HTU21DF library seems to store a hard coded address of 0x40
-> #define HTU21DF_I2CADDR 0x40

It seems to me that the HTU21DF has a hard coded I2C address in the chip.

How can I change the address on the chip?

Also, once I've changed the address. how can I instantiate two different instances of the H2U21D in my Arduino code (since the library has the address had coded?
I guess I could copy and rename the entire library with a new hard coded address, but this seems like a pretty clumsy and resource-wasteful way to do this.
Anyone have a library that allows the address to be passed in?

Oh, if you are interested, here's a live feed from all the sensors including some smoothing (rolling average of the latest 20 values) on a couple of measurements.
https://xively.com/feeds/500226106

User avatar
egutting
 
Posts: 297
Joined: Wed Nov 14, 2012 12:57 am

Re: Multiple HTU21D-F sensors on one I2C bus?

Post by egutting »

I don't believe you can change the I2C address on this sensor. You'll have to use software I2C to communicate with 2 of the same sensors with the same master.

User avatar
adruino
 
Posts: 15
Joined: Wed Aug 20, 2014 8:56 am

Re: Multiple HTU21D-F sensors on one I2C bus?

Post by adruino »

Oh, that's a little BANNED.
I wasn't anticipating having to load up yet another memory consuming library.

Might need a Mega.
:-)

Thanks.

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

Return to “Other Products from Adafruit”