📚 Course contents

Projects Hub, build 3 of 81

Mini Weather Station with Arduino, DHT11 and 16x2 LCD

intermediate2 min read

Mini Weather Station with Arduino, DHT11 and 16x2 LCD

Lets put together two of our modules, i.e. the DHT11 and the LCD16x2. What happens when we get both the modules together? We get a mini-weather station. To know more about the project modules in detail you could refer to DHT 11 and LCD16x2 articles.

How does the Mini-Weather station Work?

How does the Mini-Weather station Work? – Mini Weather Station with Arduino, DHT11 and 16x2 LCD

The Mini-Weather station is a simple project that provides the humidity and the temperature of the given environment it is placed in. So why wait? This project is completely portable.

The Humidity Sensor or the DHT11 Sensor senses the Humidity and the temperature with the help of its capacitive properties. These sensed analog values are provided through the data pin on the Sensor. This pin is then connected to the Arduino Analog Pin (A0 in out case). These values are then processed and displayed on the LCD16x2 Display.

How does the DHT11 work with Arduino?

The DHT11 converts the resistance measurement to relative humidity on an chip mounted to the back of the unit and transmits the humidity and temperature readings directly to the Arduino Uno from an Analog Pin.

Things Needed

Things Needed – Mini Weather Station with Arduino, DHT11 and 16x2 LCD

  • DHT11 Sensor (Humidity Sensor)
  • LCD 16x2
  • I2C Module
  • Arduino Uno
  • Jumper Cables
  • Breadboard
  • Arduino IDE on your computer / smartphone.
  • Power Supply or 9V battery

DHT Module Pin Diagram

DHT Module Pin Diagram – Mini Weather Station with Arduino, DHT11 and 16x2 LCD

  • Vcc pin supplies power for the sensor. Connected to 5V on the Arduino.
  • Data pin is used to communicate between the Arduino and the sensor
  • NC is Not Connected
  • GND is the ground pin. Common grounded with the arduino.

Circuit Diagram

Circuit Diagram – Mini Weather Station with Arduino, DHT11 and 16x2 LCD

Connect the following circuit as shown in the diagram. Next step would be programming the arduino to read the values from the DHT sensor and displaying the output on the LCD 16x2 display. This will make our system completely portable hence not needing the Serial Monitor on the Arduino IDE.

Loading the circuit…Arduino Uno
Press Run to upload the code to the Arduino.

Code

Since DHT sensors have their own protocol of communication. We will use a library called DHT. And as we use the LCD 16x2 module with I2C Module, we will use the LiquidCrystalI2C Library

Click here to download the library : https://github.com/rolan37/Mini-Weather-Station-with-DHT-and-LCD16x2-using-Arduino.git

Use the code below and see the output displayed on the LCD 16x2 .....

#include <Wire.h> 
#include <LiquidCrystal_I2C.h> //LCD library for i2c
#include <dht.h> //DHT11 library (view my previous tutorials)
#define dht_apin A0 // the A0 pin for the humidity sensor
 
LiquidCrystal_I2C lcd(0x27, 16, 2);
 
dht DHT; 
 
void setup() {
  lcd.init(); // start the LCD ("LiquidCrystal I2C" library by Frank de Brabander)
  lcd.backlight(); //To turn the backlight ON
}
 
void loop() {
  //Start of Program
  DHT.read11(dht_apin); 
  lcd.clear(); //important as we clear the old data from the LCD before loading more data on to it
  lcd.setCursor(0,0);
  lcd.print("Humidity: ");
  lcd.print(DHT.humidity);
  lcd.setCursor(0,1);
  lcd.print("Temp: ");
  lcd.print(DHT.temperature);
  delay(5000); //The sample rate at which we will take the readings
 
}

You are done with the Mini-Weather station. To get a full guide of the project watch the tutorial below.

Enjoy the project. Love learning through videos? watch the below video and follow the steps. This video contains the code explanation too for the Project. Happy Learning!