Subscribe to Arduino Academy and start learning today for FREE!

Temp / Humidity w/ Dew Point Calculations

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

Update: added Heat Index 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!

Become the Maker you were born to be. Try Arduino Academy for FREE!


1 DHT-11 Temp / Humidity Sensor
1 Arduino Uno
1 10k Resistor

I suggest a solderless breadboard for testing:
Breadboard with jumper wires

(wiring diagram and library download at

Wind Chill option (need a wind speed sensor)

// Example testing sketch for various DHT humidity/temperature sensors
// Written by ladyada, public domain

#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


float tF;
float dP;
float dPF;

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


void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();

// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println(“Failed to read from DHT”);
} else {
Serial.print(“Humidity: “);
Serial.print(” %t”);
Serial.print(“Temperature: “);
// Serial.print(t);
// Serial.print(” *C “);
Serial.print(” *F “);
Serial.print(” t”);

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

Serial.print(“Heat Index: “);
Serial.println(” *F”);


// delta max = 0.6544 wrt dewPoint()
// 6.9 x faster than dewPoint()
// reference:
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;

Become the Maker you were born to be. Try Arduino Academy for FREE!

Notify of
1 Comment
Inline Feedbacks
View all comments
7 years ago

Thanks for this fantastic post. I have taken your formulae for Dew Point and Heat Index for a weather project written in Python. The formula for Dew Point works like a charm but have not been able to check the Heat Index against something on the weather sites.

Thanks so much!


Would love your thoughts, please comment.x