Hi guys, I hope you are good and doing well in your life.Today we are back with a new project which is Weather Monitoring System using Arduino UNO. We will use different sensors to measure weather parameters like Temperature, Humidity, Air Quality Index, Sunlight Intensity and Atmospheric Pressure.
The weather conditions are required to be monitored to maintain the healthy growth in crops and to ensure the safe working environment in industries and to predict the weather in future also. Nowadays, many Industries and Farmers are using this smart Technology to increase their production and work in an efficient way.
In this Project, we will gather the data from various sensors and display it on a 20x4 LCD display and observe the weather.
We will discuss all points and concepts briefly in this article and also provide a Proteus Simulation to observe how it will work in the real world.
Complete fully explained code and simulation is also provided below as you go ahead in this article. You can download it from there.
For any queries and doubts, you can contact -
Email - email@example.com
We will measure four major parameters of weather in this project, Temperature, Humidity, Air Quality Index, Sunlight Intensity and Atmospheric Pressure. We can add more sensors in our real life project, as per our requirements.
The working of this project is like, we will use:
- DHT 11 sensor for measuring the Temperature and Humidity.
- The BMP180 sensor for measuring the Atmospheric Pressure.
- The MQ2 sensor for measuring the Air Quality Index of the environment.
- LDR will measure the sunlight intensity.
- We will use a 20x4 LCD Screen for displaying the data gathered from the sensors.
- And the main thing, we will use an Arduino UNO microcontroller as the brain of the project.
We will set extreme conditions(minimum and maximum threshold values) for all parameters. Buzzer will make an alert when sensor values cross extreme conditions. You can set the extreme condition values in the code according to your needs in the project.
We will make a simulation on Proteus 7 Professional Software for this project.
We have also explained the completed process flow of this project in the form of a Block Diagram also. You can get it from below.
Here is the list of all the components which we will use in our project:
- Arduino UNO
Arduino UNO is an Open Source development board produced by ARDUINO. Atmega 328p, an 8-bit microcontroller based on AVR which acts as the brain of this development board. The Arduino Uno contains a set of analog and digital pins that are input and output pins which are used to connect the board to other components like Sensors, Actuators, communication Modules, other development boards, etc.
- BMP180 Sensor
BMP 180 is used to measure Barometric Pressure or Atmospheric Pressure. BMP180 is a member of the sensors of the BMP XXX series. They are all designed to measure Barometric Pressure or Atmospheric pressure. BMP180 has good accuracy and high precision. Barometric Pressure or Atmospheric pressure is the weight exerted by the air on everything. BMP180 senses the pressure and converts it in a digital form.
Since, pressure varies with the effect of temperature. BMP180 has an inbuilt temperature sensor also by which we get a compensated value of pressure with the effect of temperature.
- DHT 11 Sensor
DHT11 is a digital sensor which senses the temperature and humidity of the environment. It has a thermistor inside which measures temperature and a capacitive humidity sensor which measures the humidity of the environment. This sensor is compatible with any microcontroller and ideal to use with Arduino, Raspberry Pi etc… to measure humidity and temperature instantaneously.
It had three pins, Vcc, Gnd and Data. We can get the module of this sensor also for easy use and get rid of making the circuit for this sensor.
- LDR Sensor
An LDR or light dependent resistor is also known as a photoresistor, photocell, or photoconductor. The basic principle of its working is, it changes its resistance according to the intensity of light that falls on it.
When the light falls on the resistor, then the resistance changes. These resistors are often used in many circuits where it is required to sense the presence of light. These photoresistors have a variety of functions and resistance. A typical light dependent resistor has a resistance in the darkness of 1MOhm, and in the brightness a resistance of a couple of KOhm. It is commonly used in smart street lights which turn on/off automatically and set the brightness according to the need.
- MQ2 Gas Sensor
MQ2 gas sensor is an electronic sensor used for sensing the concentration of gases in the air such as LPG, propane, methane, hydrogen, alcohol, smoke and carbon monoxide. The basic principle of its working is, it has a material which changes its resistance according to the amount of these harmful gases present in the environment. We can calculate the Air Quality Index with this sensor which is used to define the purity of air.
- 20x4 LCD Display
We will use a 20x4 LCD screen for displaying the data.
We will use a PCF8574 remote 8-bit I/O expander for the I2C bus. It will make the display I2C compatible. We can control the LCD by only 2 pins with the help of this by I2C protocol. It will reduce the number of pins used so we can connect more external peripherals.
- PCF8574 remote 8-bit I/O expander for the I2C bus
The PCF8574 is an I2C bus to 8-bit parallel bus IO expander IC. It provides GPIO expansion for many microcontrollers. It is simple to use, cost effective and the easiest way to fulfill the deficiency of GPIO pins on a microcontroller. The interface for this IC is I2C (or I2C) using SDA (Data) and SCL (Clock) lines.
A buzzer is a small yet efficient component to add sound features to our project/system. It is a very small and compact 2-pin structure hence can be easily compatible with breadboard, Perf Board and even on PCBs which makes this a widely used component in most electronic applications.
The breadboard is a white rectangular board with small embedded holes to insert electronic components. It is available in many sizes according to the complexity of the circuit. It is commonly used in electronics projects. We can also say that breadboard is a prototype that acts as a construction base of electronics. We can get rid of soldering the components in a prototype with the use of breadboard.
- Jumper wires (Male to Male, Male to Female, Female to Male)
Since we are designing a prototype of this project, we will use jumper wires instead of soldering.
It will be better if you have all three kinds of jumper wires. Male to Male, Male to Female and Female to Female.
- Power Supply
You can use a Battery, Adapter or any DC source of 5-8v(recommendable).
Since we are making a prototype of this project, we will make connections on the breadboard and avoid soldering the components. We will use male to male, male to female and female to female jumper wires.
These are the pin connections of all components.
- LDR Sensor
LDR-Resistor Junction - A2 (Arduino)
- MQ2 Gas Sensor
Out - A1 (Arduino)
- DHT 11 Sensor
Data - 2 (Arduino)
- BMP 180 Pressure Sensor
SCL - SCL (Arduino)
- LCD Screen
SDA - SDA (Arduino)
SCL - SCL(Arduino)
You can get the fully explained code for the link below. Click to download.
Here is the link…
Paste code link here.
Please must Install the Libraries for proper working of the code:
We have added comments in code for better understanding so it can be understood easily.
Note - Change the Address of the LCD Screen while you run the code in Proteus, change it to 0x20 instead of 0x27 or anyone else. In the real experiment we can alter the address of the LCD by changing the configurations of A0, A1 and A2 pins of the PCF8574 module.
We can make eight different addresses by making different configurations of A1, A2 and A3 pins by making them either HIGH or LOW.
The configurations are:
Here 0 means HIGH, 1 means LOW.
We will show you a demo of this project as a simulation,
We are using Proteus 7 Professional Software for the simulation.
Pre Requirements - Must install the Proteus Libraries of the required components from the given links below.
Proteus 7 Professional Software Download from here - How to Install and Download Proteus Software - The Engineering Projects
Gas Sensor Library for Proteus - Downloads - The Engineering Projects
LCD Library for Proteus - Downloads - The Engineering Projects
- For Gas sensor, we can control the harmful gas levels by varying the potentiometer values.
- Similarly for all sensors we can vary the parameter value by clicking on + or -.
Steps for Simulation-
These are the steps for simulation. Follow them to create a fully working simulation.
- Download the Zip Files which are given above.
- Extract them in the LIBRARY folder where you extracted the Proteus Software zip file during software installation.
- Go to Arduino IDE and open the code, go to Tools and select the board Arduino UNO.
- Go to Sketch and Click on Export Compiled Binary. It will create a compiled .hex file of the code which will be used as a main program in the simulation ahead.
- Open the Proteus Software and make a new project with anime of your choice.
- Click here to add components.
- Add components by searching like Arduino, DHL11, BMP180, 20x4 LCD, etc.
You can see the components listed here.
- Drop the components in the workspace and make connections according to the simulation circuit diagram.
- Paste the Program File here for the Gas Sensor.
Paste the .TEP file of the Gas Sensor which is provided in the downloaded zip file of the Proteus Library for Gas Sensor.
Paste the Compiled Binary File as a Program file of Arduino UNO.
Run the simulation and you can see the readings by opening the virtual terminal.
Observations and Results
In this simulation and project, you can see the data generated by the sensors in the terminal after pressing the run button.
We are getting a well organised and easily understood data on the terminal by every sensor according to code.
According to code, when the value of any sensor gets less than a threshold value, the Buzzer gets on.
You can test the sensors by adjusting the values by pressing + and - buttons.
That is the end of the project. We hope you liked it. Thanks for reading this article.
Contact - Tushar Gupta
Email - firstname.lastname@example.org
For any kind of queries and doubts.