How to make a Weather monitoring system using the Nodemcu ESP8266 board and the New Blynk app

How to make a Weather monitoring system using the Nodemcu ESP8266 board and the New Blynk app

Hello and welcome back. In this tutorial, we will learn how to make a weather monitoring system with the Nodemcu ESP8266 board and the New Blynk app. In this system, we can monitor the light value, Temperature, Humidity, Pressure, and Rainfall. For that, I used the LDR sensor, DHT11 sensor, BMP180 sensor, and Rain sensor. If you want to do it using the old Blynk app, please use this link for that. I think this weather monitor system is best suited for greenhouses, zoos, Animal farms and etc. Also, we can monitor those values from anywhere in the world using our smartphone or computer.

LDR sensor

We can measure the Light value using this sensor. For that, I used an LDR sensor module. But, you can use a single LDR sensor.

More info — Click me

DHT11 sensor

Through this sensor, we can get temperature and humidity values. If you want to get higher accuracy values, please use a DHT22 sensor.

More info — Click me

BMP180 sensor

We can get the Pressure, Temperature, and Altitude using this sensor. In this tutorial, I used only pressure values.

More info — Click me

Rain sensor

Using this sensor, we can get the rainfall values. Also, you can get that value either analog or digitally through this sensor.

More info — Click me

OK, let’s do this project Step by step. The required components are given below.

Step 1

Firstly, identify these components.

Step 2

Secondly, attach these components one by one to the breadboard. You can do it as you like.

Step 3

Thirdly, connect these components to the Nodemcu board. For that, use the circuit diagram below.

How to make a Weather monitoring system using the Nodemcu ESP8266 board and the New Blynk app

Step 4

OK, now let’s create the web dashboard for this project. For that, follow the instructions below.

  • First, go to the Blynk website and create a new account using your email address. Then, sign in to your account and create a new template for this project. Then name it as you like. I named it the “Weather Monitoring System”.
  • Now, click the datastreams tab and create the five datastreams for this project. For that, use the information below.
  • Virtual Pin > Name –> Temperature / Pin –> V0 / DataType –> double / MIN –>0 / MAX –> 100
  • Virtual Pin > Name –> Humidity / Pin –> V1 / DataType –> double / MIN –>0 / MAX –> 100
  • Virtual Pin > Name –> Rainfall / Pin –> V2 / DataType –> integer / MIN –>0 / MAX –> 100
  • Virtual Pin > Name –> Pressure / Pin –> V3 / DataType –> double / MIN –>300 / MAX –> 1100
  • Virtual Pin > Name –> Light / Pin –> V4 / DataType –> integer / MIN –>0 / MAX –> 1
  • Now, click the web dashboard tab. Then, drag and drop the four Gauge widgets and one LED widget to the dashboard. Next, click on the settings icons one by one in the widgets and select the datastreams that we created earlier. Finally, arrange these widgets as you like.
  • Next, click the search icon and create a new device. For that, select the template you created earlier.

OK, the Blynk web Dashboard is ready for you.

Step 5

Now, let’s create the Blynk mobile dashboard step by step. For that, follow the instructions below.

  • First, install the Blynk app on your smartphone. Then, sign in to your account and click the template we created earlier. After that, click the “Setup Dashboard” button and add the four Gauge widgets and one LED widget to the dashboard. After, arrange these widgets as you like.
  • Now, click on the widget one by one and select the datastreams that we created in the web dashboard.

OK, the Blynk mobile dashboard is ready for you.

Step 6

Now, let’s connect the Nodemcu board to the computer and upload the program for this. It’s as follows.

/*Weather monitoring system with the New Blynk app
   
Home Page
*/ //Include the library files #include <LiquidCrystal_I2C.h> #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> #include <DHT.h> #include <SFE_BMP180.h> //Initialize the LCD display LiquidCrystal_I2C lcd(0x27, 16, 2); // Create an object for the BMP180 sensor SFE_BMP180 bmp; char auth[] = "";//Enter your Auth token char ssid[] = "";//Enter your WIFI name char pass[] = "";//Enter your WIFI password DHT dht(D3, DHT11);//(DHT sensor pin,sensor type) BlynkTimer timer; //Define Rain and LDR pins #define rain A0 #define light D0 //Create three variables for pressure double T, P; char status; void setup() { Serial.begin(9600); bmp.begin(); lcd.init(); lcd.backlight(); pinMode(light, INPUT); Blynk.begin(auth, ssid, pass, "blynk.cloud", 80); dht.begin(); lcd.setCursor(0, 0); lcd.print("Weather Monitor"); lcd.setCursor(4, 1); lcd.print("System"); delay(4000); lcd.clear(); //Call the functions timer.setInterval(100L, DHT11sensor); timer.setInterval(100L, rainSensor); timer.setInterval(100L, pressure); timer.setInterval(100L, LDRsensor); } //Get the DHT11 sensor values void DHT11sensor() { float h = dht.readHumidity(); float t = dht.readTemperature(); if (isnan(h) || isnan(t)) { Serial.println("Failed to read from DHT sensor!"); return; } Blynk.virtualWrite(V0, t); Blynk.virtualWrite(V1, h); lcd.setCursor(0, 0); lcd.print("T:"); lcd.print(t); lcd.setCursor(8, 0); lcd.print("H:"); lcd.print(h); } //Get the rain sensor values void rainSensor() { int value = analogRead(rain); value = map(value, 0, 1024, 0, 100); Blynk.virtualWrite(V2, value); lcd.setCursor(0, 1); lcd.print("R:"); lcd.print(value); lcd.print(" "); } //Get the pressure values void pressure() { status = bmp.startTemperature(); if (status != 0) { delay(status); status = bmp.getTemperature(T); status = bmp.startPressure(3);// 0 to 3 if (status != 0) { delay(status); status = bmp.getPressure(P, T); if (status != 0) { } } } Blynk.virtualWrite(V3, P); lcd.setCursor(8, 1); lcd.print("P:"); lcd.print(P); } //Get the LDR sensor values void LDRsensor() { bool value = digitalRead(light); if (value == 0) { WidgetLED LED(V4); LED.on(); } else { WidgetLED LED(V4); LED.off(); } } void loop() { Blynk.run();//Run the Blynk library timer.run();//Run the Blynk timer }
  • Now, copy and paste the Blynk auth token. It’s in the web dashboard.
  • Next, include your WIFI connection details.
  • Next, select board and port. After that, upload this code to the Nodemcu board.

Step 7

OK, now remove the USB cable and connect the external 5v power supply to this project. To do this, use the circuit diagram above.

So, enjoy this project. The full video guide is below. See you in the next project.

How to make a Weather monitoring system using the Nodemcu ESP8266 board and the New Blynk app

Similar Posts

Leave a Reply

Your email address will not be published.