NodeMCU ESP8266 and I2C pins... where are they?

Hi All

So I managed to get the BMP280 successfully set up with my Arduino uesterday, and the unit was reporting back temp, pressure and altitude using the I2C A(4) and A(5) pins.

Today I received my NodeMCU ESP8266 board and want to try the same thing using that. I am pretty much unsure of the correct pins to use for the I2C connection from the BMP280 to the board, and when I run the script, I see 'Could not find a valid BMP280 sensor, check wiring!' reported back in the serial monitor.

As a start in the debugging process, could someone advise please as to which pins I should be using on the NodeMCU ESP8266 Dev board.

Here's the sketch

/***************************************************************************
  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

int altitude;

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

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

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

void loop() {
  Serial.print("Temperature = ");
  Serial.print(bme.readTemperature()*9/5+32);
  Serial.println(" *f");

  Serial.print("Pressure = ");
  Serial.print(bme.readPressure() / 100);
  Serial.println(" mB");

  Serial.print("Approx altitude = ");
  Serial.print(bme.readAltitude(1035)); // this should be adjusted to your local forcase
  Serial.println(" m");

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

OK, updating my own thread. It looks as though somehow, between yesterday and today, I have murdered in cold blood, my BMP280 board!

It's dead. :angry:

Kaput.

Not alive.

Unliving.

Tested on SPI as well as I2C, and all the registers are #FF :fearful:

Temperature: 0.00 degrees C
Temperature: 32.00 degrees F
Pressure: 1.54 Pa
Altitude: 40293.19m
Altitude: 132195.50ft
%RH: 0.00 %

Ah well... funeral tomorrow, replacement on Saturday. Life goes on eh! :smiley:

Those Bosch sensor modules seem to be fragile - I've trashed a more than one BMP180 and I usually don't end up trashing hardware.

DrAzzy:
Those Bosch sensor modules seem to be fragile - I've trashed a more than one BMP180 and I usually don't end up trashing hardware.

Seems that way, DrAzzy! I was careful and only connected it to 3.3V too. Considered getting the BME280 as a replacement, but the price makes it not worth it for what you get. So, ordered one from UK and one from China!

Wonder which one will be here first! :stuck_out_tongue: