Go Down

### Topic: Is this dew point calculation correct using the DHT-11? (Read 313 times)previous topic - next topic

#### japreja ##### Nov 07, 2018, 08:28 pm
I converted a spreadsheet dewpoint calculation I found on http://andrew.rsmas.miami.edu/bmcnoldy/Humidity.html to a function, is this correct?  I've seen several much simpler calculation on the forum and would like to know the accuracy of this find.

Requires the inclusion of math.h for the log(x) function.
Code: [Select]
`/* * Calculates the dewpoint base off of the temperature and relative humidity * calculation of Dewpoint as provided on http://andrew.rsmas.miami.edu/bmcnoldy/Humidity.html */float calcDewpoint(float temp, float rh){  //TD: =243.04*(LN(RH/100)+((17.625*T)/(243.04+T)))/(17.625-LN(RH/100)-((17.625*T)/(243.04+T)))  return 243.04*(log(rh/100)+((17.625*temp)/(243.04+temp)))/(17.625-log(rh/100)-((17.625*temp)/(243.04+temp)));}`

Also why are the other calculations so simple where this calculation seems more complex?

Thanks in advance for your responses.

#### el_supremo #1
##### Nov 07, 2018, 08:42 pm
It looks correct but the easiest way to check is if you write a little test code and feed it some numbers that you can compare with the online calculator.

Pete
Don't send me technical questions via Private Message.

#### japreja #2
##### Nov 07, 2018, 08:45 pm
I just did that and noticied I should clarify that that temp as required by this function must be provided in degrees F and not C.  Can be modified as follows if temp is provided in Celsius.

Code: [Select]
`/* * Calculates the dewpoint base off of the temperature and relative humidity * calculation of Dewpoint as provided on http://andrew.rsmas.miami.edu/bmcnoldy/Humidity.html */float calcDewpoint(float temp, float rh){  float tempf = (temp * 1.8) + 32;  //TD: =243.04*(LN(RH/100)+((17.625*T)/(243.04+T)))/(17.625-LN(RH/100)-((17.625*T)/(243.04+T)))  return 243.04*(log(rh/100)+((17.625*tempf)/(243.04+tempf)))/(17.625-log(rh/100)-((17.625*tempf)/(243.04+tempf)));}`

#### el_supremo #3
##### Nov 07, 2018, 08:52 pm
I tried your code and it gave the same result as the online calculator when I gave it the temperature in Celsius
Quote
(• T and TD inputs/outputs to the equations are in Celsius)
Quote
Also why are the other calculations so simple
Which one(s)?

Pete
Don't send me technical questions via Private Message.

#### japreja #4
##### Nov 07, 2018, 09:05 pm
Which one(s)?
https://forum.arduino.cc/index.php?topic=504940.msg3445563#msg3445563

and external sites too:

https://www.best-microcontroller-projects.com/dht22.html
https://labsutet.wordpress.com/2016/09/26/dew-point-arduino/

are just a few, I just used a google search of "arduino dht 11 dewpoint" before posting, some do seem more complex than the one I found on the here on the forums.

#### skywatch #5
##### Nov 12, 2018, 11:49 am
I just did that and noticied I should clarify that that temp as required by this function must be provided in degrees F and not C.  Can be modified as follows if temp is provided in Celsius.
Tried this and although it allows degrees C for the conversion, the output is still in degrees F.

You need to take the output and -32 then * 0.5556 to get dew point in C.

Go Up