 # Temp / Humidity w/ Dew Point Calculations

I’ve taken our older Temperature / Humidity project, and updated it with Dew Point Calculations.

“The dew point is the temperature below which the water vapor in air at constant barometric pressure condenses into liquid water at the same rate at which it evaporates. The condensed water is called dew when it forms on a solid surface.”
So, I’ve added a new function at the end of the script that makes the calculations, defined some new variables in the sketch, and made some calculation and new prints in the loop. Enjoy! Parts:

I suggest a solderless breadboard for testing:

Wind Chill option (need a wind speed sensor)

// Example testing sketch for various DHT humidity/temperature sensors

#include <DHT.h>

#define DHTPIN 2     // what pin we’re connected to

// Uncomment whatever type you’re using!
#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
//#define DHTTYPE DHT21   // DHT 21 (AM2301)

// Connect pin 1 (on the left) of the sensor to +5V
// Connect pin 2 of the sensor to whatever your DHTPIN is
// Connect pin 4 (on the right) of the sensor to GROUND
// Connect a 10K resistor from pin 2 (data) to pin 1 (power) of the sensor

DHT dht(DHTPIN, DHTTYPE);

float tF;
float dP;
float dPF;

void setup() {
Serial.begin(9600);
Serial.println(“DHTxx test!”);

dht.begin();
}

void loop() {
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
} else {
Serial.print(“Humidity: “);
Serial.print(h);
Serial.print(” %t”);
Serial.print(“Temperature: “);
// Serial.print(t);
// Serial.print(” *C “);
tF=((t*9)/5)+32;
Serial.print(tF);
Serial.print(” *F “);
Serial.print(” t”);

Serial.print(“Dew Point: “);
// Serial.print(dewPointFast(t, h));
// Serial.print(” *C “);
dP=(dewPointFast(t, h));
dPF=((dP*9)/5)+32;
Serial.print(dPF);
Serial.print(” *F”);
Serial.print(” t”);

Serial.print(“Heat Index: “);
Serial.print(heatIndex(tF,h));
Serial.println(” *F”);

}
}

// delta max = 0.6544 wrt dewPoint()
// 6.9 x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
double a = 17.271;
double b = 237.7;
double temp = (a * celsius) / (b + celsius) + log(humidity*0.01);
double Td = (b * temp) / (a – temp);
return Td;
}

double heatIndex(double tempF, double humidity)
{
double c1 = -42.38, c2 = 2.049, c3 = 10.14, c4 = -0.2248, c5= -6.838e-3, c6=-5.482e-2, c7=1.228e-3, c8=8.528e-4, c9=-1.99e-6  ;
double T = tempF;
double R = humidity;

double A = (( c5 * T) + c2) * T + c1;
double B = ((c7 * T) + c4) * T + c3;
double C = ((c9 * T) + c8) * T + c6;

double rv = (C * R + B) * R + A;
return rv;
} Subscribe
Notify of 1 Comment
Inline Feedbacks 