BMP085 and Humidity and Temperature Sensor with arduino

arduinoi2c

I am doing a project that requires me to use a BMP085 (with breakout) and a humidity/temperature sensor (with Breakout).

I am trying to attach both of these to the arduino uno through two analog inputs (they both use an I2C bus). I need to know how they will be hooked-up and how they can be programed. Both sensors have a sample code for finding the values individually (the humidity/temperature sensor also has a library).

I am currently trying to simly attach the two SDA and SCL inputs and placing them in the correct place for the arduino Wire library but I cannot figure out how to make sure the code works. I would like to avoid using 2 arduinos and I only have 1 extra analog input after the 2 I2C pins are placed in A4 and A5. The only digital inputs are the ones needed for ardumoto.

In the final code, I need to find humidity, temperature, and pressure (it would be best if I could get three methods to do this).

Best Answer

If they both use I2C then you can attach them both to the same two pins (SDA and SCL)

You select which one you wish to talk to by using it's address for the first byte of each command (which should be given in the documentation along with example communications) For example on page 16 of the datasheet for the BMP085 this is given as 0xEE (write) and 0xEF (read)
It looks like the first sensor has pullup resistors included which means you don't have to add them yourself.

I take it the Arduino Wire library is a software implementation of I2C (as opposed to a dedicated on board peripheral) If this is the case I imagine you can select which pins you want to use in the defines section. So in your case you would select A4 and A5 as SCL and SDA (which ever way round you want them)

The first link I looked at had various helpful links including quickstart guide, datasheet, wiring example, and an example Arduino sketch, so I'd probably start by following those. To keep it simple, I would try and get that sensor talking to the Arduino then add the other one.

I notice that the BMP085 runs from 3.3V, so you will need to use a 3.3V supply and disable the weak pullups to 5V in the Arduino wire library (see comments on product page) You can probably run the other sensor from 3.3V too but you would need to confirm this - it should work fine from 5V with logic high to 3.3V anyway if necessary.