Weather Station Using Arduino & DHT11
Introduction:
Weather monitoring is an important task in many industries and applications. In this project, we are going to build a weather monitoring station using Arduino Nano, DHT11 sensor, 16x2 LCD display, and I2C module. The DHT11 sensor will be used to measure temperature and humidity, and the results will be displayed on the 16x2 LCD display with the help of the I2C module.
Hardware Required:
Arduino Nano
DHT11 Sensor
16x2 LCD Display
I2C Module
Breadboard
Jumper Wires
Programming:
The code for the weather monitoring station is written in Arduino IDE. We will start by including the necessary libraries for DHT11 sensor and LCD display. The code will read the temperature and humidity values from the DHT11 sensor and display them on the LCD display with the help of the I2C module.
Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <dht11.h>
dht11 DHT11;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Temp: ");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
}
void loop() {
int chk = DHT11.read(7);
lcd.setCursor(6,0);
lcd.print(DHT11.temperature);
lcd.setCursor(9,0);
lcd.print("C");
lcd.setCursor(9,1);
lcd.print("%");
lcd.setCursor(10,1);
lcd.print(DHT11.humidity);
delay(2000);
}
Explanation:
The code starts by including the necessary libraries for the DHT11 sensor, LCD display, and I2C module. Then, we initialize the DHT11 sensor and LCD display in the setup function. The setup function sets the cursor position on the LCD display and prints the labels for temperature and humidity.
In the loop function, we read the temperature and humidity values from the DHT11 sensor and print them on the LCD display. The delay function is used to pause the execution of the code for 2 seconds between each reading.
Conclusion:
In this project, we have successfully built a weather monitoring station using Arduino Nano, DHT11 sensor, 16x2 LCD display, and I2C module. The DHT11 sensor measures temperature and humidity, and the results are displayed on the LCD display with the help of the I2C module. The project can be further improved by adding more sensors and functionalities to it.
Comments
Post a Comment