User Tools

Site Tools


amc2022:grouph:dht22_humidity_temperature_sensor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
amc2022:grouph:dht22_humidity_temperature_sensor [2022/08/24 19:00] gustavo001amc2022:grouph:dht22_humidity_temperature_sensor [2022/08/30 18:16] gustavo001
Line 1: Line 1:
-dhtww +=====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 here((https://github.com/adafruit/DHT-sensor-library)) it  allows the microcontroller to read the signal, giving the user the values for Temperature and Humidity directly without any extra calculations or interpretations.         
 + 
 + 
 + 
 + 
 + 
 +{{ :amc2022:grouph:dht22_sensor_inside.png?nolink&400 |}} 
 +|**//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 equation((https://www.electronics-tutorials.ws/io/thermistors.html)):  
 + 
 +$$ 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\\ 
 + 
 + 
 + 
 + 
 +{{ :amc2022:grouph:ntc_themistor2.png?nolink&400 |}} 
 +|**//Figure #//** Graph showing the Relationship between resistance and temperature. Source : https://www.thomasnet.com/articles/automation-electronics/what-is-a-thermistor-and-how-does-it-work/
 + 
 + 
 +===Humidity=== 
 + 
 + 
 +{{ :amc2022:grouph:dht22_humidity_sensor.png?nolink&400 |}} 
 +|**//Figure #//** DHT22 sensing components. Source: https://create.arduino.cc/projecthub/MinukaThesathYapa/dht11-dht22-sensors-temperature-using-arduino-b7a8d6//
 + 
 + 
 + 
 + 
 + 
 + 
 + 
 +==== 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| 
 + 
 +|**//Table 2//** Source: https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf| 
 + 
 + 
 +==== Schematics==== 
 + 
 +{{ :amc2022:grouph:dht22_schematics.png?nolink&300 |}} 
 +|**//Figure #//** DHT22 Schematics. Source: https://components101.com/sensors/dht22-pinout-specs-datasheet//
 + 
 + 
 + 
 +====Signal ==== 
 + 
 +To read the data obtained by the module a protocol has to be observed. This protocol will function as an activation key that initiative the module, to send the information back to MCU and finalize the process.  
 + 
 +  - The micro controller sends a start signal for 500 microseconds  
 +  - The micro controller sends a HIGH logic 1 Signal 
 +  - DHT22 responds by pulling the bus low for 80 microseconds  
 +  - DHT22 pulls the bus HIGH for 80 microseconds. 
 +  - DHT22 pulls the bus LOW again. 
 + 
 + 
 +Once the right sequence of the signal has been completed then DHT22 will start sending the information regarding both Temperature and Humidity. 
 +Transmission of information is done through two set-ups called Logics. 
 + 
 +  - Logic 1 is a 48 to 55 microsecond LOW  pulse followed by a 68 to 75 microsecond HIGH pulse. 
 +  - Logic 0 is a 48 to 55 microsecond LOW pulse followed by a 22 to 30 microsecond HIGH pulse. ((https://www.teachmemicro.com/how-dht22-sensor-works/)) 
 + 
 + 
 +{{ :amc2022:grouph:logic_1_0_dht22.png?nolink&200 |}} 
 +|**//Figure #//** DHT22 Logic Signal formation. Source: https://www.teachmemicro.com/how-dht22-sensor-works///
 +====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 1110((https://cdn-shop.adafruit.com/datasheets/Digital+humidity+and+temperature+sensor+AM2302.pdf))|\\ 
 + 
 +—------------------------------------------------------------------------------------------------------------------------------------ 
 + 
 + The conversion from the humidity data is:\\ 
 +^Binary system ^          >  ^ Decimal System^\\ 
 +|0000 0010 1000 1100    | **>**| 652|\\ 
 + 
 + 
 +<html> 
 + </ol> 
 +  </li> 
 +   \[RH = \frac{\mathrm{652}}{\mathrm{10}} = \mathrm{65.2\;\%}\]           
 +  </li>          
 + </ol> 
 +</html> 
 +The conversion from the Temperatures data is:\\ 
 +^Binary system ^          >   ^Decimal System^\\ 
 +|0000 0001 0101 1111  |  >  | 351|\\ 
 + 
 + 
 +<html> 
 + <ol> 
 +  <li> 
 +        \[T = \frac{\mathrm{351}}{\mathrm{10}} = \mathrm{35.1°C}\]                
 +  </li> 
 + </ol> 
 +</html> 
 + 
 +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 °C((https://www.researchgate.net/publication/312403569_How_to_Use_the_DHT22_Sensor_for_Measuring_Temperature_and_Humidity_with_the_Arduino_Board)). 
 + 
 +In Figure # down below, we can see the whole siganling process between ESP32 and DHT22. 
 +{{ :amc2022:grouph:data_transmission_dht22.png?nolink&400 |}} 
 +|**//Figure #//** DHT22 bus transmission. Source: https://www.teachmemicro.com/how-dht22-sensor-works///
 +====Code==== 
 + 
 +====Results====
  
  
amc2022/grouph/dht22_humidity_temperature_sensor.txt · Last modified: 2022/09/09 17:22 by gustavo001