BMP180, ESP8266 12E, Blynk

Loop up the examples that are provided with the LCD widget and let us know if you are still stuck.

1 Like
WidgetLCD lcd(V3);

float dst =  bmp.readSealevelPressure(520)/100;
  Blynk.virtualWrite(13, dst); // virtual pin 
  if(weatherDiff > 250)
 lcd.clear();
 
  {
       lcd.clear(); //Use it to clear the LCD Widget
  lcd.print(4, 0, "Rain");
  
 
  }

I was try this but no working…

For test purposes remove the if statement and just send lcd.print… within the senduptime() function.

Now i know how to explore text on lcd in blynk. But what about: lcd.clear(); ? I think i dont need it in this sketch… Thanks.


 float bt =  bmp.readTemperature();
  Blynk.virtualWrite(12, bt); // virtual pin
 lcd.print(1, 0, bt);
  
if (bt > 29)   { 
  lcd.print(1, 1, "hot");
   
 }
 if (bt < 29)   { 
  lcd.print(1, 1, "cold");
  
 }

lcd.clear is useful sometimes, take your “hot” and “cold” text.

Cold is 1 character longer than hot so if you sent Cold followed by hot you will see “hotd” on the lcd.
You could send "hot " but trying to remember the length of all the text you send to the lcd is a pain, ergo lcd.clear() is useful before you send the actual text.

Yes.Ok. But I dont know good position for lcd.clear… This position no good working:

  Blynk.virtualWrite(12, bt); // virtual pin
 lcd.print(1, 0, bt);
  
if (bt > 29)   { 
lcd.clear();
  lcd.print(1, 1, "hot");
   
 }
 if (bt < 29)   { 
lcd.clear();
  lcd.print(1, 1, "cold");
  
 }

Is bt showing in the lcd at 1, 0?

It would also be normal to include equal in one of the if statements, so

if(bt >= 29) …

or

if(bt <= 29)…

this ensures you trap every possible value for bt i.e. when bt equals 29 (as well as above and below 29).

Yes with out lcd.clear is it showing bt.:

  lcd.print(1, 0, bt)
  
if (bt >= 29)   { 

  lcd.print(1, 1,   "hot");
   
 }
 if (bt <=  29)   { 

  lcd.print(1, 1,  "cold");
  

And with lcd.clear no

  Blynk.virtualWrite(12, bt); // virtual pin
 lcd.print(1, 0, bt);
  
if (bt > 29)   { 
lcd.clear();
  lcd.print(1, 1, "hot");
   
 }
 if (bt < 29)   { 
lcd.clear();
  lcd.print(1, 1, "cold");
  
 }

put it before
lcd.print(1, 0, bt);
and it will work

…or just add one sign to "hot "
Then in this case You don’t need lcd.clear()

Yes it it one choice. Thanks.

And is ± 250 in Pressure good for weather forecast?: (“Sunny!”) , (“Partly Cloudy”); , (“Rain :-(”).

if(weatherDiff > 250)
Serial.println(“Sunny!”);
else if ((weatherDiff <= 250) || (weatherDiff >= -250))
Serial.println(“Partly Cloudy”);
else if (weatherDiff > -250)
Serial.println(“Rain :-(”);
Serial.println();

:scream: please don’t ask me (at least), I’m not good in weather forecasting. I think, that current condition predicting should be more advanced in calculation, then just pressure change. What I think You should consider:

  • rate of pressure change (not just its amount)
  • humidity (and its change?)
  • temperature (and its change?)

If you really want to do it, I think you should look up at some meteo-enthusiast forums :smiley:

It’s a starting point and better than nothing. As @marvin7 points out you should also monitor the change in pressure over time. So with another timer and global variables perhaps check hourly to see how many millibars the pressure has moved in the last hour.

Ok.Yes. Now i nedd BMP180 and BH1750 and DHT22 together on ESP8266 E12

But this sketch no working together. ESP is still disconecting from net or Blynk. And Lux no working.
Thank you.

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

#include <Adafruit_BMP085.h>

#include <Wire.h>
#include <BH1750.h>  // https://github.com/claws/BH1750  //SCL-D1   , SDA- D2
BH1750 lightMeter;

#define DHTPIN 12 //pin gpio 12 in sensor
#define DHTTYPE DHT22   // DHT 22 Change this if you have a DHT11
DHT dht(DHTPIN, DHTTYPE);




// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "75a3e91cbdf1457c9498b35eea63e9c1";  // 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];



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) {}
  }


  lightMeter.begin();
 
  // Setup a function to be called every second
  timer.setInterval(10000L, sendUptime);
}

void sendUptime()
{

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

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

  
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
   //Read the Temp and Humidity from DHT
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  
  Blynk.virtualWrite(10, t); // virtual pin 
  Blynk.virtualWrite(13, h); // virtual pin 
}

void loop()
{

  
  Blynk.run();
  timer.run();
}

Review the GPIOs

Now i have: #define DHTPIN 5 and it is same. DHT and BMP085 is working but BH1750 no… And ESP is disconecting evry few seconds… Thanks.

I think no good is this:

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

But if a delete this i dont know what pins i can have use for BMP085.
Thanks.

Referring to connection issue, look at Serial port output while sketch is running. When ESP restarts, it prints some debug infos. If this is not the case, then… I’m not sure what can be the reason. You will probably need to enable full debug of Blynk library by enabling:

#define BLYNK_DEBUG // Optional, this enables lots of prints
#define BLYNK_PRINT Serial

In serial monitor is this. Could not find a valid BMP085 sensor, check wiring!- I have on ESP now only BH1750 but BH1750 no working and ESP is still connecting and connected…

>>>stack>>>
3ffefef0:  00000000 0000073b 3ffeff74 40203654  
3ffeff00:  feefeffe feefeffe feefeffe 3ffeef00  
3ffeff10:  3fffdad0 00000000 3ffeeef8 40204f60  
3ffeff20:  feefeffe feefeffe 3ffeef10 40100718  
<<<stack<<<
ĆSنEŽDäđ˙[259] Connecting to ASUS
[1759] Connected to WiFi
[1760] IP: 192.168.1.246
[1760] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.4.0 on NodeMCU

[1830] Free RAM: 45128
[5001] Connecting to blynk-cloud.com:8442
[5026] <[02|00|01|00] 75a3e91cbdf1457c9498b35eea63e9c1
[5050] >[00|00|01|00]Č
[5050] Ready (ping: 2ms).
[5050] <[11|00|01|00]Gver[00]0.4.0[00]h-beat[00]10[00]buff-in[00]256[00]dev[00]NodeMCU[00]build[00]Dec 12 2016 21:25:12[00]
Could not find a valid BMP085 sensor, check wiring!

Soft WDT reset

ctx: cont 
sp: 3ffefd40 end: 3ffeff30 offset: 01b0

>>>stack>>>
3ffefef0:  00000000 0000073e 3ffeff74 40203654  
3ffeff00:  feefeffe feefeffe feefeffe 3ffeef00  
3ffeff10:  3fffdad0 00000000 3ffeeef8 40204f60  
3ffeff20:  feefeffe feefeffe 3ffeef10 40100718  
<<<stack<<<
ż„Öb(ČýD
Ąţ[250] Connecting to ASUS
[1751] Connected to WiFi
[1751] IP: 192.168.1.246
[1751] 

Serial.println("Could not find a valid BMP085 sensor, check wiring!");
  while (1) {}

That is your problem… Infinite loop, and reboot by WDT triggering

You must handle sensor errors other way. This one is not suitable here (and especially in ESP - it can’t “stop”, that is why it triggers WDT)