Monday, November 06, 2006

Calculating Relative Humidity in software

Humidity specifies the amount of water content in the atmosphere and relative humidity(RH) is a means of specifying it. Famous method to know relative humidity is comparing the readings of a dry and wet thermometer. This technique is known for even a school student. Actually RH is dependent on the atmosphere pressure also.

In many applications, there are requirements to monitor RH and it is easy if we apply this dry-wet bulb thermometer approach. One way of implementing this is by putting a 2D look up table where dry and wet thermometer readings are its indexes. But this approach will be cumbersome since it is difficult to include pressure vector too.

Best approach will be using the equation using which, we can find the RH directly. This is very reliable and requires less code space compared to earlier method. Looking at the practical implementation, just read the temperatures from dry and wet electronic thermometers and use those values to evaluate RH.

Equation for RH is,

A = 0.00066*(1+0.0011*Twet);
eSwet = exp((16.78*Twet - 116.9)/(Twet + 237.3));
ed = eSwet - A*Pr*(Tdry-Twet);
eSdry = exp((16.78*Tdry - 116.9)/(Tdry + 237.3));
RH = (ed/eSdry) * 100;

Where A is a correction factor and Pr = 101.325 is the normal sea level pressure.
Tdry and Twet are in celcius scale.

This equation can be implemented easily in 8051 or AVR or any other microcontroller without much effort and code space. Actually earlier I thought exponential functions will eat up my uC memory, but when I tried it, it works very fine!!!

This approach of making humidity sensor is cheaper than buying an electronic humidity sensor.

No comments: