View Single Post
  #74  
Old 28-01-2018, 11:28 AM
GRM (Graham)
Registered User

GRM is offline
 
Join Date: Jan 2018
Location: Ormond, Australia
Posts: 6
Garbz,

I'd love to get a copy of your simplified formula for Dew Point. Below are the 3 versions I have been using. I don't know which one is more economical when it comes to microcontroller cycles.

Side Note: I just realised ChrisV had a simpler version of his code commented out. Didn't see it earlier. I'll try that next.

// Read Dew Point Slow in Celcius;
// delta max = 0.6544 wrt dewPoint()
// 5x faster than dewPoint()
// reference: http://en.wikipedia.org/wiki/Dew_point
double a = 17.271;
double b = 237.7;
double temp_ = (a * (double) ambtemp) / (b + (double) ambtemp) + log( (double) ambhum/100);
int Td = (b * temp_) / (a - temp_);
Serial.write((Td/10)%10+'0');Serial.print("C dptemp: ");

// dewPoint function NOAA
// reference: http://wahiduddin.net/calc/density_algorithms.htm
double A0= 373.15/(273.15 + (double) ambtemp);
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) * (double) ambhum;
double T = log(VP/0.61078); // temp var
dptemp = ( (241.88 * T) / (17.558-T));
Serial.write((dptemp/10)%10+'0');Serial.print("C dewPointAmbient: ");

// Calc dew point if no error reading DHT11. ChrisV code.
// simple calc = dewPointAmbient = temperatureAmbient - ((100 - humidityAmbient)/5.0);
// more complex calc
double logEx=0.66077 + 7.5*ambtemp/(237.3+ambtemp) + (log10(ambhum) - 2);
dewPointAmbient = (logEx - 0.66077)*237.3/(0.66077+7.5-logEx);
Serial.write((dewPointAmbient/10)%10+'0');
Reply With Quote