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.
*https://www.weather.gov/arx/why_dewpoint_vs_humidity
– – – –
Hardware
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.
*http://www.instructables.com/id/Powering-Arduino-with-a-Battery/
– – – –
Circuitry
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 bus 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.
– – – –
Code
CODE UPDATED JULY 2022
/*
Smart Temperature and Humidity Gauge using an Arduino Uno and
a DHT22 RH&T sensor with output to a 16 x 2 LCD screen. Variables
displayed are temperature, relative humidity, dew point temperature
and absolute humidity. Program by Peter Mander June 2018.
*/
#include <DHT.h>
#include <DHT_U.h>
#include <math.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
#define DHTPIN 7
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
lcd.begin(16,2);
dht.begin();
}
void loop() {
float rh = dht.readHumidity(); //relative humidity in %
float t = dht.readTemperature(); //temperature in Celsius
float tf = t*9.0/5.0+32.0; //temperature in Fahrenheit
float ah; //absolute humidity = water vapor density in g/m^3
float td; //dew point temperature in Celsius
float tdf; //dew point temperature in Fahrenheit
ah = (6.112*pow(2.71828,((17.67*t)/(243.5+t)))*rh*2.1674)/(273.15+t); // formula P.Mander, 2012
td = 243.5*(log(rh/100)+((17.67*t)/(243.5+t)))/(17.67-log(rh/100)-((17.67*t)/(243.5+t))); // formula P.Mander, 2017
tdf = td*9.0/5.0+32.0;
lcd.setCursor(0,0); lcd.print(“T:”); lcd.print(t); // (t) displays Celsius, (tf) displays Fahrenheit
lcd.setCursor(0,1); lcd.print(“D:”); lcd.print(td); // (td) displays Celsius, (tdf) displays Fahrenheit
lcd.setCursor(8,0); lcd.print(“RH:”); lcd.print(rh);
lcd.setCursor(8,1); lcd.print(“AH:”); lcd.print(ah);
delay(20000); // sets 20 second interval between readings
}
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 20 seconds, but this number can be configured to suit your preferences. Code contains option to display ambient temperature and dew point temperature in Celsius or Fahrenheit.
– – – –
Experiment
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