User Tools

Site Tools


amc2022:grouph:dht22_humidity_temperature_sensor

This is an old revision of the document!


Table of Contents

DHT22

The DHT22 sensor is composed of two parts, the temperature and the humidity as shown in Figure #. The connection to the MCU is done using the Digital pins, because the sensor’s circuit converts analog signals to digital, and with the integration of the DHT.h library, found here1) it allows the microcontroller to read the signal, giving the user the values for Temperature and Humidity directly without any extra calculations or interpretations.

Datahttp://example.com|External Link

Figure # DHT22 Humidity sensing component. Source: https://howtomechatronics.com

Temperature

A thermistor is a semiconductor device that changes its resistance when the ambient temperature changes. The term is a conjunction of thermal and resistor, and while most resistors are subject to slight changes due to temperature variations, these devices are purposely engineered so that they are very susceptible to minimal temperature fluctuations. There are 1 type of thermistors, Negative Temperature Coefficient (NTC) and Positive Temperature Coefficient (PTC). The type used by the DHT22 sensor is Negative Temperature Coefficient. The change in resistance is non linear but as a curve, as represented in the example of Figure #. The design and performance of the thermistor is selected by the manufacturer, but for all NTC thermistors as the temperature increases, the resistance decreases. Therefore the coefficient B which defines the behavior of the Thermistor is represented by a curve in which we can see the material resistive change over temperature and can be calculated using the following equation2):

$$ Beta_{T1\over T2} = {T2 \cdot T1\over T2-T1} \cdot ln {R1 \over R2 }$$

B = Material resistive value between two predetermined temperatures T1 = Base point temperature, usually 25oC but calculate in Kelvin, therefore 25o C + 273.15 = 298.15K T2 = Second temperature point, for example 100o C, and in Kelvin 100o C + 273.15 = 373.15K R1 = Thermistors resistance at temperature T1 in Ohms R1 = Thermistors resistance at temperature T2 in Ohms

Source : https://www.thomasnet.com/articles/automation-electronics/what-is-a-thermistor-and-how-does-it-work/

Humidity

Specifications

Table 2 Table describing DHT-22 Specifications
Description Value
Operating Voltage 3.5 to 5.5V
Data Protocol Serial Transmission
Operating Temperature -40 to 80 C
Temperature Accuracy Β±0.5Β°C
Humidity Range 0 to 100 %
Humidity Accuracy Β±1%
Sampling Rate 0.5 Hz - Once every 2 sec
Humidity Accuracy Β±1%
Output Signal Digital Signal via 1 wire bus

Schematics

Data

Example of how data transmission and the binary system provides information on both Temperature and Humidity.

ESP-32 receives 40 bits from the sensor as follows:

16 bits for RHumidity 0000 0010 1000 1100
+
16 bits for Temperature 0000 0001 0101 1111
=
8 bits Check-sum 1110 11103)

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

The conversion from the humidity data is:

Binary system > Decimal System
0000 0010 1000 1100 > 652

\[RH = \frac{\mathrm{652}}{\mathrm{10}} = \mathrm{65.2\;\%}\] The conversion from the Temperatures data is:

Binary system > Decimal System
0000 0001 0101 1111 > 351

  1. \[T = \frac{\mathrm{351}}{\mathrm{10}} = \mathrm{35.1Β°C}\]

If the highest bit of temperature is 1 as in: _1_000 0000 0110 0101, this means that the temperature is negative, therefore T = -10.1 Β°C4).

amc2022/grouph/dht22_humidity_temperature_sensor.1661461229.txt.gz Β· Last modified: 2022/08/25 23:00 by gustavo001