.I cannot setup or install my sensor (BMP280)


Hi,
I am using esp32 board and bmp280 sensor. The problem in the red square happen when I press en button in esp32 board . I used these code:
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// BMP280_DEV - ESP32, I2C Communications, Default Configuration, Normal Conversion, User-Defined Pins
//////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <BMP280_DEV.h> // Include the BMP280_DEV.h library

float temperature, pressure, altitude; // Create the temperature, pressure and altitude variables
BMP280_DEV bmp280(A6, A7); // Instantiate (create) a BMP280 object and set-up for I2C operation on pins SDA: A6, SCL: A7

void setup()
{
Serial.begin(115200); // Initialise the serial port
bmp280.begin(); // Default initialisation, place the BMP280 into SLEEP_MODE
bmp280.setTimeStandby(TIME_STANDBY_2000MS); // Set the standby time to 2 seconds
bmp280.startNormalConversion(); // Start BMP280 continuous conversion in NORMAL_MODE
}

void loop()
{
if (bmp280.getMeasurements(temperature, pressure, altitude)) // Check if the measurement is complete
{
Serial.print(temperature); // Display the results
Serial.print(F("*C "));
Serial.print(pressure);
Serial.print(F("hPa "));
Serial.print(altitude);
Serial.println(F("m"));
}
}

?any one can help me

what you see in the red square is normal ESP32 startup gobbledygook. the ESP32 is telling you how its day is going, it has not looked at your program yet

read the "How to use this forum" post at the top of every subforum

find an I2C scanner and determine if the ESP32 sees the BMP280. come back and show us the results, in the manner described in the "How to use this forum" post.

The first Serial Print you use is after an if... If the if is not a yes you will have no indication your progam is running.

1 Like

what should I do now?

Try this:

/***************************************************************************
  This is a library for the BMP280 humidity, temperature & pressure sensor

  Designed specifically to work with the Adafruit BMEP280 Breakout
  ----> http://www.adafruit.com/products/2651

  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface.

  Adafruit invests time and resources providing this open source code,
  please support Adafruit andopen-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried & Kevin Townsend for Adafruit Industries.
  BSD license, all text above must be included in any redistribution
 ***************************************************************************/

#include <Wire.h>
//#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>

//#define BMP_SCK 13
//#define BMP_MISO 12
//#define BMP_MOSI 11
//#define BMP_CS 10

Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);

void setup() {
  Serial.begin(11520);
  Serial.println(F("BMP280 test"));

  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
  }
}

void loop() {
  Serial.print(F("Temperature = "));
  Serial.print(bmp.readTemperature());
  Serial.println(" *C");

  Serial.print(F("Pressure = "));
  Serial.print(bmp.readPressure());
  Serial.println(" Pa");

  Serial.print(F("Approx altitude = "));
  Serial.print(bmp.readAltitude(1013.25)); // this should be adjusted to your local forcast
  Serial.println(" m");

  Serial.println();
  delay(2000);
}

have a look at post cant-read-bmp280-sensor-data-using-esp32

1 Like

Never post screenshots in the forum.
Please study the forum guidelines on how to insert code and error messages.

I had this problem for far too long. Then it occurred to me to try the BME280 library, and et voila, whaddaya know, it's working

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