ESP8266 ProjectsIOT Projects

Live Weather Station using NodeMCU ESP8266 with dashboard IOT

Learn how to build a DIY weather station interfacing NodeMCU, temperature and humidity sensor, pressure sensor and rain sensor to get realtime data on local server.

Have you ever been curious to know whats the live weather status exactly where you live, many people use weather application by choosing the city name  to get the data from weather stations but that’s not mostly accurate to your live location. So here we brought an interesting project to make a live weather station at home with ESP8266 – 12E based nodeMCU and monitor temperature, humidity, Barometric pressure and rainfall status  over local web server. Follow the below instructions to learn about the sensors used and interfacing them to build the awesome final device.

Lets see what are the items required to build this.

Hardware Requirements:

  • NodeMCU ESP8266
  • DHT11 temperature and humidity sensor or latest DHT22 with high accuracy.
  • BMP180 or BMP280 Barometric pressure sensor
  • Rain sensor module FC-37
  • 2 X Resistors 4.7 K ohm
  • USB cable for code upload
  • Few connection wires

Software Requirements:

  • Arduino IDE

Sensor details:

DHT11 temperature and humidity sensor

This sensor is an easy to use temperature and humidity sensor with attractive cheap price. It allows us to get both temperature and humidity data from single board instead of using two.

It comes in two types one is only the sensor with 4 pins on it and the other one is sensor fitted on a PCB which includes an 5 kΩ pull up resistance and a on board LED which indicates the data usage. Both has same functionality only new difference is the price and connection pins.

  • It works in the voltages between 3 volts and 5 volts
  • with the temperature measurement range from 0 to 50 degree centigrade.
  • Accuracy ± 2 ° C
  • Resolution Temperature: 0.1 ° C
  • Humidity measurement range: 20% to 90% RH.
  • Humidity measurement accuracy: 5% RH.
  • Humidity Resolution: 1% RH
  • Sensing time: 1 sec.

Rain Sensor:

This type of sensor detects the presence of rain due to the variation in the conductivity of the sensor when it comes into contact with water. There are several similar sensor models, such as the FC-37 and the YL-83.

Constructively they are simple sensors. There are two contacts, connected to conductive tracks interlocked with each other at a small distance, without contact between them. When water is deposited on the surface, both conductors are placed in electrical contact, which can be detected by a sensor.

Both models are shipped with a standard measurement plate with the LM393 comparator, which allows the reading to be obtained both as an analog value and digitally when a certain threshold is exceeded, which is regulated through a potentiometer located on the plate itself.

Analog values ​​measured range from 0 for a fully soaked plate to 1023 for a completely dry plate .

BMP180 Barometric Pressure Sensor:

bmp180 sensor is a printed circuit board, which includes a high-precision absolute barometric / atmospheric pressure sensor (atmospheric pressure is the force per unit area that air exerts on Earth’s surface), it has a measurement range between 300 and 1100 hPa (Hecto Pascal) and an error margin of 0.03 hPa, it also has a temperature sensor and by means of software it allows calculating the altitude with respect to the sea.

The pressure sensor is based on piezo-resistive technology with high efficiency, linearity and long duration, it has a power range of between 1.8 volts and 3.6 volts dc (direct current), so if we are going to use it With a micro controller running at 5 volts, we will need level adapters on the SDA (data line) and SCL (clock line) pins of the I2C bus.

I currently have the model on the left and the central one, both are the same, except that the central module has an integrated 3.3 volt source, it can be powered at 5 volts on the pin marked Vcc, but it can also be powered with 3.3 volts on the pin marked 3.3 volts.

Interfacing DHT11, BMP180 and rain sensor with NodeMCU to built Weather station

Here we are interfacing the sensors with nodemcu both dht11 and BMP 180 are connected directly without using any external resistance but for rain sensor we are using 2 4.7K ohm resistors. For detailed connections refer the below image for a schematic diagram.

Live Weather Station using NodeMCU ESP8266 circuit diagram

Source code:

In this project we have two codes 1) Main arduino code 2) front view dashboard code which in html format.

As we cannot upload the html code directly we need to convert it into a compatible format so we converted into index.h file format.

Libraries needed:

index.h source code

Copy the code into note pad and save it with name as index.h and save it in the same directory where the main .ino file is located and don’t forget to choose all files instead of .txt.

Live Weather Station Main Code 

Copy the below code and paste it in the Arduino IDE and save it in the same directory where index.h was saved previously.

Working of Live Weather station using ESP8266

After connecting and uploading the code to the nodeMCU open serial monitor to find the IP address assigned to the device just copy the address and paste in any web browser connected in the same network to display the Live weather monitoring dashboard.

You can also view the weather data in the serial monitor.

Live Weather Station using NodeMCU ESP8266 dashboard output

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Back to top button