Help getting I2C working on Wemos D1 R2 (ESP8266)

Hello everyone!

First of all, I'm a newby so there is a possibility I didn't understand some things here and there.

Alright, so for a project (a sensor hub) I bought an Wemos D1 R2 and a few sensors. The problem is, I cannot get any of my sensors to work which use I2C. One of the I2C sensors I wanted to uses is the GY-BMP280-3.3.

I wired it up in the following way: |500x216 VCC -> 3v3 GND -> GND SCL -> D1 SDA -> D2

So the SCL and SDA wires are both connected to the VCC line with a 10kOhm resistor.

Note that I use a non-arduino board, so the pinouts are a little different, but the D1 and D2 pins should be the correct pins according to the Wemos D1 R2 pinout: |500x265 In my wiring I used the bottom right D1 and D2.

I then used a esp8266 I2C scanner to see if I could detect the sensor, but he can't find/detect it. It keeps saying: "No I2C devices found"

So does anyone see something which could be wrong with the code, wiring, or sensor + board combination. Or has anyone some tests to maybe figure out what could be wrong?

Link to board: Wemos D1 R2 Link to sensor: GY-BMP280-3.3

hi how are you?

i have a similiar circuit functioning... but without the 10k ohm resistors in between the SDA ans SCL pins... also i have the CBB pin of the sensor connected to VCC.. please try that and let me now!!

best of luck...

Well, after some rewiring I got the I2C scanner to pick up “a sensor” at address 0x76 (which should be BMP sensor), so that’s nice. The next problem is using the sensor ::slight_smile:

When I run the following code:

/***************************************************************************
  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 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"));
  
  while (!bme.begin()) {  
    Serial.println("Could not find a valid BMP280 sensor, check wiring!");
    delay(1000);
  }
}
  
void loop() {
    Serial.print("Temperature = ");
    Serial.print(bme.readTemperature());
    Serial.println(" *C");
    
    Serial.print("Pressure = ");
    Serial.print(bme.readPressure());
    Serial.println(" Pa");

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

It says “BMP280 test. Could not find a valid BMP280 sensor, check wiring!”. It could be that the code does not work on my esp8266, although I highly doubt it.

So yeah I did manage to pick it up on I2C, but still haven’t been able to actually use it.

What wiring changes did you do to make it work? Just removed the pullup resistors?