0% found this document useful (0 votes)
274 views

DHT11 Temperature and Humidity Sensor Example

The document describes how to connect a DHT11 temperature and humidity sensor to an Arduino board. The DHT11 sensor measures both temperature and humidity using a resistive humidity sensor and NTC temperature sensor connected to an 8-bit microcontroller. It outputs a digital signal with the temperature and humidity readings. The example shows how to connect the DHT11 sensor to an Arduino with a pull-up resistor, use the DHT11 library to read the sensor values, and display the live temperature and humidity readings on the serial monitor.

Uploaded by

fetene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
274 views

DHT11 Temperature and Humidity Sensor Example

The document describes how to connect a DHT11 temperature and humidity sensor to an Arduino board. The DHT11 sensor measures both temperature and humidity using a resistive humidity sensor and NTC temperature sensor connected to an 8-bit microcontroller. It outputs a digital signal with the temperature and humidity readings. The example shows how to connect the DHT11 sensor to an Arduino with a pull-up resistor, use the DHT11 library to read the sensor values, and display the live temperature and humidity readings on the serial monitor.

Uploaded by

fetene
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

DHT11 Temperature and Humidity Sensor

example
 Sensor ProjectsTemperature Projects

arduino and MAX44009

In this example we will show a basic example of connecting a DHT11 Temperature and
Humidity Sensor to your Arduino. This is a very nice little, low cost sensor which requires only a
pull up resistor to VDD. This can easily be constructed on a mini bread board and then joined up
to your Arduino. using some connecting cables

The DHT11 digital temperature and humidity sensor is a composite Sensor contains a calibrated
digital signal output of the temperature and humidity. Application of a dedicated digital modules
collection technology and the temperature and humidity sensing technology, to ensure that the
product has high reliability and excellent long-term stability. The sensor includes a resistive
sense of wet components and an NTC temperature measurement devices, and connected with a
high performance 8-bit microcontroller

The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor. There is
a chip inside that does some a/d conversion and outputs a digital signal with the temperature and
humidity.

Schematic
Arduino and DHT11 scematic

Connections

Here is the breadboard layout


Arduino and DHT11 breadboard

Code

You will need the DHT11 library from the DHT library.

Download, extract and copy this to your Arduino libraries folder location. This is a simple
example which outputs the humidity and temperature, place your fingers on the DHT11 and you
will see the readings go up and then remove them and the readings will gradually decrease

Source code
#include <dht11.h>

dht11 DHT;
//Pin 4 of Arduino to Data of DHT11
#define DHT11_PIN 4

void setup()
{
Serial.begin(9600);
int check;
Serial.print(“DHT11 STATUS – \t”);
check = DHT.read(DHT11_PIN);
//check status
switch (check)
{
case DHTLIB_OK:
Serial.print(“OK\n”);
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print(“Checksum error\n”);
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print(“Timeout error\n”);
break;
default:
Serial.print(“Unknown error\n”);
break;
}
}

void loop()
{

//humidity and temperature output


Serial.print(“Humidity is “);
Serial.print(DHT.humidity,1);
Serial.print(“\n”);
Serial.println(“Temperature is “);
Serial.println(DHT.temperature,1);

delay(1000);
}

Output

Upload the sketch above and open the Serial Monitor window

dht11 serial outtput results

Parts List

Label Part Type


DHT1 DHT11 Humitidy and Temperature Sensor
Part1 Arduino Uno (Rev3)
R1 4.7k Ω

Links

DHT11 Humidity and Temperature Sensor from Amazon UK

DHT11 Humidity and Temperature Sensor from Amazon US

DHT11 Datasheet in PDF format

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy