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