Bmp280 невидим для esp8266

esp8266 NodeMCU абсолютно не видит датчик, как бы я его не подключал, он не видим для esp8266. Проверял двумя разными чекерами, оба не видят esp8266. Я бы и списал на бракованный датчик, но это уже 4 датчик который не работает, причем не работает на двух esp8266
#include <Wire.h>

void setup()
{
  Wire.begin();
 
  Serial.begin(9600);
  while (!Serial);             // Leonardo: wait for serial monitor
  Serial.println("\nI2C Scanner");
}
 
void loop()
{
  byte error, address;
  int nDevices;
 
  Serial.println("Scanning...");
 
  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
 
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");
 
      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
 
  delay(5000);           // wait 5 seconds for next scan
}

и второй чекер i2c

        *void scanPorts() {*
        
        *for (uint8_t i = 0; i < sizeof(portArray); i++) {*
        
        *for (uint8_t j = 0; j < sizeof(portArray); j++) {*
        
        *if (i != j){*
        
        *Serial.print("Scanning (SDA : SCL) - " + portMap[i] + " : " + portMap[j] + " - ");*
        
        *Wire.begin(portArray[i], portArray[j]);*
        
        *check_if_exist_I2C();*
        
        *}*
        
        *}*
        
        *}*
        
        *}*
        
        *//This code is a modified version of the code posted on the Arduino forum and other places*
        
        *void check_if_exist_I2C() {*
        
        *byte error, address;*
        
        *int nDevices;*
        
        *nDevices = 0;*
        
        *for (address = 1; address < 127; address++ ) {*
        
        *// The i2c_scanner uses the return value of*
        
        *// the Write.endTransmisstion to see if*
        
        *// a device did acknowledge to the address.*
        
        *Wire.beginTransmission(address);*
        
        *error = Wire.endTransmission();*
        
        *if (error == 0){*
        
        *Serial.print("I2C device found at address 0x");*
        
        *if (address < 16)*
        
        *Serial.print("0");*
        
        *Serial.print(address, HEX);*
        
        *Serial.println(" !");*
        
        *nDevices++;*
        
        *} else if (error == 4) {*
        
        *Serial.print("Unknow error at address 0x");*
        
        *if (address < 16)*
        
        *Serial.print("0");*
        
        *Serial.println(address, HEX);*
        
        *}*
        
        *} //for loop*
        
        *if (nDevices == 0)*
        
        *Serial.println("No I2C devices found");*
        
        *else*
        
        *Serial.println("**********************************\n");*
        
        *}*

Как подключаешь и какие ноги прописаны в программе? Короче. Схему и программу давай. И прочитай правила форума в первой закреплённой теме. А то ты уже нарушил их своим безутешным плачем.

Добавил код чекеров i2c и схему подключения

А есть какой нибудь другой датчик i2c? С ним ,
другим, определение адреса срабатывает?

Вот даже интересно стало. Вскрыл коробочку - подключено как на рисунке. Всё работает.
Адрес 0х76 пользуешь?

адрес 0х76, i2c дисплей нормально работает

Жаль. У меня работает и с 8266 и с 32. Как вариант попробовать не есп. И второй тяжёлый путь - осциллографом посмотреть что твориться на шинах.

А вот билиотека Adafruit талдычит - BMP280_ADDRESS (0x77) /**< The default I2C address for the sensor. */
я тоже в своё время не мог столкнуть вопрос с мёртвой точки, вечером напомни, погляжу свой пример для этого датчика…

пришёл домой, зацепил датчик BMP280 (ИМЕННО Р) к Wemos D1, залил скетч:

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

  Designed specifically to work with the Adafruit BMP280 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 <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(9600);
  Serial.println(F("BMP280 Forced Mode Test."));

!bmp.begin(BMP280_ADDRESS_ALT, BMP280_CHIPID);


  /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_FORCED,     /* 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. */
}

void loop() {
  // must call this to wake sensor up and get new measurement data
  // it blocks until measurement is complete
bmp.takeForcedMeasurement();
    // can now print out the new measurements
    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(2000);

}

без проблем имеем резалт:
Temperature = 24.69 *C
Pressure = 98709.27 Pa
Approx altitude = 220.09 m

подключение:
|SCL|GPIO 5 (D1)
|SDA|GPIO 4 (D2)


да, адрес 0х76,
0х77 это у оригинала

А 0x76 у подделки?

скажем так - у клона

Есть другое мнение.

1 лайк

я не буду спорить, пусть будет так…
суть от этого не меняется, датчик работает с ЕСП8266