Problems with a BMP180

I am working with a BMP180 and an Arduino Nano. The code doesn't return any error messages, but once it's uploaded, it doesn't return any data, not even ceroes or errors (which is supposedly what had to happen). However, if I disconnect the bmp it returns cero; the same happens if SDA pin is disconnected. I have noticed that the code "stops" at bmp.begin(). When trying with the example code of the library, the result is very similar. My code, for reference:

#include <SFE_BMP180.h>
#include <Wire.h>
SFE_BMP180 bmp180;
//SDA goes to A4, SCL goes to A5
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
 bmp180.begin();
 Serial.println("START");

delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:
double T,P;
char status;
float pressureAtm;
status = bmp180.startTemperature();
delay(1000);
status = bmp180.getTemperature(T);
if (T == 0){ Serial.print ("Temperature error"); } ;
status = bmp180.startPressure(3);
delay(1000);
status = bmp180.getPressure(P, T);
if (P == 0) { Serial.println ("Pressure error"); } ;

//converting to atm
pressureAtm = P / 1013.25;

//printing
Serial.print("Temperature: ");
Serial.print(T);
Serial.println(" C");
delay(1000);
Serial.print("Pressure hPa: ");
Serial.print(P);
Serial.println(" hPa");
delay(1000);
Serial.print("Pressure atm: ");
Serial.print(pressureAtm);
Serial.println(" atm");
delay(1000);

Does anyone know what is going on?

BMP180 might be a 3v3 device... check your datasheet?

That doesn't look right. Check the library documentation and example code. You may need to write something like
status = bmp180.getTemperature(&T);

It IS a 3V3 device, so it needs a level shifter. That said: I have used four of these devices, and one is malfunctioning: it always returns 1016 hPa, no change. Sigh, now I need to de-solder...

Is that a classic Nano or one of the new ones like IOT, BLE, BLE sense, etc.?

Have you tried an I2C scanner sketch to confirm connection and communication with the I2C bus?

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

There are some BMP180 modules that come with a 5V to 3.3V regulator on the board. The GY-68 module for instance.

OP, can you post clear photos of your wiring, please?

True. I use those.
Interestingly, I just had one that failed. It gave only one value (1016 hPa), and never changed. All good after I replaced it. They're cheap enough.

I had this [problem for a very long time. then I read somewhere that the difference between BME and BMP180 is so subtle that the only way to be sure of what you have is to try the library for the other device. My device is marked BME/BMP180 so that is no help

I switched to the BME180 library, made the tweaks necessary to make it compile, and there it was

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.