fbpx

ESP8266 -Weather Monitor System

weather monitor device used to monitor the atmospheric conditions to provide weather information over the internet using nodemcu.

Weather monitor measures Humidity, Temperature and Pressure parameters and displays them on the android application, so the weather conditions can be monitored from the remote place over the Internet.

Block Diagram

Component Required

  1. NodeMCU
  2. DHT11
  3. BMP180
  4. Breadboard
  5. Jumper Wires

Software Required

  1. MIT App inventor – Android
  2. Firebase
  3. Arduino 

Flow Chart

Circuit diagram

ESP8266 – 12E

Firebase

Login To firebase

  • create a new project
  • Enter Project name
  • Create a database for weather monitoring device
  • Set firebase security rules to test mode to allow esp8266 to set and read database
  • Set Rules of firebase to read and write in real-time database
  • Select Real-time Database 
  • Copy the URL- Required in code as firebase host-id to communicate with firebase
  • Click to add child to Create a field to hold data in firebase
  • Create Humidity field to hold humidity data in firebase.
  • Humidity,TemperatureC, TemperatureF field in realtime database hold weather station data.
  • Get authentication id from firebase.

Android Application

  • Create New project from mit app inventor for weather monitoring
  • Select layout to place the userinterface component
  • Create a header from the Android application: 

                 drag and drop label in the screen for app header

  • Add firebase component to app
  • Use the firebase database url, you can ignore the FirebaseToken 

Code

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#include "DHT.h"
#include <SFE_BMP180.h>
#include <Wire.h>
#define FIREBASE_HOST " "
#define ALTITUDE 431.0
#define DHTPIN 0
#define DHTTYPE DHT11 // DHT 11
SFE_BMP180 pressure;
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "IMAKE"; // Your ssid
const char* password = "12345678"; // Your Password
char status;
double T,P,p0,a;
void setup()
{
Serial.begin(115200);
delay(100);
dht.begin();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi is connected");
Serial.println(WiFi.localIP());
if (pressure.begin())
{
Serial.println("BMP180 init success");
}
else
{
Serial.println("BMP180 init fail\n\n");
while(1); // Pause forever.
}
delay(1000);
Firebase.begin(FIREBASE_HOST);
}
void loop()
{
status = pressure.getPressure(P,T);
if (status != 0)
{
p0 = pressure.sealevel(P,ALTITUDE); // we're at 1655 meters (Boulder, CO)
Serial.print("relative (sea-level) pressure: ");
Serial.print(p0,2);
Serial.print(" mb, ");
}
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
Firebase.setFloat("Humidity",h);
Firebase.setFloat("TemperatureC",h);
Firebase.setFloat("TemperatureF",h);
} 

Leave a Reply

Your email address will not be published. Required fields are marked *