

You have to be careful with pull-up resistors, because of the voltage. If you have too many pull-up resistors, one of the devices might have trouble making the SDA or SCL low. When you need a 400kHz I2C bus, over 2 meters, you might perhaps need pull-up resistors of 1k. When the I2C bus has no wires and is very short, the pull-up resistors can be 50k or more. A resistor of 4k7 from SDA to 3.3V or 5V and a resistor of 4k7 from SCL to 3.3V or 5V is best. That depends fully on the pull-up resistors. No device on the I2C can pull the SDA and SCL line high. The Wire library sets an address on the bus and only the device that recognizes its address responds to that. You can address all devices on the I2C bus without problem. The Arduino Wire library (for I2C) can handle the I2C protocol just fine.

However using the Adafruit libraries for BMP085 should work I think. The i2cdevlib has a section for BMP085: BMP085 pressure sensor | I2C Device LibraryĮverything in the i2cdevlib is know to work together. Basically to begin with can I just combine the sample code from the two libraries and with a little editing get the raw data out of both the gyro/accelerometer and the barometer? I'm fine with just one sensor on I2C but I've never used multiple sensors before so I just want to get a few questions cleared before I start assembling things.įirst pull up resistors, a few places have said you can connect multiple sensors to the same ports on an arduino (a4, a5, gnd etc) but that pull up resistors are a good idea to use, is this true and if so is there a guide as to which values of resistor to use and which pins must they be connected to besides +v?Īnd second do I need to do some sort of addressing to differentiate between the two sensors in the code wire apparently automatically sets the Arduino as the master but I'm not sure whether the above libraries handle addressing and any other issues around multiple i2c devices. My project needs to combine both an MPU6050 gyo/accelerometer package using the "i2cdev.h" "wire.h" and "mpu6050.h" libraries and it also needs to use a bmp085 pressure sensor using the "wire.h" and "Adafruit_BMP085.h" libraries.
