Arduino & DTH11(Humidity and Temperature Sensor)

Currently, with the continuous development of science and technology, all daily activities are automated, robots gradually take over many positions in our daily lives. In order for automation devices to work correctly and efficiently, sensors are one of the important components. Temperature and humidity are two important factors that need to be collected for analysis and control. We are going to use all popular Hardware like DTH11 sensor, LCD display and Arduino Uno to display the Sensor Readings on the LCD display.!!

I will explain its working, pinout, protocol and interfacing with other microcontrollers in detail. I will also post some tutorial links where I have interfaced DHT11 with other microcontrollers. If you have any queries about it, ask in the comments and I will resolve it.


Hardware Introduction

Arduino UNO R3

Arduino Uno is a microcontroller board based on the ATmega328P (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. You can tinker with your Uno without worrying too much about doing something wrong, worst case scenario you can replace the chip for a few dollars and start over again.

“Uno” means one in Italian and was chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino boards, and the reference model for the Arduino platform; for an extensive list of current, past or outdated boards see the Arduino index of boards.

Picture 1. Arduino UNO R3 pin out


ATMega328P Processor


  • + AVR CPU at up to 16 MHz
  • + 32KB Flash
  • + 2KB SRAM
  • + 1KB EEPROM


  • + Power On Reset (POR)
  • + Brown Out Detection (BOD)


+ 2x 8-bit Timer/Counter with a dedicated period register and compare channels

+ 1x 16-bit Timer/Counter with a dedicated period register, input capture and compare channels

+ 1x USART with fractional baud rate generator and start-of-frame detection

+ 1x controller/peripheral Serial Peripheral Interface (SPI)

+ 1x Dual mode controller/peripheral I2C

+ 1x Analog Comparator (AC) with a scalable reference input

+ Watchdog Timer with separate on-chip oscillator

+ Six PWM channels

+ Interrupt and wake-up on pin change


+ 2.7-5.5 volts

Arduino Analog Pin Description


Description automatically generated
Picture 2. Analog pin description

Arduino Digital Pin Description


Description automatically generated
Picture 3. Digital pin description


DHT11 output calibrated digital signal. It applies exclusive digital-signal-collecting-technique and humidity sensing technology, assuring its reliability and stability. Its sensing elements is connected with 8-bit single-chip computer.

Every sensor of this model is temperature compensated and calibrated in accurate calibration chamber and the calibration-coefficient is saved in type of programmer in OTP memory, when the sensor is detecting, it will cite coefficient from memory.

Small size & low consumption & long transmission distance(100m) enable DHT11 to be suited in all kinds of harsh application occasions. Single-row packaged with four pins, making the connection very convenient.

Graphical user interface, text, application

Description automatically generated with medium confidence
Picture 4. Technical specification.

Operating specifications:

Power and Pins : Power’s voltage should be 3.3-5.5V DC. When power is supplied to the sensor, don’t send any instruction to the sensor within one second to pass unstable status. One capacitor valued 100nF can be added between VDD and GND for wave filtering.

Communication and signal: 1-wire bus is used for communication between MCU and DHT11.

Cảm biến độ ẩm và nhiệt độ DHT11 Temperature Humidity Sensor –
Picture 5. DHT11 sensor.

LCD16x2 – I2C 

The term LCD stands for liquid crystal display. It is one kind of electronic display module used in an extensive range of applications like various circuits & devices like mobile phones, calculators, computers, TV sets, etc. These displays are mainly preferred for multi-segment light-emitting diodes and seven segments. The main benefits of using this module are inexpensive; simply programmable, animations, and there are no limitations for displaying custom characters, special and even animations, etc.

LCD 16X2 – Linh Kiện Thái Nguyên
Picture 6. LCD 16X2

Description automatically generated
Picture 7. Pin description

Features of LCD16x2:

  • + The operating voltage of this LCD is 4.7V-5.3V
  • + It includes two rows where each row can produce 16-characters.
  • + The utilization of current is 1mA with no backlight
  • + Every character can be built with a 5×8 pixel box
  • + The alphanumeric LCDs alphabets & numbers
  • + Is display can work on two modes like 4-bit & 8-bit
  • + These are obtainable in Blue & Green Backlight
  • + It displays a few custom generated characters

I2C Serial Interface Adapter

It is also known as I2C Module. It has total of 20 male pins. 16 pins are faced to rear side and 4 pins faced towards front side. The 16 pins for connect to 16×2 LCD and the 2 pins out of 4 pins are SDA and SCL. SDA is the serial data pin and SCL is the clock pin. The rest 2 pins for power supply (Vcc and ground).There is a POT on the I2C Module. We can control the contrast of the LCD display by rotating this POT. And there is a jumber fixed on the module. When we remove the jumber, the backlight of the LCD display will go OFF.

A picture containing electronics, circuit

Description automatically generated

Picture 8. Module I2C 

I2C Module on 16x2 LCD

Picture 9. Module I2C on LCD 16×2

Wiring Diagram/How to connect

A picture containing text, electronics, circuit

Description automatically generated
Picture 10. Arduino pin out

DHT11 Sensor Temperature and Humidity Sensor for arduino
Picture 11. DHT11 pinout

Description automatically generated
Picture 12. Arduino uno, dht11 and lcd i2c table pin connection

A picture containing text, electronics

Description automatically generated
Picture 13. Schematic Diagram Arduino uno and DHT11


A picture containing text, electronics, circuit, charger

Description automatically generated
Picture 14. Actual connection Arduino Uno and PIR

Source code:

Graphical user interface, application

Description automatically generated
Picture 15. Create new project with visual studio code

Source Code

#include <Arduino.h>
#include <DHT.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
const int DHTPIN = 4;
const int DHTTYPE = DHT11;
byte degree[8] = {
void setup() {
  lcd.print("Temper: ");
  lcd.print("Humidity: ");
  lcd.createChar(1, degree);
void loop() 
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  if (isnan(t) || isnan(h))
    lcd.print(" ");
    lcd.print(" %");    
0 0 votes
Article Rating
Previous articleHow to Interface SD Card with ESP32
Next articleHow to Interface DTH11 Sensor with ESP32 and ESP8266
Notify of
Inline Feedbacks
View all comments