Project showcase
DHT11 Dew-Point Calculator

DHT11 Dew-Point Calculator © GPL3+

After talking to a friend about his electric tricycle and how the window fogs up when it's cool out I thought it would be fun to monitor it.

  • 12 respects

Components and supplies

About this project

Was chatting with a friend about his electric tricycle and how his windshield fogs up when its cold and humid out, Hmmmm I started thinking this would be a fun little project for my Arduino Uno!! yes this is an easy project but hey iv'e only had it for 2 weeks lol. Anyway it turned out really cool and learned a lot about programming the LCD shield and accessing the DHT11 chip.

If he could see a live value for dew point he would know when his window will fog up and be ready for it.

I wanted to build my friend something that was unique and kind of one of a kind.

The wire diagram is in the code section under "the circuit." It very straight forward if you bread board it, laying it out as I did using copper wire and the like took hours but looked and worked great when it was done.

I used a small dc to dc converter/regulator to protect the uno and also make it more versatile with what can power it, its range was 16vdc to 5vdc and it outputs 5vdc.

Thanks for looking and hit me up with any questions.


Bob's Dew-point Temp displayArduino
 10/18/18 - 3/10/19

     //  Library section
#include <LiquidCrystal.h>                // LCD library
  LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // (rs,e,d4,d5,d6,d7),initialize the LCD with the numbers of the interface pins
#include <DHT.h>                          // DHT22 library, delete any "DHT.U" files from library,or it wont run
     //  Definition section
#define DHTPIN 2            // what arduino pin we're connected to, arduino pin D2
  DHT dht(DHTPIN, DHT22);   // initialize DHT sensor and create sensor objects
#define DHTTYPE DHT22       // create DHT 22  (AM2302), AM2321 object
     //  pin assignment section
int alarmLed = 3; //  assigns alarmLed int to arduino pin D3
void setup()
     //  initilize and start systems
  Serial.begin(9600); //  sets up serial comm's to 9600 baud
  dht.begin();        //  initialize the DHT22
  lcd.begin(16, 2);   //  initialize the LCD's number of columns and rows
     //  display and serial print initilization
  Serial.println("DHTxx test!");
  lcd.setCursor(0, 1); lcd.print("DHTxx test!");
     //  output pin setup section
  pinMode(alarmLed, OUTPUT);   //  assigns alarmLed (arduino pin 3) as an output
  digitalWrite(alarmLed, LOW); //  sets output alarmLed (arduino pin 3) low

void loop()
     // Reading temperature and humidity takes about 250 milliseconds
  float H = dht.readHumidity();        //  read humitity as %f
  float C = dht.readTemperature();     //  read temperature as Celsius (default)
  float F = dht.readTemperature(true); //  read temperature as Fahrenheit (if true)
     // DHT22 data error check section
  if (isnan(H) || isnan(C) || isnan(F))
    Serial.println("Failed to read from DHT sensor!");
    lcd.setCursor(0, 0); lcd.print("                ");
    lcd.setCursor(0, 0); lcd.print(" Failed to read ");
    lcd.setCursor(0, 1); lcd.print("                ");
    lcd.setCursor(0, 1); lcd.print("DHT sensor Fail!");
    return;   //  returns to start of loop

    //  calculations and conversions section
  float HiF = dht.computeHeatIndex(F, H); //  read and compute heat index in Fahrenheit (the default)
  float DewPoint = (C - (100 - H) / 5);   //  dewpoint calculation using Celsius value
  float DP = (DewPoint * 9 / 5) + 32;     //  converts dewPoint calculation to fahrenheit

     //  alarm output section
  if ((F - 2) <= DP)                 //  if the F value - 2 is <= to the DP value then this statement is true
     {digitalWrite(alarmLed, HIGH);} //  since statement is true set alarmLed (arduino pin D3) high
   else                              //  if statement is not true then
     {digitalWrite(alarmLed, LOW);}  //  set alarmLed (arduino pin D3) low

     //  serial monitor and debug section
  Serial.print("Sample OK: ");                                //  prints sample ok to serial monitor
  Serial.print((int)C);        Serial.print(" *C, ");         //  prints celsius value to serial monitor and returns cursor
  Serial.print((int)F);        Serial.print(" *F, ");         //  prints fahrenheit value to serial monitor and returns cursor
  Serial.print((int)H);        Serial.print(" %, ");          //  prints humidity value to serial monitor and returns cursor
  Serial.print((int)DP);       Serial.print(" DP, ");         //  prints dewpoint value to serial monitor and returns cursor to next line
  Serial.print((int)HiF);      Serial.print(" Heat index, "); //  prints humidity value to serial monitor and returns cursor
  Serial.print((int)DewPoint); Serial.println(" DewP, ");     //  prints dewpoint value to serial monitor and returns cursor to next line

     //  LCD print section
  lcd.setCursor(0,  0); lcd.print("Tmp");
  lcd.setCursor(4,  0); lcd.print(F);
  lcd.setCursor(6,  0); lcd.print((char)223); lcd.print("F"); //  prints the degree's symbol
  lcd.setCursor(8,  0); lcd.print("Dew");
  lcd.setCursor(12, 0); lcd.print(DP);
  lcd.setCursor(14, 0); lcd.print((char)223); lcd.print("F"); //  prints the degree's symbol
  lcd.setCursor(0,  1); lcd.print("Hum ");
  lcd.setCursor(4,  1); lcd.print(H);
  lcd.setCursor(6,  1); lcd.print(" % ");
  lcd.setCursor(8,  1); lcd.print("HId");
  lcd.setCursor(12, 1); lcd.print(HiF);
  lcd.setCursor(14, 1); lcd.print((char)223); lcd.print("F"); //  prints the degree's symbol
     // The DHT22 sampling rate is .5HZ (.5 Sec), this delay sets program sample rate to match so no errors happen

The CircuitArduino

  The circuit:

 Select - Arduino nano, board: select - ATmega328P (old Bootloader), processor
   5v to VCC
   gnd to GND

 LCD 16X2:
   LCD 1(VSS) pin to ground
   LCD 2(VDD) pin to vcc
 10K potentiometer:
   ends to +5V and ground
   LCD 3(VO)  pin to pot wiper
   LCD 4(RS)  pin to digital pin D7
   LCD 5(RW)  pin to ground
   LCD 6(E)   pin to digital pin D8
   LCD 11(D4) pin to digital pin D9
   LCD 12(D5) pin to digital pin D10
   LCD 13(D6) pin to digital pin D11
   LCD 14(D7) pin to digital pin D12
   LCD 15(A)  pin to vcc
   LCD 16(K)  pin to gnd
   VCC:  pin 1 to +5v
   DATA: pin 2 to pin D2 nano
   GND:  pin 3 to ground

   Nano pin D3 to led +
   led - to 2000 ohm res
   2000 res to ground

  after download start the serial monitor



  • 1 project

Additional contributors

  • For the use of his dew point calculation by Lawrence, Mark G

Published on

November 8, 2019

Members who respect this project


and 8 others

See similar projects
you might like

Similar projects you might like

DHT11 Sensor with LEDs and a Piezo Speaker

Project tutorial by Tech with Matthew

  • 24 respects

3-Bit Binary Calculator Using Arduino Uno

Project showcase by 22warehamD

  • 13 respects

Using DHT11

by Arca_Ege

  • 28 respects

DHT11 Humidity + Temperature Sensor with 16x2 LCD display

Project showcase by onatto22

  • 44 respects

Microview DHT11 Meteo Station

Project tutorial by Giovanni Gentile

  • 3 respects
Add projectSign up / Login