1
\$\begingroup\$

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).

\$\endgroup\$
  • 3
    \$\begingroup\$ The product information page for that humidity sensor is just stupid. It states It has a 4-pin interface that can communicate directly with the analog pins on the Arduino. However, the pins it is referring to are I2C interface connections, which is a purely digital protocol. Furthermore, to make it work with the easily available arduino libraries, it has to be the hardware I2C interface pins, which they don't bother to mention. \$\endgroup\$ – Connor Wolf Feb 7 '12 at 21:44
  • 1
    \$\begingroup\$ It is worth noting that the hardware I2C interface for the arduino is on pins that are shared with the analog inputs. However, it's their description is still a oversimplification to the point where it no longer accurately describes what is going on with the hardware. \$\endgroup\$ – Connor Wolf Feb 7 '12 at 22:32
1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ The arduino library actually uses the hardware I2C interface. As such, it has to be on specific pins. \$\endgroup\$ – Connor Wolf Feb 7 '12 at 21:42
  • \$\begingroup\$ @FakeName - Ah I see, well I guess it's either shuffle things around to use the hardware pins or do it in software then. \$\endgroup\$ – Oli Glaser Feb 7 '12 at 22:12
  • 1
    \$\begingroup\$ Yeah. Also, there are no decent soft-I2C libraries that I have found either. \$\endgroup\$ – Connor Wolf Feb 7 '12 at 22:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.