Project tutorial
Temperature Monitor with DHT22 and I2C 16x2 LCD

Temperature Monitor with DHT22 and I2C 16x2 LCD

It might be the simplest room temperature and humidity - no breadboard attached.

  • 1,749 views
  • 0 comments
  • 9 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
10167 01
DHT22 Temperature Sensor
i'm using the three pin ,but it doesn't matter
×1
Adafruit industries ada80 image 75px
9V to Barrel Jack Connector
×1
Cover 450x300
DFRobot I2C 16x2 Arduino LCD Display Module
×1
11026 02
Jumper wires (generic)
actually it depend on how you connect i2c backpack and LCD. In my case. i'm soldering those two item,
×7

Apps and online services

About this project

This is my first arduino project (not counting blink tutorial etc from arduino) so please bear with me..

I'm working on this after my 19MO months get coughs from our vacation, she's become very sensitive to air conditioning temperature and humidity.

The idea is creating very portable temperature and humidity sensing without making me abandon this project and carry on with finish product of temperature and humidity gadget.

In this project, I abandon breadboard because it Arduino still capable to powering sensor and LCD directly (and I don't get strangled by wires)

Hardware Introduction

Arduino Uno R3

The board that i'm using is Arduino Uno R3 because it the only arduino I owned.

Uno R3 have a capabilities to powering 5v module/shield with 3v3 module/shield simultaneously so you can get rid of the breadboard for this project. Right now i'm thinking abut using Arduino Nano, I will update this project and report it.

DHT22 Temperature and Humidity Sensor

Actually there are two alternative for sensor for the first time, the DHT-22 and DHT-11 but I choose the DHT22 because it larger range for humidity and temperature, also better accuracy 0, 5% versus DHT11 1%-2%.

the DHT-22 also comes with two version, one with 4pin and the other with 3 pin. If you found yourself with the 4 pin version, you can leave the third pin from the left unused because it mean to be NC pin (not Connected)

16x2 Liquid Cristal Display with i2c Backpack

The different between i2c version with basic version is you can cut the wiring necessity to only for cable because the other was soldered to the backpack.

many store sell the i2c LCD without you need for soldering manually LCD with the backpack. the tricky parts is you need to find the port used for i2c display.

9V battery clip /holder

I also found two variant for battery holder, actually it doesn't matter which one you choose. just make sure it will fit if you make a box for this temperature monitoring.

Let's Start

Start your configuration with lcd first before using the DHT-22, because this LCD is a bit tricky we need to make sure it running smoothly.

  • connect SCL to A5
  • connect CDA to A4
  • GND to GND
  • VCC to 5v

after you connect the LCD to Arduino you need to find out the address i2c using for this module. in my case the address is 0x27, some reported their address is 0x3f etc but you really test it yourself because it might different between the address i'm currently using with the one you'll be using.

I'm not gonna explain it deeper about this thing, you'll find more detailed tutorial here and don't forget to download the library because in this tutorial we're gonna using the library from that sites.

At my first attempt i've got my LCD glow without the text, If you get yourself in same situation try to rotate the contrast potentiometer first in back of your i2c (using screwdriver) if not working check also the solder between i2c to lcd especially if you solder it your self or bought from china.

Make really sure the LCD works first so it will be easier to troubleshoot the next step.

After it working we can start to the sensor part

  • Connect Data Signal to D2 Arduino
  • Connect VCC to 3v3 Arduino
  • Connect GND to GND

Because the working voltage is 3~5v there is no reason to using higher voltage that will need to use a breadboard.

Next step is to verify, upload the sketch pull the usb, and plug the battery

If you got a problem please discuss it here, like I said before this is my first project, I hope it works for you too..

--

Note for the library: make sure the namefile you declare in sketch same with the namefile in the library.

Code

humtempArduino
/* DHT-22 sensor with 12c 16x2 LCD with Arduino uno
   Temperature and humidity sensor displayed in LCD
   based on: http://www.ardumotive.com/how-to-use-dht-22-sensor-en.html and
   https://www.ardumotive.com/i2clcden.html for the i2c LCD library by Michalis Vasilakis
   Recompile by adhitadhitadhit
   Notes: use LCD i2c Library from link above, i'm not sure why but new Liquidcristal library from Francisco Malpartida  isn't working for me
   other thing, check your */

//Libraries
#include <dht.h> // sensor library using lib from https://www.ardumotive.com/how-to-use-dht-22-sensor-en.html
#include <LiquidCrystal_I2C.h> // LCD library using from  https://www.ardumotive.com/i2clcden.html for the i2c LCD library 
#include <Wire.h> 
dht DHT;

//Constants
#define DHT22_PIN 2     // DHT 22  (AM2302) - pin used for DHT22 
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 after finding it from serial monitor (see comment above) for a 16 chars and 2 line display

//Variables
float hum;  //Stores humidity value
float temp; //Stores temperature value

void setup()
{
    Serial.begin(9600);
    lcd.init();                      // initialize the lcd 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setBacklight(HIGH);
}

void loop()
{
    int chk = DHT.read22(DHT22_PIN);
    //Read data and store it to variables hum and temp
    hum = DHT.humidity;
    temp= DHT.temperature;
    //Print temp and humidity values to LCD
    lcd.setCursor(0,0);
    lcd.print("Humidity: ");
    lcd.print(hum);
    lcd.print("%");
    lcd.setCursor(0,1);
    lcd.print("Temp: "); 
    lcd.print(temp);
    lcd.println("Celcius");
    delay(2000); //Delay 2 sec between temperature/humidity check.
}

Schematics

dht22 i2c Backpack
dht22_with_i2c_lcd_Z98DtdSuMY.fzz
DHT22 LCD
Dht22 i2clcd cicmjf8gcf

Comments

Similar projects you might like

Arduino DTH22 Humidity Temperature With LCD I2C 16x2 Display

Project tutorial by Team GiftedMedia

  • 37,719 views
  • 15 comments
  • 47 respects

DHT11 Humidity + Temperature Sensor with 16x2 LCD display

Project showcase by onatto22

  • 13,816 views
  • 4 comments
  • 31 respects

Ultrasonic Sensor with Alarm, LCD and Temperature

Project tutorial by MichDragstar

  • 7,108 views
  • 7 comments
  • 21 respects

MAX 30102 Heart Rate Monitor on 16x2 LCD

Project tutorial by Mirko Pavleski

  • 2,239 views
  • 3 comments
  • 1 respect

Temperature and Humidity Logger Per Hour

Project tutorial by lefteris1993

  • 1,939 views
  • 0 comments
  • 11 respects
Add projectSign up / Login