I want to use my Arduino to connect two sensors at the same time. However, these 2 sensors all use I2C protocol for communication. As we all know that the default I2C interface on the Arduino board is Analog In 4 and Analog In 5. How could I connect two sensors using the same I2C protocol on a single Arduino board? Thanks!
The I2C-bus is designed for one master and many slaves.
You need pull-up resistors, and you can add many devices.
Every I2C-device has it's own address.
So I am gonna connect both these 2 sensors onto the same I2C bus (i.e., Analog In 4 and Analog In 5) physically. And write an Arduino sketch which calls their unique I2C address alternatively such that I can read data from both of the 2 sensors using a single Arduino. Please correct me if I am wrong. Many thanks!
I am kinda new to this... Actually each sensor I am using is embedded in its own breakout board. Does this indicate I do NOT need the pull-up resistors?
Some breakout boards have no pull-ups others have 2k2, or 4k7 or 10k, some have a level shifter, some are for 3.3V others for 5V, and so on......
What breakout boards are you using? You can past the URL in your post.
I would not expect a breakout board to have resistor although it's possible, maybe with disabling jumpers.
The trouble is they don't know in advance how many boards (and other stuff) you will have on the wires and you can't keep adding resistors in parallel.
The Sparkfun BMP085 breakout board has 4k7 pull-up resistors.
The K30 seems to have 56k pull-up resistors, or they recommend 56k, but I'm not sure of that.
So you are good, you don't have to add extra resistors.
The Sparkfun BMP085 board should have 3.3V.
The K30 needs 3.3V for "DVCC" and 5V for the "Supply Voltage" (I don't understand that), but the logic levels should be maximum 3.3V.
If you connect both sensors to the I2C-bus, the pull-up resistors of the BMP085 board will keep the I2C-lines between 0 and 3.3V (or a little more). So you have to connect both sensors to the I2C-bus at all times !