The use of the ESP8266 in the world of IoT

User avatar
By yukardo
#87000 Hello everybody,

I am making a project using a BMP280 sensor connect to an ESP-01 board.

I am using I2C communication.

But it does not work. I think ESP-01 is not booting. I made a test with a LED and it did not execute loop code.

I use the following code:

Code: Select all#include <Wire.h>
//#include <SPI.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(115200);
  Serial.println(F("BMP280 test"));

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

  /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */

  pinMode(1, OUTPUT);

  Wire.begin(2, 0);

}


void loop() {

    digitalWrite(1, HIGH);
   
    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)); /* Adjusted to local forecast! */
    Serial.println(" m");

    Serial.println();
    delay(1000);

    digitalWrite(1, LOW);
    delay(1000);
}


This is the diagram. LED connected to GPIO1 does not appear in the diagram.

Image

I hope you can help me.

Thanks.
User avatar
By Vossing
#92294 I want to make this too, have you found a solution ?
By the way the wiring picture is missing.

If you have manage to get this to work, would you like to share it!
User avatar
By schufti
#92309 it is bme280 but you will get the idea...
You do not have the required permissions to view the files attached to this post.