-->
Page 1 of 3

Using BME280 with NodeMCU Esp8266

PostPosted: Thu Dec 15, 2016 2:57 pm
by canedje
I try to connect a BME280 sensor to my NodeMCU.
I'm using this library and example sketch: https://github.com/adafruit/Adafruit_BME280_Library

I'm not able to recieve data. The error message:
Could not find a valid BME280 sensor, check wiring!
appeares.

I try to connect by SCL and SDA.
Where do I need to connect the SCL and SDA connections? On what pins?
Or is there somewhere an example sketch to test?
I'm used to use the old BMP180. In that sketch I can define the SCL and SDA pins
by using:
Code: Select all#define SDAPIN  04
#define SCLPIN  05

void setup() {
  Serial.begin(115200);
  Wire.begin(SDAPIN, SCLPIN);        //sda, scl
  Wire.begin();


The code dislayed by theBME280 connected to NodeMCU on pins GPIO4 and GPIO5:

Code: Select allctx: cont
sp: 3ffe9d50 end: 3ffe9f20 offset: 01b0

>>>stack>>>
3ffe9f00:  00000000 00000000 3ffe9f44 40201133 
3ffe9f10:  00000000 00000000 3ffe8f00 40100118 
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld
BME280 test
Could not find a valid BME280 sensor, check wiring!


chksum is 0x42 (no connection found)
It should be 0x77 or 0x76

Re: Using BME280 with NodeMCU Esp8266

PostPosted: Thu Dec 15, 2016 3:52 pm
by martinayotte
By default they are on pins 4(SDA) and 5(SCL).
But you can overwrite those with Wire.begin(0, 2), for exemple, since there are already some pullups on those GPIOs.

Re: Using BME280 with NodeMCU Esp8266

PostPosted: Thu Dec 15, 2016 4:35 pm
by canedje
martinayotte wrote:By default they are on pins 4(SDA) and 5(SCL).
But you can overwrite those with Wire.begin(0, 2), for exemple, since there are already some pullups on those GPIOs.


Thanks.
I connected SDA and SCL allready to pins 4 and 5.
But then the NodeMCU still not recognizing the BME 280

Re: Using BME280 with NodeMCU Esp8266

PostPosted: Thu Dec 15, 2016 5:33 pm
by schufti
bme280 can be jumpered for 2 addresses (0x76/0x77). Breakout boards come in both variations.
Check with alternative address (usually defined in .h).

if you use gpio4/5 you should use pullups, not necessarily needed when using gpio0/2.