1

member

Easy Basics Project 006b DHT 11 21 22 module, LCD1602 I2C module

of Acoptex.com in UNO

Basics: Project 006a

Project name: DHT11 21 22 Humidity and temperature module, LCD1602 I2C module

Tags: Arduino, Arduino UnO, DHT11 21 22, Humidity and temperature module, LCD1602 I2C module, LCD1602, LCD1602 I2C

Attachments: librarieslibrary2 and sketch

In this project, you needed these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.DHT11 or DHT21 or DHT22

3.Arduino IDE ( you can download it from here  )

4.Jumper cables

5. Resistor 1 pc 10 K Om (if 4 pin sensor used - see picture of Arduino and sensor 4 pin connections)

6.LCD 1602  I2C module

7. Breadboard

Understanding DHT humidity and temperature sensor

We will use DHT11 module for this project. See more info about DHT here. Datasheet can be found here.

Understanding LCD 1602 I2C module

More information you can find here.

Signals and contacts of LCD 1602

As you can see on the back of LCD 1602 module there 4 connections: GND (-), VCC (+5V), Serial Data Line (SDA) and Serial Clock Line (SCL).

Signals and connections of DHT11 module

There are 3 : VCC (+5V), Data, GND (-)

Wiring

The following picture shows the needed connections with the Arduino Uno - 3 pin DHT11 sensor module.

The following picture shows the needed connections with the Arduino Uno - 4 pin DHT11 sensor (resistor 10 K Om required).

Step by Step instruction

  1. Plug your Adruino Uno board into your PC and select the correct board and com port
  2. Open up serial monitor and set your baud to 9600 baud
  3. Modify sketch(program) for your sensor (DHT11 or DHT21 or DHT 22)
  4. Find your I2C address. Each device has an I2C address that it uses to  accept commands or send messages. Load the sketch over at http://playground.arduino.cc/Main/I2cScanner and follow the instructions to use it.  By opening up the Serial monitor window after you upload the sketch, Arduino will scan the address range looking for a reply.  Even though the documentation said it was 0x27, this scanner can detect different (in my case 0x3F
  5. Modify the sketch in attachments above (you can use the sketch below too): the line LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE) (See part marked bold)
  6. Verify and upload the the sketch to your Adruino Uno.
  7. If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h

 

Libraries:

  • See attachments on the begining of this project description.
  • Adafruit_Sensor library included.Download, unzip  and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC. 
  • DHT-sensor library included. You will need to unzip and add the DHT-sensor-library-master library to libraries in your PC, for example C:\Users\toshiba\Documents\Arduino\libraries OR
  • You can install it in Arduino IDE too: select Sketch-> Include library->Manage your libraries->type DHT in Filter your search line and you will see DHT sensor library by Adafruit->More info->select version->install
  • If it will be problem with compilation - remove 2 files from the library - DHT_U.cpp and DHT_U.h.
  • I have used the library - NewliquidCrystal_1.3.4.zip which I downloaded, unzipped, changed the name of folder to LiquidCristal and added to libraries in my PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.
  • If you have LiquidCristal folder in this location already - delete this folder and copy folder, which was made by you, to this location.
  • Wire library included in Arduino IDE which is installed in your PC.

Sketch

  • See attachments on the begining of this project description.


Other projects of Acoptex.com
Easy Merry Xmas to everyone of Acoptex.com, Not selected 24-12-2019

Published at 06-05-2017
Viewed: 1870 times