Temperature and Humidity sensor with LCD Displayimage/svg+xmlsteemCreated with Sketch.

in blog •  25 days ago 

 In this tutorial, we will learn how to use the DHT11 sensor for measuring temperature and humidity and either heat Index. And we will see the value output of the DHT sensors on both the serial monitor and the LCD screen. we are going to use the LCD screen components with this tutorial you can also print on a serial monitor on the Desktop IDE. The code and circuit diagram are compatible with both sensors. 

 RequirementsWe need these couples of components in this tutorial,

  • DHT11 Sensor Module
  • I2C LCD Display 2x16
  • Arduino board
  • Breadboard
  • Jumper wires
  • Type b USB cable

Were going to use the I2C LCD to display the Temperature and Humidity that the DHT11 has captured, I used an Arduino UNO 5V pin to support the DHT11 and the I2C display. DHT22 humidity sensor can be used in place of DHT11 for more accuracy and higher resolution. I made a Circuit diagram on fritzing for you to easily follow the wirings. 

 LCD Connection to arduino

  • VCC - 5V
  • GND - GND
  • SCL - A4
  • SDA - A5

 DHT11 connection to arduino

  • VCC - 3.3V
  • GND - GND
  • DAT - PIN 2 PWM

SOFTWARE and LIBRARIES

PROGRAMMINGwhen making a code we need to include all the libraries that we have recently downloaded. #include <DHT.h> for DHT sensor library and #include <LiquidCrystal_I2C.h> for the i2c 2x16 LCD DISPLAY.
#define DHTPIN 2 Define DHT pin this the pin where the sensor pin of the DHT is connected to the digital pin 2 on the arduino board.
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); Input the i2c address that we recently make.
DHT dht; define the uppercase DHT to dht in lowercase to recognized that the lower case is the same as upper case on the same state.
setup() method is ran once at the just after the Arduino is powered up and the loop() method is ran continuously afterwards.
setup() is where you want to do any initialisation steps, and in loop() you want to run the code you want to run over and over again.
lcd.begin(16,2); initializes the LCD 2X16 and specifies the dimensions
lcd.print the iput text word that appears on the serial monitor or lcd display.
delay(2000); 1000 is equals to 1 second timeframe.

COPY SOURCE CODE HERE 

 

#include <DHT.h>

#include <LiquidCrystal_I2C.h>

#define DHTPin 2                        //define DHT pin

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

DHT dht;

void setup() {

 dht.setup(DHTPin);  

 lcd.begin(16,2);                      //initializes the LCD and specifies the dimensions

}

void loop() {

 float temp = dht.getTemperature();

 float humi = dht.getHumidity();

 lcd.setCursor(0,0);

 lcd.print("Temp: ");

 lcd.print(temp);

 lcd.print(" C");

 lcd.setCursor(0,1);

 lcd.print("Humi: ");

 lcd.print(humi);

 lcd.print(" %");

 delay(2000);

}


 The end result is as shown in the picture. 


 I hope you enjoy this actitvity, if you want to see my upcoming arduino DIY`s activity, you can follow me @pakganern. thank you..... 


Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Hello pakganern, welcome to Partiko, an amazing community for crypto lovers! Here, you will find cool people to connect with, and interesting articles to read!

You can also earn Partiko Points by engaging with people and bringing new people in. And you can convert them into crypto! How cool is that!

Hopefully you will have a lot of fun using Partiko! And never hesitate to reach out to me when you have questions!

Cheers,
crypto.talk
Creator of Partiko