BMP180/280 stops reading

Hello, I have used several BMP180 and BMP280 with different Arduinos (Uno and Nano) and with different libraries. There is always the same problem. It just stops reading.

I think there is nothing wrong with soldering as well since I used breadboards and now it is connected to a PCB through cables. Has anyone encountered this kind of a problem.

How long does it take before it stops?
Does the entire microcontroller lock up or is it only the sensor readings that are affected?
What code are you running; can you upload a sketch that demonstrates the problem?

Can you post a photo of the setup that clearly shows all parts and how they are connected?
Can you also post a schematic of the system?

It changes. Sometimes it stops after 2-3 seconds and sometimes 2-3 minutes.
The entire microcontroller locks up.
The code is below.

// Your sketch must #include this library, and the Wire library.
// (Wire is a standard library included with Arduino.):

#include "SFE_BMP180.h"
#include <Wire.h>

// You will need to create an SFE_BMP180 object, here called "pressure":

SFE_BMP180 pressure;

#define ALTITUDE 40.0 // Altitude of Istanbul in meters

void setup()
{
  Serial.begin(9600);
  Serial.println("REBOOT");

  // Initialize the sensor (it is important to get calibration values stored on the device).

  if (pressure.begin())
    Serial.println("BMP180 init success");
  else
  {
    // Oops, something went wrong, this is usually a connection problem,
    // see the comments at the top of this sketch for the proper connections.

    Serial.println("BMP180 init fail\n\n");
    while(1); // Pause forever.
  }
}

void loop()
{
  char status;
  double T,P,p0,a;

  // Loop here getting pressure readings every 10 seconds.

  // If you want sea-level-compensated pressure, as used in weather reports,
  // you will need to know the altitude at which your measurements are taken.
  // We're using a constant called ALTITUDE in this sketch:
  /*
  Serial.println();
  Serial.print("provided altitude: ");
  Serial.print(ALTITUDE,0);
  Serial.print(" meters, ");
  Serial.print(ALTITUDE*3.28084,0);
  Serial.println(" feet");
  */
  // If you want to measure altitude, and not pressure, you will instead need
  // to provide a known baseline pressure. This is shown at the end of the sketch.

  // You must first get a temperature measurement to perform a pressure reading.
  
  // Start a temperature measurement:
  // If request is successful, the number of ms to wait is returned.
  // If request is unsuccessful, 0 is returned.

  status = pressure.startTemperature();
  if (status != 0)
  {
    // Wait for the measurement to complete:
    delay(status);

    // Retrieve the completed temperature measurement:
    // Note that the measurement is stored in the variable T.
    // Function returns 1 if successful, 0 if failure.

    status = pressure.getTemperature(T);
    if (status != 0)
    {
      // Print out the measurement:
      /*
      Serial.print("temperature: ");
      Serial.print(T,2);
      Serial.print(" deg C, ");
*/
      // Start a pressure measurement:
      // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
      // If request is successful, the number of ms to wait is returned.
      // If request is unsuccessful, 0 is returned.

      status = pressure.startPressure(0);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

        // Retrieve the completed pressure measurement:
        // Note that the measurement is stored in the variable P.
        // Note also that the function requires the previous temperature measurement (T).
        // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
        // Function returns 1 if successful, 0 if failure.

        status = pressure.getPressure(P,T);
        if (status != 0)
        {
          // Print out the measurement:
          Serial.print("absolute pressure: ");
          Serial.print(P,2);
          Serial.print(" mb, ");
          Serial.print(P*0.0295333727,2);
          Serial.print(" inHg");

          // The pressure sensor returns abolute pressure, which varies with altitude.
          // To remove the effects of altitude, use the sealevel function and your current altitude.
          // This number is commonly used in weather reports.
          // Parameters: P = absolute pressure in mb, ALTITUDE = current altitude in m.
          // Result: p0 = sea-level compensated pressure in mb

          p0 = pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO)
          Serial.print("  relative (sea-level) pressure: ");
          Serial.print(p0,2);
          Serial.print(" mb, ");
          Serial.print(p0*0.0295333727,2);
          Serial.println(" inHg");

        }
        else Serial.println("error retrieving pressure measurement\n");
      }
      else Serial.println("error starting pressure measurement\n");
    }
    else Serial.println("error retrieving temperature measurement\n");
  }
  else Serial.println("error starting temperature measurement\n");

  delay(100);  
}

I have the breakout board. So only connections are 3.3V of Arduino, SCL, SDA and GND.

Here are some photos:

The soldering here looks sketchy
image
The other side looks a little better, but I still doubt it's a solid contact. Have you checked whether wiggling the sensor makes it lock up even more easily?

How does this relay section relate to your circuit:
image
What drives them and when, and have you tested just the Arduino + sensor board and nothing else connected in any way, powered from computer USB?

Can you post a schematic of the whole setup?

      status = pressure.startPressure(0);
      if (status != 0)
      {
        // Wait for the measurement to complete:
        delay(status);

This is kind of odd; getting a status from an object and then using that as a delay. I suppose it should work and I don't think it'll produce a problem...unless the object can return -1 as well. I didn't check the library if it does/can do that.

The I2C bus was designed for ICs mounted on a single PCB to communicate.

Connections longer than a few cm cannot be expected to work without difficulty or at all, although for problematic longer connections, there are some things to try, like lowering the value of the pullup resistors on the SDA and SCL.

You must use a bidirectional logic level converter when connecting 5V MCU and 3.3V sensors, unless the sensor module has those built in. I doubt yours does.

I tried wiggling the sensor but it works alright when it is working.
The relay circuit is irrelevant because the sensor gives the same error when there is only an arduino and the sensor.
I have tried different libraries and checked the libraries and also the datasheet. They correspond.

I think the real problem is because of how I use the sensor. I directly blow at it. So the fluids in my mouth could pile up after a while. That could affect the sensor.

I think you might be right as well but it doesn't contribute to the problem as I thought it would. The connections I made at first were a few centimeters long but now it is actually about a meter.
I do not use a level converter. I don't know how I missed that. However, I still think that my problem is not about all that. As I explained it to rsmls, the reason could result from how I use it.

I see what you mean, but I don't think that's it, honestly. This wouldn't lock up the controller. The lockups suggest a power supply problem, or some exception on the I2C bus from which the ESP doesn't recover - although I find that already quite far-fetched.

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