Dewpoint in F° conversion ?

Hi Guys
I have been working on a sketch to display temp,Humidity and dew point in F° on a lcd display. I was able to get the temperature but could not figure how to enter the formula to convert the C° to F°. I am really new to this and have just combined a couple of sketches to get to this point. I imagine that there is probably a better way to do this but like I said I am new to this Here is my sketch. Any help would be greatly appreciated !
Thanks GD

#include <Wire.h> 
#include <dht11.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display


/*-----( Declare objects )-----*/
dht11 DHT11;

/*-----( Declare Constants, Pin Numbers )-----*/
#define DHT11PIN 2

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  

  Serial.begin(9600);
  Serial.println("DHT11 TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT11LIB_VERSION);
  Serial.println();
}/*--(end setup )---*/

void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  Serial.println("\n");

  int chk = DHT11.read(DHT11PIN);

  Serial.print("Read sensor: ");
  switch (chk)
  {
    case 0: Serial.println("OK"); break;
    case -1: Serial.println("Checksum error"); break;
    case -2: Serial.println("Time out error"); break;
    default: Serial.println("Unknown error"); break;
  }

  Serial.print("Humidity (%): ");
  Serial.println((float)DHT11.humidity, 2);


  Serial.print("Temperature (F): ");
  Serial.println(Fahrenheit(DHT11.temperature), 2);

 

  Serial.print("Dew Point (F): ");
  Serial.println(dewPoint(DHT11.temperature, DHT11.humidity));

  Serial.print("Dew PointFast (F): ");
  Serial.println(dewPointFast(DHT11.temperature, DHT11.humidity));
  
  lcd.setCursor(3,0);
  lcd.print("Gary   Davis!");
  
  lcd.setCursor(3,1);
  lcd.print("Temp F:");
  lcd.println(Fahrenheit(DHT11.temperature));
  
  
   lcd.setCursor(1,2);
   lcd.print("Humidity: ");
   lcd.println((float)DHT11.humidity, 2);
   lcd.setCursor(0,3);
   lcd.print("Dew Point:F ");
   lcd.println(dewPoint (DHT11.temperature, (DHT11.humidity*1.8 + 32)));
   //lcd.println(dewPoint(DHT11.temperature, DHT11.humidity));
    
  delay(10000);
}/* --(end main loop )-- */

/*-----( Declare User-written Functions )-----*/
//
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)
{
        return 1.8 * celsius + 32;
}

//Celsius to Kelvin conversion
double Kelvin(double celsius)
{
        return celsius + 273.15;
}

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm 
double dewPoint(double celsius, double humidity)
{
        double A0= 373.15/(273.15 + celsius);
        double SUM = -7.90298 * (A0-1);
        SUM += 5.02808 * log10(A0);
        SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
        SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
        SUM += log10(1013.246);
        double VP = pow(10, SUM-3) * humidity;
        double T = log(VP/0.61078);   // temp var
        return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x 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/100);
        double Td = (b * temp) / (a - temp);
        return Td;
}

/* ( THE END ) */

Hi GD, Since your temperature is in celcius, just calculate the dew-point with the temp and humidty values (don't try to convert the humidity). Then just covert the dew point result to F.

Hi Tororo I was trying to use a math formula after it had figured the dewpoint but was not having any luck. It would not come out with the right answer. I was hoping that someone would help me with a few lines for my sketch.

Thanks GD

Take a look at these links, maybe they would help :)

http://playground.arduino.cc/ComponentLib/Thermistor http://playground.arduino.cc/ComponentLib/Thermistor2

There are some simple examples in the first two link with using reference readings or using the Steinhart-Hart formula which would yield precise results:

http://en.wikipedia.org/wiki/Steinhart%E2%80%93Hart_equation

2 dewpoint functions here - http://playground.arduino.cc/Main/DHT11Lib -

usage for Fahrenheit

float DPF = dewPointFast( (TF-32.0)*5/9, humidity) * 9.0/5.0 +32.0;

Hi Rob Thanks for the tip but I don't know where to put that in my sketch. Is there any chance you help me with that also ?

Thanks GD

not tested but this should do it

#include <Wire.h> 
#include <dht11.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display


/*-----( Declare objects )-----*/
dht11 DHT11;

/*-----( Declare Constants, Pin Numbers )-----*/
#define DHT11PIN 2

void setup()   /*----( SETUP: RUNS ONCE )----*/
{
  lcd.init();                      // initialize the lcd 
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  

  Serial.begin(9600);
  Serial.println("DHT11 TEST PROGRAM ");
  Serial.print("LIBRARY VERSION: ");
  Serial.println(DHT11LIB_VERSION);
  Serial.println();
}/*--(end setup )---*/

void loop()   /*----( LOOP: RUNS CONSTANTLY )----*/
{
  Serial.println("\n");

  int chk = DHT11.read(DHT11PIN);

  Serial.print("Read sensor: ");
  switch (chk)
  {
    case 0: Serial.println("OK"); break;
    case -1: Serial.println("Checksum error"); break;
    case -2: Serial.println("Time out error"); break;
    default: Serial.println("Unknown error"); break;
  }

  Serial.print("Humidity (%): ");
  Serial.println((float)DHT11.humidity, 2);


  Serial.print("Temperature (F): ");
  Serial.println(Fahrenheit(DHT11.temperature), 2);

 

  Serial.print("Dew Point (C): ");
  Serial.println(dewPoint(DHT11.temperature, DHT11.humidity));

  Serial.print("Dew PointFast (F): ");
  Serial.println(Fahrenheit(dewPointFast(DHT11.temperature, DHT11.humidity))); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  
  lcd.setCursor(3,0);
  lcd.print("Gary   Davis!");
  
  lcd.setCursor(3,1);
  lcd.print("Temp F:");
  lcd.println(Fahrenheit(DHT11.temperature));
  
  
   lcd.setCursor(1,2);
   lcd.print("Humidity: ");
   lcd.println((float)DHT11.humidity, 2);
   lcd.setCursor(0,3);
   lcd.print("Dew Point:F ");
   lcd.println(Fahrenheit(dewPoint (DHT11.temperature, DHT11.humidity)));
    
  delay(10000);
}/* --(end main loop )-- */

/*-----( Declare User-written Functions )-----*/
//
//Celsius to Fahrenheit conversion
double Fahrenheit(double celsius)
{
        return 1.8 * celsius + 32;
}

//Celsius to Kelvin conversion
double Kelvin(double celsius)
{
        return celsius + 273.15;
}

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm 
double dewPoint(double celsius, double humidity)
{
        double A0= 373.15/(273.15 + celsius);
        double SUM = -7.90298 * (A0-1);
        SUM += 5.02808 * log10(A0);
        SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
        SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
        SUM += log10(1013.246);
        double VP = pow(10, SUM-3) * humidity;
        double T = log(VP/0.61078);   // temp var
        return (241.88 * T) / (17.558-T);
}

// delta max = 0.6544 wrt dewPoint()
// 5x 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/100);
        double Td = (b * temp) / (a - temp);
        return Td;
}

/* ( THE END ) */

Hi Rob

Thank you very much for your help. It is very helpful for me to see the sketch and compare it to what I had done and figure out where I went wrong ! I am very new to this and I am trying to learn but my old brain is not as absorbent as it used to be I think ! hahaha

Thanks You GD

Thats a good way to learn, you can try to adapt your original program with that knowledge to get it to work.

Try to change the code (small steps) to see what effect it has.

Hi Rob

Yes and thanks again !

GD