User Tools

Site Tools


mmbasic:dewpoint_and_heat_index_from_dht22_temperature_and_humidity_sensor

Dewpoint and Heat Index from DHT22 temperature and Humidity sensor

The DHT22 is a popular sensor that gives both Temperature and Humidity. The following is a useful routine to calculate the Dewpoint from both these readings.

Credit: TBS user palcal, the original thread can be seen here: http://www.thebackshed.com/forum/forum_posts.asp?TID=9794&PN=1

HUMIDITY:
     HUMID 48,temp2,RH
     Return

DEW:
     B = (Log(RH/100)+((17.27*Temp2)/(237.3+Temp2)))/17.27
     D = (237.3*B)/(1-B)
     D = Cint(D)
     DewPoint$=Str$(D)
     Return

Related to the above, the amount of water in the air dictates how much water can be evaporated from a body in order to cool down. This might be experienced as the difference between 40C+ in an arid environment versus 30C in a moist tropical one. The former is more tolerable because “wetter” air compromises the evaporation of sweat making the environment feel “oppressive” whereas the desert may feel more comfortable because the air is “dryer” and sweat more readily evaporates using energy (in the form of heat) from the body as the water turns from liquid to vapor. Generally, air movement increases this effect because sodden and warmed air is constantly moved away from the point of evaporation (which is why fans cool a body but not the air). This becomes a problem if the environment is significantly cooler - sweating in polar regions is a major problem as heat will be lost to the environment - now to the detriment of the body.

In weather forecasts, temperatures are often given as an absolute value with a “feels like” temperature, or “Heat Index”.

HEATINDEX:
     'heat index equation using ambient dry bulb temperature and relative humidity
     T=Temp
     T = (T*9/5)+32
     c1 = -42.379
     c2 = 2.04901523
     c3 = 10.14333127
     c4 = -0.22475541
     c5 = -6.83783 * 10^-3
     c6 = -5.481717 * 10^-2
     c7 = 1.22874 * 10^-3
     c8 = 8.5282 * 10^-4
     c9 = -1.99 * 10^-6
     HI1 = c1+(c2*T)+(c3*RH)+(c4*T*RH)+(c5*T^2)
     HI2 = (c6*RH^2)+(C7*T^2*RH)+(C8*T*RH^2)+(C9*T^2*RH^2)
     Index = HI1 + HI2
     Index = (Index-32)*5/9
     Index = Cint(Index)
     FeelsLike$=Str$(Index)
mmbasic/dewpoint_and_heat_index_from_dht22_temperature_and_humidity_sensor.txt · Last modified: 2024/02/24 17:32 by gerry