Pages: [1]   Go Down
Author Topic: HIH-4030 Humidity Sensor and Arduino  (Read 1234 times)
0 Members and 1 Guest are viewing this topic.
Portugal
Offline Offline
Newbie
*
Karma: 0
Posts: 5
UA-TM & UBI-TSI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

In the old forum, I found this topic:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267245927

Indicating how to convert the values ​​in% RH, dewpoint and humidex.
But the function to convert dewpoint, I get an error, which is a value added and multiplied, what is the correct formula to get it?

Code:
dewpoint = (237,7*(17.271*((temp-32)*5/9))/(237.7+*((temp-32)*5/9)+log(RH/100))/(17.271-(17.271*((temp-32)*5/9))/(237.7+*((temp-32)*5/9)+(log(RH/100)));
// the numbers are constants, RH =relative humidity, temperature must be in C

Thanks, smiley-wink
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5152
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This code is syntactically incorrect. I simplified it a little and added the necessary braces at the end, although I don't know if this calculates the correct value (I haven't studied the wikipedia article).

Code:
  float tempC = 25.7;
  float temp = (tempC -32) * 5 / 9;
  float RH = 35.9;
  float dewpoint = (237.7*(17.271*temp)/(237.7*temp+log(RH/100))/(17.271-(17.271*temp)/(237.7*temp+(log(RH/100)))));

This at least compiles. I took out the recurring calculation of the temperature in Fahrenheit and made it before the dewpoint calculation.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You may also want to try:

Code:
const float
tempC = 25.7,
temp = (tempC - 32) * 5/9,
logRH = -1.024433, // ln(35.9/100)
a = 17.271,
b = 237.7,
y = a*temp/(b + temp) + logRH,
Td = b*y/(a - y);
« Last Edit: June 20, 2012, 04:58:08 pm by Reinderien » Logged

Portugal
Offline Offline
Newbie
*
Karma: 0
Posts: 5
UA-TM & UBI-TSI
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This code is syntactically incorrect. I simplified it a little and added the necessary braces at the end, although I don't know if this calculates the correct value (I haven't studied the wikipedia article).

Code:
 float tempC = 25.7;
  float temp = (tempC -32) * 5 / 9;
  float RH = 35.9;
  float dewpoint = (237.7*(17.271*temp)/(237.7*temp+log(RH/100))/(17.271-(17.271*temp)/(237.7*temp+(log(RH/100)))));

This at least compiles. I took out the recurring calculation of the temperature in Fahrenheit and made it before the dewpoint calculation.

For this formula, the result I get is 0.00.
I used this formula, but I can not confirm if the values ​​are correct.

Code:
float aux = (log(RH / 100) + ((17.27 * temperatureC) / (237.3 + temperatureC))) / 17.27;
  float dewpoint = (237.3 * aux) / (1 - aux);

The values ​​that I'm getting are:

Code:
24.22 *C   75.59 *F   43.69 %RH   11.09 dew point *C   18.66 Humidex

Can you confirm if I'm right?

You may also want to try:

Code:
const float
tempC = 25.7,
temp = (tempC - 32) * 5/9,
logRH = -1.024433, // ln(35.9/100)
a = 17.271,
b = 237.7,
y = a*temp/(b + temp) + logRH,
Td = b*y/(a - y);

In this calculation, it seems to me you were to ignore the value of the logarithm of %RH.
But I'm not sure.

thanks for your help,
« Last Edit: June 21, 2012, 09:45:10 am by Jay_OR » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In this calculation, it seems to me you were to ignore the value of the logarithm of %RH.

In your code, %RH was a constant, so log(RH/100) is also a constant. Since log is an expensive operation, it might as well be pre-computed.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13742
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


from - http://arduino.cc/playground/Main/DHT11Lib - the NOAA reference algorithm and the fast variation

Code:
// 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;
}
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I took out the recurring calculation of the temperature in Fahrenheit and made it before the dewpoint calculation.


nice to meet you guys here to share the beautiful life with so many people.
Rc Helicopter|
Mini Rc Helicopter Reviews|
Rc Hobby Stores
Logged

Pages: [1]   Go Up
Jump to: