I tried to get the temperature and pressure with the BMP085 sensor and my Raspberry Pi (256MB) via I2C. I used this Adafruit tutorial: Using the BMP085 with Raspberry Pi, but this isn't working for me.

What I did? I commented out the call to the altitude function, because there was an error and the altitude isn't interesting for me. So after that I get a temperature and humidity output, but with the wrong values. The output is jumping in very huge steps (e.g. 40°C to 100° and back) or I get huge negative values (e.g. -1300hPa). Sometimes, really rarely it seems that I got a right value, but with the next measurement it's the same as before.

I have no idea what to do.. can anyone give me some ideas or suggestions what to do?
Thanks so far.

  • Does sudo i2cdetect -y 0 or sudo i2cdetect -y 1 show 77 as described here? Commented Aug 25, 2013 at 16:14
  • yes.. sudo i2cdetect -y 0 show me 77
    – F481
    Commented Aug 25, 2013 at 16:18
  • I tested the sensor with my Arduino Uno and it's working correctly. So the issue depends to the RaspPi itsself, the OS, the I2C bus or the Adafruit library.. :P
    – F481
    Commented Aug 25, 2013 at 21:16
  • 1
    @F481 : Where's the weakest link in that chain? ;\ I have that sensor, BTW, but it is still in the baggie. My intention is to put it together and work up some C code using the data sheet later this week, so I'll let you know what happens.
    – goldilocks
    Commented Aug 26, 2013 at 8:12
  • Sounds good, thanks so far! I'm looking forward hearing from you :). In that time I'll test the Dereks code.
    – F481
    Commented Aug 26, 2013 at 10:48

3 Answers 3


This is a known bug in the Adafruit BMP085 library.
You can follow the discussion and the bug fix process in the Adafruit forum:
Raspberry Pi and the BMP085

GitHub issue: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/issues/38

Thanks for all suggestions!

UPDATE: Adafruit released a new official python library: https://github.com/adafruit/Adafruit_Python_BMP


I commented here months ago that I was going to hook my BMP085 up and write some code, which I finally did over the holidays. I've written a short C++ class using libi2c; if you have any I2C devices running this will already be installed, but you will need to install the header files (apt-get libi2c-dev) in order to compile.

The class is in a tarball with a short demo program here. The demo produces output like this:

Relative altitude at 100.08 kPa: 104m.
Temperature: 24 °C    Pressure: 100.07 kPa

The bottom line updates every 2 seconds. As an example of the class interface, this is done like this:

// Create object.
        BMP085 *bcm = new BMP085();
        if (!bcm->ok) {
                cerr << bcm->err << endl;
                return 1;
// Take reading, report, and repeat ad infititum.
        BMP085::reading data = bcm->getBoth();
        cout << "Relative altitude at " << data.kPa << " kPa: "
                << BMP085::getRelativeAltitude(data.kPa) << "m.\n";
        while (1) {
                cout << "\rTemperature: " << data.celcius << " °C    "
                        << "Pressure: " << data.kPa << " kPa         " << flush;
                data = bcm->getBoth();

Firstly, I must say that I have not tried this, but I have an app on github that includes code to get data from the BMP085. It's part of a weather station receiver app that I put together - largely using other people's work. Kevin Sangalee (who has done a lot of work on weather stations) had written a file bmp085.c which I included in my app. I don't have this component so the code is just ifdef'ed out on my app.

You might get some help from the code, which is in C. You can find my git repo at https://github.com/DerekK19/weather-receiver.git

  • Thanks Derek, I'll try the code and give some feedback then.
    – F481
    Commented Aug 26, 2013 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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