Posts Tagged ‘Relative humidity’

This prototype displays temperature, relative humidity, dew point temperature and absolute humidity

As shown in previous posts on the CarnotCycle blog, it is possible to compute dew point temperature and absolute humidity (defined as water vapor density in g/m^3) from ambient temperature and relative humidity. This adds value to the output of RH&T sensors like the DHT22 pictured above, and extends the range of useful parameters that can be displayed or toggled on temperature-humidity gauges employing these sensors.

Meteorological opinion* suggests that dew point temperature is a more dependable parameter than relative humidity for assessing climate comfort especially during summer, while absolute humidity quantifies water vapor in terms of mass per unit volume. In effect this added parameter turns an ordinary temperature-humidity gauge into a gas analyzer.


– – – –


I used an Arduino Uno microprocessor and a wired DHT22 sensor with data output to a 16×2 liquid crystal display. Circuit components are uncomplicated: a 10 kΩ potentiometer, 220 Ω resistor and a few jumper and breadboard wires are all that is needed, power supplied by a 9V battery* after programming via USB.


– – – –


I wired the LCD as per guidance on the Arduino website. The pot controls contrast on the LCD. The DHT22 was wired to take 5V from the breadboard power rail with sensor data routed to digital pin 7. The sensor version that I used (Adafruit AM2302) has a built-in 5.1 kΩ pull-up resistor.

– – – –


Note: the last line – consisting solely of a closing brace } – got chopped off this image.

The DHT22 has a sampling rate of 0.5 Hz which some regard as a weakness, but in the context of a temperature-humidity gauge the criticism is rather academic since it would serve no purpose to output data to the LCD at such a rapid rate. I set the display refresh to 30 seconds. Note the built-in option to display ambient temperature and dew point temperature in Celsius or Fahrenheit.

– – – –


I used the unit to investigate the change in temperature and humidity parameters in a bathroom (enclosed volume 11.6 m^3) before and after operating the shower at a temperature of 40°C for about 5 minutes. The sensor was placed 60 cm above floor level at the midpoint of the room.

Here is the data display before the shower

and after the shower

The displayed data shows that bathroom temperature stayed constant during the experiment while the relative humidity increased markedly. This result could have been obtained with an ordinary temperature-humidity gauge, but the smart gauge gives additional information.

In contrast to the steady ambient temperature, the dewpoint temperature shows a sharp rise from a comfortable 11.8°C (53°F) to a humid 18.3°C (65°F). The absolute humidity data shows an even greater increase – a 50% hike in water vapor concentration from 10 to 15 grams per m^3 in a matter of minutes.

– – – –

© P Mander, June 2018


Relative humidity (RH) and temperature (T) data from an RH&T sensor like the DHT22 can be used to compute not only absolute humidity AH but also dew point temperature TD

There has been a fair amount of interest in my formula which computes AH from measured RH and T, since it adds value to the output of RH&T sensors. To further extend this value, I have developed another formula which computes dew point temperature TD from measured RH and T.

Formula for computing dew point temperature TD

In this formula (P Mander 2017) the measured temperature T and the computed dew point temperature TD are expressed in degrees Celsius, and the measured relative humidity RH is expressed in %

gif format (decimal separator = .)

gif format (decimal separator = ,)

jpg format (decimal separator = .)

jpg format (decimal separator = ,)

– – – –

Strategy for computing TD from RH and T

1. The dew point temperature TD is defined in the following relation where RH is expressed in %

2. To obtain values for Psat, we can use the Bolton formula[REF, eq.10] which generates saturation vapor pressure Psat (hectopascals) as a function of temperature T (Celsius)

These formulas are stated to be accurate to within 0.1% over the temperature range –30°C to +35°C

3. Substituting in the first equation yields

Taking logarithms


Separating TD terms on one side yields

– – – –

Spreadsheet formula for computing TD from RH and T

1) Set up data entry cells for RH in % and T in degrees Celsius.

2) Depending on whether your spreadsheet uses a full point (.) or comma (,) for the decimal separator, copy the appropriate formula below and paste it into the computation cell for TD.

Formula for TD (decimal separator = .)


Formula for TD (decimal separator = ,)


3) Replace T and RH in the formula with the respective cell references. (see comment)

Your spreadsheet is now complete. Enter values for RH and T, and the TD computation cell will return the dew point temperature. If an object whose temperature is at or below this temperature is present in the local space, the thermodynamic conditions are satisfied for water vapor to condense (or freeze if TD is below 0°C) on the surface of the object.

– – – –

P Mander August 2017


I have a digital weather station with a wireless outdoor sensor. In the photo, the top right quadrant of the display shows temperature and relative humidity for outdoors (6.2°C/94%) and indoors (21.6°C/55%).

I find this indoor-outdoor thing fascinating for some reason and revel in looking at the numbers. But when I do, I always end up asking myself if the air outside has more or less water vapor in it than the air inside. Simple question, which is more than can be said for the answer. Using the ideal gas law, the calculation of absolute humidity from temperature and relative humidity requires an added algorithm that generates saturation vapor pressure as a function of temperature, which complicates things a bit.

Formula for calculating absolute humidity

In the formula below, temperature (T) is expressed in degrees Celsius, relative humidity (rh) is expressed in %, and e is the base of natural logarithms 2.71828 [raised to the power of the contents of the square brackets]:

Absolute Humidity (grams/m3) = 6.112 × e^[(17.67 × T)/(T+243.5)] × rh × 18.02
                                                                            (273.15+T) × 100 × 0.08314

which simplifies to

Absolute Humidity (grams/m3) = 6.112 × e^[(17.67 × T)/(T+243.5)] × rh × 2.1674

This formula is accurate to within 0.1% over the temperature range –30°C to +35°C

– – – –

gif format (decimal separator = .)


gif format (decimal separator = ,)


jpg format (decimal separator = .)


jpg format (decimal separator = ,)


– – – –

Additional notes for students

Strategy for computing absolute humidity, defined as density in g/m^3 of water vapor, from temperature (T) and relative humidity (rh):

1. Water vapor is a gas whose behavior approximates that of an ideal gas at normally encountered atmospheric temperatures.

2. We can apply the ideal gas equation PV = nRT. The gas constant R and the variables T and V are known in this case (T is measured, V = 1 m3), but we need to calculate P before we can solve for n.

3. To obtain a value for P, we can use the following variant[REF, eq.10] of the Magnus-Tetens formula which generates saturation vapor pressure Psat (hectopascals) as a function of temperature T (Celsius):

Psat = 6.112 × e^[(17.67 × T)/(T+243.5)]

4. Psat is the pressure when the relative humidity is 100%. To compute the pressure P for any value of relative humidity expressed in %, we multiply the expression for Psat by the factor (rh/100):

P = 6.112 × e^[(17.67 × T)/(T+243.5)] × (rh/100)

5. We now know P, V, R, T and can solve for n, which is the amount of water vapor in moles. This value is then multiplied by 18.02 – the molecular weight of water ­– to give the answer in grams.

6. Summary:
The formula for absolute humidity is derived from the ideal gas equation. It gives a statement of n solely in terms of the variables temperature (T)  and relative humidity (rh). Pressure is computed as a function of both these variables; the volume is specified (1 m3) and the gas constant R is known.

– – – –


– – – –

Formula recommended on France’s knowledge-sharing forum Futura

“On [blogpost URL] there are links to articles to control fans to dehumidify a cellar. Everything is there. Even a link to the formula to calculate the dew point if you want to check that the walls/floors reach it and you want to put a condition on it.”

June 2019: CarnotCycle thanks feumar for recommending this blogpost and my relative to absolute humidity conversion formula on France’s Futura knowledge-sharing forum on a vast array of scientific subjects including technology for the home.

– – – –

Formula used in Basement/Crawlspace Humidity Control System

May 2019: My relative to absolute humidity conversion formula has been used in an Arduino project whose aim is to “intelligently reduce the moisture in your basement/crawlspace to help control mildew growth and lower your heating/cooling bill”.

The author writes
“After running the ventilation system in my crawlspace for the last couple of months with zero hangs and with a peak relative humidity of greater than 95% after the leak from my hot water heater it has successfully dropped the relative humidity to less than 50%. The ventilation system is an on-going control system that works!”

– – – –

Formula used to demonstrate the effect of absolute humidity on flu virus counts

March 2019:

“Based on the agreement between the results of the linear and nonlinear models, AH had a stronger effect on all influenza virus counts than RH. Unlike RH, which measures the air saturation point of water [vapor] and varies by indoor versus outdoor location during the winter (the season of influenza activity in temperate climates), AH measures the actual amount of water [vapor] in the air, regardless of temperature, and is consistently low indoors and outdoors during the winter (reference 30). That might explain the consistent effect of AH on both influenza virus types and the strength of the association found in this study.”

“AH was defined as the weight of water vapor per unit volume of air and was expressed as the number of grams per cubic meter. Since AH data were not available from Environment Canada, the following formula was used to calculate AH, based on the available temperature (T) and RH (reference 32: CarnotCycle): AH = [6.112 × e^[(17.67 × T)/(T+243.5)] × RH × 2.1674}/(273.15 × T)”

– – – –

Formula used with Bosch BME280 to determine sensor altitude or sea level pressure

The BME280 is a temperature, pressure and relative humidity sensor with communication over I2C

January 2019: My relative-to-absolute humidity conversion formula has found use in an application on esphomelib, a coding library for WiFi-enabled ESP microprocessors.

– – – –

Dehumidifier supplier uses formula to power online capacity calculator

November 2018: Dehumidifier supplier Airépolis is using my formula in an online calculator designed to help customers choose the appropriate machine capacity based on the volume, temperature and relative humidity of the space to be dehumidified. Airépolis graciously acknowledges me and provides a link to this blogpost.

– – – –

Formula used in prediction of influenza cases

November 2018:

– – – –

Smart Temperature & Humidity Gauge

June 2018 : This prototype smart gauge features an Arduino Uno microprocessor equipped with a DHT22  sensor to measure temperature (T, Celsius*) and relative humidity (RH, %), both of which are inputs for computing dew point temperature (D, Celsius*) and absolute humidity (AH, defined as water vapor density in g/m^3) using the formulas presented in this blogpost. All four variables are output to a 16×2 LCD, and the unit is powered by a 9V battery to make it transportable after programming.

*The program has a built-in option to display T and D in Fahrenheit.

– – – –

Formula applied in dehumidification technology research

June 2018 : My relative to absolute humidity (AH) conversion formula has been used to compute specific humidity Wair = AH/ρair for a given temperature, where ρair is air density. In this research paper, a psychrometric chart for a range of calcium chloride liquid dessicant solutions across a range of temperatures was compiled from measured relative humidity and temperature data


– – – –

Formula used in study of environmental factors affecting sleep

April 2018: Researchers in Thailand have made use of my AH formula in a paper published in the Journal of Clinical Sleep Medicine, April 2018.


– – – –

Formula gets praise on GitHub

April 2018: My formula has found a new application in HappyBee, a companion set of features to complement ecobee WiFi thermostats. The HappyBee suite includes humidity normalization using a heat recovery ventilator.


– – – –

Formula cited in doctoral dissertation concerning GNSS positioning accuracy

October 2017: A doctoral dissertation from the University of Connecticut has used my AH formula to quantify real-time kinematic (RTK) positioning with the effect of ground-level AH, which theory and previous research suggests can degrade global navigation satellite system (GNSS) positioning accuracy.


– – – –

A neat display of RH, T and AH data

September 2017: This automated data display from a website in Austria is among the best I have seen. Outdoor measurements of RH (%) and T (Celsius) are taken every 10 minutes and fitted to a common 0 -100 scale, which also serves to plot computed AH (g/m^3).

The displayed segment captures the mirror-image movements of RH (blue line) as T (yellow line) rises and falls while AH (red line) remains relatively constant. This neatly visualizes how water vapor density and temperature together determine relative humidity.

– – – –

Formula for computing dew point temperature TD from RH and T

Relative humidity (RH) and temperature (T) data from an RH&T sensor like the DHT22 can be used to compute not only absolute humidity AH but also dew point temperature TD

August 2017: There has been a lot of interest in my formula (P Mander 2012) which computes AH from measured RH and T, since it adds value to the output of RH&T sensors. To further extend this value, I have developed another formula (P Mander 2017) which computes dew point temperature TD from measured RH and T. In this formula the measured temperature T and the computed dew point temperature TD are expressed in degrees Celsius, and the measured relative humidity RH is expressed in %

gif format (decimal separator = .)

gif format (decimal separator = ,)

If an object whose temperature is at or below TD is present in the local space, the thermodynamic conditions are satisfied for water vapor to condense (or freeze if TD is below 0°C) on the surface of the object.

Further details, including the derivation of the formula and copy-and-paste spreadsheet formulas for computing TD are available on this link:

– – – –

Formula cited in two recent academic research papers

July 2017

Czech Republic: Brno University of Technology, Faculty of Mechanical Engineering
Thesis: The effect of climate conditions on wheel-rail contact adhesion

Sweden: Linköping University, Institute for Economic and Industrial Development
Case study: Effect of seasonal ventilation on energy efficiency and indoor air quality
Authors: Frida Anderling and Oscar Svahn

“To ensure that the formula actually gives a correct value, some of the calculated values from the formula were compared with those from a Mollier diagram and in all the cases tested the results matched”

– – – –

Formula computes real time AH with DHT22 sensor on single board computer

June 2017: Single board computers provide low-cost solutions to automation and testing. On a BeagleBone Black Wireless equipped with a DHT22 RH&T sensor has been used to monitor outdoor and indoor temperature and humidity using my formula to enable AH computations to be processed in real time.

– – – –

Formula features in Russian Arduino project on YouTube

April 2017: My formula makes its first live appearance on YouTube. The presentation concerns a humidity/temperature monitoring and management system installed in a cellar affected by mould problems. If you don’t speak Russian don’t worry, the images of the installation give you the gist of what this project is about.

See the YouTube video here:

– – – –

Formula recommended for use in monitoring comfort levels for exotic pets

March 2017: A post has appeared on Reddit concerning an Arduino Uno with T&RH sensor and LCD screen, which the poster is using to improve temperature and humidity monitoring of a pet’s habitat – in this particular case a Bearded Dragon (not the one illustrated).

The post has attracted much interested discussion and comment, including a recommendation from one participant to use AH rather than RH, citing my conversion formula. The rationale for the change is so neatly expressed that I would like to quote it:

“May I recommend absolute humidity instead of relative? Relative humidity only tells you how “full” the air is of moisture, and it’s entirely dependent on temperature; the same amount of moisture will read lower relative humidity at higher temperatures, and vice versa. Whereas absolute humidity is measured in grams of water per cubic meter of air. You can implement this simple conversion formula in your code: (URL for this blogpost)
0-2 is extremely dry, 6-12 is your average indoors, and 30 is like an Amazon rainforest.”

See the Reddit post here:

See the Arduino project here:

– – – –

Interesting discussion of value of AH vs RH on Reddit

February 2017:

– – – –

Igor uses my formula to keep his cellar dry


October 2016: I am impressed by this basement humidity control system developed by Igor and reported on forum.

Inside the short pipe is a fan equipped with a 3D-printed circumferential seal. The fan replaces basement air with outdoor air, and is activated when absolute humidity in the cellar is 0.5 g/m^3 higher than in the street, subject to the condition that the temperature of the outdoor air is lower. This ensures that water in the cellar walls is drawn into the vapor phase and pumped out; the reverse process cannot occur. на русском здесь.


– – – –

Formula cited in doctoral dissertation concerning local weather and infectious disease

Summer 2016: My AH formula has been cited in a doctoral dissertation entitled “Seasonality, local weather and infectious disease: effects of heat and humidity on local risk for urinary tract infections and Legionella pneumonia”

This can be downloaded from

– – – –

Formula powers AH measurements from high-precision RH&T sensor


The SHT75 RH&T sensor from SENSIRION

April 2016: Prof. Antonietta Frani has made a miniature device for measuring absolute humidity, using my formula to power an Arduino Uno microcontroller board equipped with an SHT75 RH&T sensor which connects to a computer via a USB cable. Systems Integrator Roberto Valgolio has developed an interface to transfer the data to Excel spreadsheets with their associated graphical display functions.

– – – –

Formula powers online RH←→AH calculator


March 2016: German website is using my formula to power an online RH/AH conversion calculator.

– – – –

Formula cited in academic research paper


January 2016: A research article in Landscape Ecology (October 2015) exploring microclimatic patterns in urban environments across the United States has used my formula to compute absolute humidity from temperature and relative humidity data.

– – – –

Formula finds use in humidity control unit

August 2015: Open source software/hardware project Arduino is using my absolute humidity formula in a microcontroller designed to control humidity in basements:


“The whole idea is to measure the temperature and relative humidity in the basement and on the street, on the basis of temperature and relative humidity to calculate the absolute humidity and make a decision on the inclusion of the exhaust fan in the basement. The theory for the calculation is set forth here –” на русском здесь.

More photos on this link (text in Russian):

– – – –

AH computation procedure applied in calibration of NASA weather satellite

June 2015: My general procedure for computing AH from RH and T has been applied in the absolute calibration of NASA’s Cyclone Global Navigation Satellite System (CYGNSS), specifically in relation to the RH data provided by Climate Forecast System Reanalysis (CFSR). The only change to my formula is that Psat is calculated using the August-Roche-Magnus expression rather than the Bolton expression.

The CYGNSS system, comprising a network of eight satellites, is designed to improve hurricane intensity forecasts and was launched on 15 December 2016.

Reference: (Technical report “An Antenna Temperature Model for CYGNSS” June 2015)

– – – –

Formula cited in draft paper on air quality monitoring

May 2015: Metal oxide (MO) sensors are used for the measurement of air pollutants including nitrogen dioxide, carbon monoxide and ozone. A draft paper concerning the Air Quality Egg (AQE) which cites my formula in relation to MO sensors can be seen on this link:


– – – –

Formula used by US Department of Energy in Radiological Risk Assessment

June 2014: In its report on disused uranium mines, Legacy Management at DoE used my formula for computing absolute humidity as one of the meteorological parameters involved in modeling radiological risk assessment.

– – – –