BMP180 with nodemcu

Hi

im trying to connect a Bmp180 sensor to a nodemcu.

with inspiration from this post:

Using D5 for SCL and D6 for SDA.

tried with and without 1k resistor between VVC-SCL and VVC-SDA

It keeps rebooting:

[337] Connecting to xxxx
[3339] Connected to WiFi
[3339] IP: 192.168.0.29
[3339] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.3 on NodeMCU

[3345] Free RAM: 45056
[5001] Connecting to blynk-cloud.com:8442
[5063] <[02|00|01|00] f2b5fdd5991649a89cf14ddc22bb2132
[5107] >[00|00|01|00]�
[5107] Ready (ping: 6ms).
[5108] <[11|00|01|00]Gver[00]0.4.3[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]NodeMCU[00]build[00]Jan 15 2017 14:54:47[00]
[5144] >[00|00|01|00]�
[5929] >[14]>�[00|05]
[5929] >vr[00]10
[6937] >[14]>�[00|05]
[6937] >vr[00]10
[6975] >[14]>�[00|05]
[6975] >vr[00]11
[6976] >[14]>�[00|05]
[6976] >vr[00]12
[6976] >[14]>�[00|05]
[6976] >vr[00]13
[7938] >[14]>�[00|05]
[7939] >vr[00]10
[8013] >[14]>�[00|05]
[8013] >vr[00]11
[8016] >[14]>�[00|05]
[8016] >vr[00]12
[8017] >[14]>�[00|05]
[8017] >vr[00]13

Exception (0):
epc1=0x40106da9 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3ffefe40 end: 3fff0050 offset: 01a0

>>>stack>>>
3ffeffe0:  0000007f 00ffff00 3ffeec12 40204992  
3ffefff0:  00000000 3ffeec12 3ffeec12 402049e8  
3fff0000:  3ffeec2c 3ffeec12 3ffeec2c 40202b7d  
3fff0010:  00000000 00000000 3ffeec2c 40204509  
3fff0020:  3fffdad0 00000000 3ffef020 40203691  
3fff0030:  3fffdad0 00000000 3ffef020 40205360  
3fff0040:  feefeffe feefeffe 3ffef030 40100718  
<<<stack<<<

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

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld
[344] Connecting to xxxx
[3347] Connected to WiFi
[3347] IP: 192.168.0.29
[3347] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.3 on NodeMCU

I’m trying with this code:

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>


char auth[] = "f2b5fdd5991649a89cf14ddc22bbxxxx";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;

#define I2C_SCL 14      // D5 Barometric Pressure Sensor (BMP085)
#define I2C_SDA 12      // D6

Adafruit_BMP085 bmp;

float dst, bt, bp, ba;
char dstmp[20], btmp[20], bprs[20], balt[20];
bool bmp085_present = true;

void setup()
{
  Serial.begin(115200); // See the connection status in Serial Monitor
  Blynk.begin(auth, "xxxx", "xxxx"); //insert here your SSID and password
  Wire.begin(I2C_SDA, I2C_SCL);
  timer.setInterval(3000L, sendUptime);
  
}

void sendUptime()
{
  float bp =  bmp.readPressure();
  Blynk.virtualWrite(10, bp); // virtual pin

  float ba =  bmp.readAltitude();
  Blynk.virtualWrite(11, ba); // virtual pin

  float bt =  bmp.readTemperature();
  Blynk.virtualWrite(12, bt); // virtual pin

  float dst =  bmp.readSealevelPressure();
  Blynk.virtualWrite(13, dst); // virtual pin

}

void loop()
{
  Blynk.run();
  timer.run();
}

Hi, may be in SETUP need add code:
if (!bmp.begin()) {
Serial.println(“Could not find a valid BMP085 sensor, check wiring!”);
while (1) {}
}

tried you suggestion but this resulted in “Could not find a valid BMP085 sensor, check wiring!”

[3347] Connected to WiFi
[3347] IP: 192.168.0.29
[3347] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.3 on NodeMCU

[3353] Free RAM: 45312
[5001] Connecting to blynk-cloud.com:8442
[5043] <[02|00|01|00] f2b5fdd5991649a89cf14ddc22bb2132
[5078] >[00|00|01|00]�
[5078] Ready (ping: 0ms).
[5078] <[11|00|01|00]Gver[00]0.4.3[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]NodeMCU[00]build[00]Jan 15 2017 16:08:13[00]
Could not find a valid BMP085 sensor, check wiring!

Soft WDT reset

ctx: cont 
sp: 3ffefd60 end: 3ffeff50 offset: 01b0

>>>stack>>>
3ffeff10:  00000000 00000d1b 3ffeee6c 402035f1  
3ffeff20:  feefeffe feefeffe feefeffe 3ffeef28  
3ffeff30:  3fffdad0 00000000 3ffeef20 402052b8  
3ffeff40:  feefeffe feefeffe 3ffeef30 40100718  
<<<stack<<<

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

load 0x4010f000, len 1384, room 16 
tail 8
chksum 0x2d
csum 0x2d
v3de0c112
~ld

I have this connection SCL - D1, SDA - D2 for my BMP180.

Bob, may I see your sketch?

found this example, and even this makes errors maybe its a defect bmp180 sensor?

from : http://www.esp8266learning.com/wemos-mini-bmp180-sensor-example.php

#include <Wire.h>
#include <Adafruit_BMP085.h>
 
Adafruit_BMP085 bmp;
 
void setup() 
{
  Serial.begin(9600);
  //Wire.begin (4, 5);
  if (!bmp.begin()) 
  {
    Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
    while (1) {}
  }
}
 
void loop() 
{
  Serial.print("Temperature = ");
  Serial.print(bmp.readTemperature());
  Serial.println(" Celsius");
 
  Serial.print("Pressure = ");
  Serial.print(bmp.readPressure());
  Serial.println(" Pascal");
 
 
  Serial.println();
  delay(5000);
}

Here is an example. I adapted it for NodeMCU and Blynk.
#include <Wire.h>
#include <Adafruit_BMP085.h>

// Connect VCC of the BMP085 sensor to 3.3V (NOT 5.0V!)
// Connect GND to Ground
// Connect SCL to i2c clock - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 5
// Connect SDA to i2c data - on '168/'328 Arduino Uno/Duemilanove/etc thats Analog 4
// EOC is not used, it signifies an end of conversion
// XCLR is a reset pin, also not used here

Adafruit_BMP085 bmp;

void setup() {
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println(“Could not find a valid BMP085 sensor, check wiring!”);
while (1) {}
}
}

void loop() {
Serial.print(“Temperature = “);
Serial.print(bmp.readTemperature());
Serial.println(” *C”);

Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pa");

// Calculate altitude assuming 'standard' barometric
// pressure of 1013.25 millibar = 101325 Pascal
Serial.print("Altitude = ");
Serial.print(bmp.readAltitude());
Serial.println(" meters");

// you can get a more precise measurement of altitude
// if you know the current sea level pressure which will
// vary with weather and such. If it is 1015 millibars
// that is equal to 101500 Pascals.
Serial.print(“Real altitude = “);
Serial.print(bmp.readAltitude(101500));
Serial.println(” meters”);

Serial.println();
delay(500);

}

Hi i useing this sketch and is good.

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

#include <Wire.h>
#include <Adafruit_BMP085.h>

#include <BH1750.h>  // https://github.com/claws/BH1750
BH1750 lightMeter;

char auth[] = "75a3e91cbdf98b35eea63e9c1";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;

#define I2C_SCL 12      // Barometric Pressure Sensor (BMP085)
#define I2C_SDA 13
Adafruit_BMP085 bmp;

float dst, bt, bp, ba;
char dstmp[20], btmp[20], bprs[20], balt[20];
bool bmp085_present = true;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, "ASUS", "Jersin72"); //insert here your SSID and password
 Wire.begin(I2C_SDA, I2C_SCL);
  delay(10);
if (!bmp.begin()) {
  Serial.println("Could not find a valid BMP085 sensor, check wiring!");
  //while (1) {}
  }
  
  timer.setInterval(20000L, sendUptime);
  lightMeter.begin();
}

void sendUptime()
{
  uint16_t lux = lightMeter.readLightLevel();
  Blynk.virtualWrite(4, lux);

  float bp =  bmp.readPressure()/1;
  Blynk.virtualWrite(9, bp); // virtual pin

  float ba =  bmp.readAltitude();
  Blynk.virtualWrite(7, ba); // virtual pin

  float bt =  bmp.readTemperature();
  Blynk.virtualWrite(12, bt); // virtual pin

  float dst =  bmp.readSealevelPressure(520)/100;
  Blynk.virtualWrite(13, dst); // virtual pin

}

void loop()
{
  Blynk.run();
  timer.run();
}

1 Like

Jiri_Bam

I got yours working but, you know how to set it up with a fixed altitude?

My Bmp180 will be stationary and it altitudes moves around…

see bottom of screenshot, yellow numbers

 #define BLYNK_DEBUG
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

#include <Wire.h>
#include <Adafruit_BMP085.h>

#include <BH1750.h>  // https://github.com/claws/BH1750
BH1750 lightMeter;


char auth[] = "xxx";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;

#define I2C_SCL 12      // D6  Barometric Pressure Sensor (BMP085)
#define I2C_SDA 13      // D7
Adafruit_BMP085 bmp;

float dst, bt, bp, ba;
char dstmp[20], btmp[20], bprs[20], balt[20];
bool bmp085_present = true;

void setup()
{
  WiFi.mode(WIFI_STA);
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, "xx", "xxx"); //insert here your SSID and password
 Wire.begin(I2C_SDA, I2C_SCL);
  delay(10);
  
  if (!bmp.begin()) 
  {
      Serial.println("Could not find a valid BMP085 sensor, check wiring!");
      //while (1) {}
  }

  timer.setInterval(100000L, sendWifi);
  timer.setInterval(20000L, sendUptime);
  lightMeter.begin();


}


void sendWifi() 
{
  Blynk.virtualWrite(1, map(WiFi.RSSI(), -105, -40, 0, 100) );
}



void sendUptime()
{
  uint16_t lux = lightMeter.readLightLevel();
  Blynk.virtualWrite(4, lux);

  float bp =  bmp.readPressure()/1;
  Blynk.virtualWrite(9, bp); // virtual pin

  float ba =  bmp.readAltitude();
  Blynk.virtualWrite(7, ba); // virtual pin

  float bt =  bmp.readTemperature();
  Blynk.virtualWrite(12, bt); // virtual pin

  float dst =  bmp.readSealevelPressure(529)/100;
  Blynk.virtualWrite(13, dst); // virtual pin

}

void loop()
{
  Blynk.run();
  timer.run();
}

Hi. I dont use altitudes. Because BMP180 show bad value altitudes… And i dont know how fixed it… Maybye a otherwise count…

Hi can i see your connection please

Why reopen a two+ year old topic to ask for something easily available with a little looking, searching and testing :stuck_out_tongue_winking_eye: