rwaldron / johnny-five

JavaScript Robotics and IoT programming framework, developed at Bocoup.
http://johnny-five.io
Other
13.31k stars 1.77k forks source link

More than one "Multi" I2C device connected in the same I2C bus #1252

Closed aabm00 closed 8 years ago

aabm00 commented 8 years ago

Hi

The SHT31-D temperature and humidity sensor has two I2C addresses. Can I connect both of them in the same I2c bus in an Arduino Yun?

I would want to connect in the same I2C bus not only the two SHT31-D but 4 PT-100 amplifier (still looking for) so it would be nice to have some examples where shows how to connect more than one "Multi" device (same type or differents) in the same I2C bus with J5 directly in an Arduino board

Thanks

soundanalogous commented 8 years ago

As long as each I2C device has a unique address, you should be able to connect up to 16 devices to a single I2C port on a board. Of course bandwidth may be an issue as the number of devices increases, but 2 should be no problem. You will need to add a couple of pull-up resistors unless they are already included on each I2C module you are attaching. See the second answer here for a wiring diagram.

rwaldron commented 8 years ago

@soundanalogous thanks!

To illustrate:

var a = new five.Multi({ controller: "SHT31D", address: 0x44 });
var b = new five.Multi({ controller: "SHT31D", address: 0x45 });

For the second to work, you'll need to connect the ADDR pin to a HIGH voltage

aabm00 commented 8 years ago

Thanks you both @soundanalogous and @rwaldron for the answers.

Sorry, I know that the post is closed but I have found another problem related with. As I mentioned I need four PT-100 amplifier but the only I have found was the MAX31865 https://www.adafruit.com/products/3328 and it uses only the SPI protocol. Looking for information about how to implement it in J5 seems that Firmata doesn't still support the SPI protocol, so some questions came up.

1- ¿There are some way to do it, if finally I can't find an I2C PT-100 amplifier? 2- ¿Can I have UART, SPI and I2C devices connected to the same arduino board (In my case YUN) working together over J5? (Assuming that SPI will soon be supported by Firmata )

Thanks again

soundanalogous commented 8 years ago

You can have UART, SPI and I2C all connected simultaneously. Firmata won't have SPI support until I get some help on the Firmata SPI proposal: https://github.com/firmata/protocol/pull/27. I really need an expert in SPI to weigh in. It's not as easy to support as I2C because it's not as standardized as I2C and thus there are several edge cases making it very difficult to support in the generic way that Firmata needs.

aabm00 commented 8 years ago

Thanks !!!

I hope that soon someone will help you with the implementation. So the range of devices that can be used is broader.

Good luck