Posts Tagged ‘Relative humidity’

As a follow-up to my 2018 Smart Temperature and Humidity Gauge here is a new and improved wireless version. A smartphone screen replaces the previous LCD display, allowing the data to be read remotely from the device location. The four displayed parameters are the same, but the previous Absolute Humidity formula with its -30°C to +35°C range has been replaced with a new formula (Mander 2020) with an extended temperature range.

The WiFi-enabled microcontroller can be programmed to operate in Station mode, Access Point mode or both modes simultaneously so you can use the device at home, at work, on the beach, wherever you want to know the values of the parameters which determine your comfort.

The original Smart Gauge prototype with attached LCD display

The wireless function also enables you to read temperatures inside a closed compartment such as a fridge. By following the readings on your smartphone (I set mine to refresh every 20 secs) you can see what the upper and lower thermostat settings are. For example the air in the 4°C compartment of our fridge cycles between 2.9°C and 7.5°C. I was surprised by this to begin with, but then realized that things stored in fridges generally have significantly larger heat capacities than air so their temperatures will fluctuate over narrower ranges.

A sensor mounted on jumper leads is ideal for testing condenser coil ventilation on a fridge, with the sensor placed directly in the airflow of the lower inlet and upper outlet.

– – – –


The CarnotCycleAIR Smart Gauge is built around an Arduino IDE compatible Sparkfun ESP8266 Thing Dev microcontroller featuring an integrated FTDI USB-to-Serial chip for easy programming. A 2-pin JST connector has been soldered to the footprint alongside the micro-USB port and the board is powered by a rechargeable 3.7V lithium polymer flat pouch battery which fits neatly underneath the standard 400 tie-point breadboard. The system is designed to work with DHT sensors such as the DHT22 with a temperature range of -40°C to +80°C and relative humidity range of 0-100%, or the DHT11 with a temperature range of 0°C to +50°C and relative humidity range of 20-90%. These are available mounted on 3-pin breakout boards which feature built-in pull-up resistors. Both sensors are designed to function on the 3.3V supplied by the board, enabling the signal output to be connected directly to one of the board’s I/O pins without the need for a logic level converter [the ESP8266’s I/O pins do not easily tolerate voltages higher than 3.3V. Using 5V will blow it up].

Note: Comparing temperature readings in ambient conditions with an accurate glass thermometer has shown that when the sensors are plugged directly into the breadboard they record a temperature approx. 1°C higher than the true temperature, which in turn affects the accuracy of the computed absolute humidity and dewpoint. The cause appears to be Joule heating in the breadboard circuitry. Using jumper leads to distance the sensor from the board solves the problem.

The DHT22 sensor works happily down to –40°C, as does the new absolute humidity formula.

When used in Station mode the range is determined largely by the router. In Access Point mode where the device and smartphone communicate directly with each other, the default PCB trace antenna was found to work really well with an obstacle-free range of at least 35 meters (115 feet).

A Sparkfun LiPo Charger Basic, an incredibly tiny device just 3 cm long with a JST connector at one end and a micro-USB connector at the other, was used to recharge the battery. Charging time was about 4 hours.

The Sparkfun LiPo Charger Basic

– – – –


The circuitry for CarnotCycleAIR Smart Gauge couldn’t be simpler.

The ESP8266 (with header pins) is placed along the center of the breadboard and 3.3V is supplied to the power bus from the left header (3V3, GND). The DHT sensor is powered from this bus and the signal is routed to a suitable pin. I used pin 12 on the right header. That’s all there is to it.

– – – –


CarnotCycleAIR Smart Gauge is a further development of an ESP8266 project – “ESP8266 NodeMCU Access Point (AP) for Web Server” – published online by Random Nerd Tutorials which displays temperature and relative humidity on a smartphone with the ESP8266 set up as an Access Point. Code for the Station-only version using Arduino IDE can be copied from this link:

Note: The coding for the Absolute Humidity and the Dewpoint Temperature formulas must be written on one line

– – – –

© P Mander December 2021

The absolute humidity formula posted in 2012 on this blog has a range of -30°C to 35°C. To expand this range I have developed a new formula to compute absolute humidity from relative humidity and temperature based on a simple but little known polynomial expression (Richards, 1971) for the saturation vapor pressure of water, valid to ±0.1% over the temperature range -50°C to 140°C.

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 Euler number 2.71828 [raised to the power of the contents of the square brackets]:

Absolute Humidity = 1013.25 × e^[13.3185t – 1.9760t^2 – 0.6445t^3 – 0.1299t^4] × rh × 18.01528
(grams/m^3)                                                   100 × 0.083145 × (273.15 + T)

where the parameter t = 1 – 373.15/(273.15 + T)

The above formula simplifies to

Absolute Humidity = 1013.25 × e^[13.3185t – 1.9760t^2 – 0.6445t^3 – 0.1299t^4] × rh × 2.1667
(grams/m^3)                                                                   273.15 + T

To cite this formula please quote: P Mander (2020),

– – – –

Study notes

Strategy for computing absolute humidity, defined as water vapor density in grams/m3, from temperature (T) and relative humidity (rh):

1. Water vapor is a gas whose behavior in air approximates that of an ideal gas due to its very low partial pressure.

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 polynomial expression of Richards (ref) which generates saturation vapor pressure Psat (hectopascals) as a function of temperature T (Celsius) in terms of a parameter t

Psat = 1013.25 × e^[13.3185t – 1.9760t2 – 0.6445t3 – 0.1299t4]
where t = 1 – 373.15/(273.15 + T)

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

P = 1013.25 × e^[13.3185t – 1.9760t2 – 0.6445t3 – 0.1299t4] × 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 the molecular weight of water to give the answer in grams.

Absolute humidity (grams/m3) = Psat  ×  rh  ×  mol wt
                                                          100 × R × (273.15 + T)

Saturation vapor pressure Psat is expressed in hectopascals hPa
Relative humidity rh is expressed in %
Molecular weight of water mol wt = 18.01528 g mol-1
Gas constant R = 0.083145 m3 hPa K-1 mol-1
Temperature T is expressed in degrees Celsius

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 jpgs

decimal separator = .

decimal separator = ,

– – – –

P Mander, July 2020

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

UPDATE: See the new wireless version < here >

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. (more…)

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 natural logarithms


Separating TD terms on one side yields

– – – –

P Mander August 2017

jefferson st nyc subway L

NYC Subway flooding 2nd September 2021

The incidents of severe flooding in the United States, Germany, Belgium and several other places in the world during the summer of 2021 were traumatizing and ruinous to the many people affected and a shock to weather forecasters and local authorities. A wake-up call has been served and much meteorological research and analysis has been set in motion. (more…)