Simple Arduino Weather Station Using DHT11 Sensor & Arduino Uno

January 29, 2022



Description

Hello, guys welcome back to "Techno-E-Solution", In this tutorial, we will see "How to make Simple Arduino Weather Station Using DHT11 sensor". So basically we will interface the DHT11 temperature & Humidity sensor with Arduino Uno & shows the output means temperature & humidity level on the 16x2 I2C LCD display. It's beginners friendly project. So without wasting any time let's make it.

Watch out the following tutorial video, If reading bores you.

Material Required

[Following links are affiliated links, If you buy from them, We get some bonus from it.]

Sr.No

Product Name

Quantity

Best Buy Link

1

Arduino Uno

1

https://amzn.to/3Fb2K58

2

DHT11 Sensor

1

https://amzn.to/3t54Y3K

3

I2C LCD Display

1

https://amzn.to/3HPZQol

4

Jumper Wire

10-15 Nos

https://amzn.to/34lihCH

5

Breadboard

1

https://amzn.to/3F18m1S


In this project we used the above components listed in the table, I have provided the best buy link with it so, you can easily find out the components.

Circuit Diagram

Refer to the above circuit diagram to make the connection.

DHT11 Temperature & Humidity Sensor

In this project, we have used the DHT11 temperature & humidity sensor to measure the surrounding temperature & humidity. This sensor is a very low-cost sensor. The technic inside the sensor is a Capacitive humidity sensor & Thermistor are used to measure the surrounding air condition & send digital signals at the signal pin of the sensor.

Note:- Before uploading the code to the Arduino first add the LiquidCrystal I2C Library in your Arduino IDE. Otherwise, you will get an error while uploading Code. Refer following tutorial video to see "How to add Liquidcrystal I2C Library in your Arduino IDE"



Arduino Code

/*
*Project Name:- Simple Arduino Weather Station
*Arduino Code By Techno-E-Solution
*Subscribe Here:- https://www.youtube.com/c/TechnoESolution
*Website:- https://technoesolution.blogspot.com/
*/
#include <LiquidCrystal_I2C.h> // Include this library ( https://youtu.be/u2c5-TMQWuM )
LiquidCrystal_I2C lcd(0x27,16,2);
byte degree_symbol[8] =
{
0b00111,
0b00101,
0b00111,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
int gate=8;
volatile unsigned long duration=0;
unsigned char i[5];
unsigned int j[40];
unsigned char value=0;
unsigned answer=0;
int z=0;
int b=1;
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("[ ARDUINO ]");
lcd.setCursor(0,1);
lcd.print("WEATHER STATION");
delay(3000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" BY ");
lcd.setCursor(0,1);
lcd.print(" TechnoEsolution");
delay(5000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("TEMP = ");
lcd.setCursor(0,1);
lcd.print("HUMIDITY = ");
lcd.createChar(1, degree_symbol);
lcd.setCursor(10,0);
lcd.write(1);
lcd.print("C");
lcd.setCursor(14,1);
lcd.print("%");
}


void loop()
{

delay(1000);
while(1)
{
delay(1000);
pinMode(gate,OUTPUT);
digitalWrite(gate,LOW);
delay(20);
digitalWrite(gate,HIGH);
pinMode(gate,INPUT_PULLUP);//by default it will become high due to internal pull up
// delayMicroseconds(40);

duration=pulseIn(gate, LOW);
if(duration <= 84 && duration >= 72)
{
while(1)
{
duration=pulseIn(gate, HIGH);

if(duration <= 26 && duration >= 20){
value=0;}

else if(duration <= 74 && duration >= 65){
value=1;}

else if(z==40){
break;}

i[z/8]|=value<<(7- (z%8));
j[z]=value;
z++;
}
}
answer=i[0]+i[1]+i[2]+i[3];

if(answer==i[4] && answer!=0)
{
lcd.setCursor(7,0);
lcd.print(i[2]);
lcd.setCursor(11,1);
lcd.print(i[0]);
}

z=0;
i[0]=i[1]=i[2]=i[3]=i[4]=0;
}
}

Buy me a coffee If you got this article helpful.