Friday, September 22, 2023
Google search engine
HometelecomARDUINO – DHT11



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.

In this tutorial, 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.


2.1. Hardware Introduction

2.1.1. 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.


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

2.1.2 DHT11

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.

●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.


2.1.3.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.

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.

2.2. How to connect

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(” %”);   





Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments