# Humidity controlled bathroom dryer during and after showering or sauna

• I have arduino sensor measuring humidity of my bathroom with DHT22, alongside with an existing old mechanical humidity limit sensor (that is now used for backup in the logic). I have hooked the node also to booster mode switch of the air ventilation unit of the house and using weather sensor for reference outside humidity. The idea is to replace the mechanical "sensor" with a bit more intelligent logic that takes into account the weather outside and if it is too humid outside (hot summer) ventilating the bathroom does not reduce the internal humidity.
All works good, except that I need to implement calculation of the mathematical formula for converting the outside relative humidity when the air is warmed up by the ventilation unit since the temperature changes the relative humidity value - non linearly.
The "real" formula is too complex for PLEG math so I probably need to make linear approximation to simplify the math for the logic.

• @samppa

how about converting to Dew Point:

``````// dewPoint function NOAA
// reference (1) : http://wahiduddin.net/calc/density_algorithms.htm
//
double dewPoint(double celsius, double humidity)
{
// (1) Saturation Vapor Pressure = ESGG(T)
double RATIO = 373.15 / (273.15 + celsius);
double RHS = -7.90298 * (RATIO - 1);
RHS += 5.02808 * log10(RATIO);
RHS += -1.3816e-7 * (pow(10, (11.344 * (1 - 1/RATIO ))) - 1) ;
RHS += 8.1328e-3 * (pow(10, (-3.49149 * (RATIO - 1))) - 1) ;
RHS += log10(1013.246);

// factor -3 is to adjust units - Vapor Pressure SVP * humidity
double VP = pow(10, RHS - 3) * humidity;

// (2) DEWPOINT = F(Vapor Pressure)
double T = log(VP/0.61078);   // temp var
return (241.88 * T) / (17.558 - T);
}

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

• @BulldogLowell
Good idea, but the outside temp and humidity comes from weatherundeground "sensor", so I have to do the dew point math in Vera3 with PLEG and there are no math functions like pow or log available. The Arduino sensor node that reports the bathroom humidity and temp does not know the outside temp or humidity values..

Another workaround would be to install another DHT22 humidity sensor for the warmed up air to avoid the calculation altogether.. But I like the idea that some sensor data can also be calculated and estimated instead of measuring everything yourself

• @samppa

So... use mySensors to fetch the values from Vera!

• @BulldogLowell
You mean that I could request data from other sensors? How, and is that reliable?

• @samppa

Try pushing from vera by creating a scene that runs regularly (e.g. every 5 minutes) and insert this luup code:

``````local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 60)  -- 60 is the device id of the WeatherUnderground 'sensor'
luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_1", value=temp}, 85) -- 85 is the device id of the node to which you are transmitting
``````

you have to modify the parameters, of course, but you get the picture....

• @BulldogLowell said:

@samppa

Try pushing from vera by creating a scene that runs regularly (e.g. every 5 minutes) and insert this luup code:

``````local temp = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 60)  -- 60 is the device id of the WeatherUnderground 'sensor'
luup.call_action("urn:upnp-arduino-cc:serviceId:arduino1", "SendCommand", {radioId="11;3", variableId="VAR_1", value=temp}, 85) -- 85 is the device id of the node to which you are transmitting
``````

you have to modify the parameters, of course, but you get the picture....

Thanks I will try that. What should be the radioId="11;3", variableId="VAR_1" values?

Is there a direct pull/request method? (But in that case I would have to hard code the child id to the code, or store it to variable container if that could be requested too..)

• @samppa

this example shows how to receive the data

look at the getVariables() function and take notice of:

``gw.begin(getVariables, RADIO_ID, false);``

• I know it's not the answer to your question, but it might be a solution to your problem In my bathroom i am monitoring the hot-tap temperature (actual the supply line which is at the attick in my situation). Once it goes above 40ΒΊ C my fan starts. This fan then continues running even if I stop showering as the pipe doesn't cools down rather slowly. Once the hot-tap pipe has gone below 35ΒΊC the fan is stopped. Using a sensor on the hot-tap and a actuator (relay) for the fan.
I have been using humidity sensors for this purpose before and found them not to be very reliable on the long term (lasted less than 1 year working) . Thus this solution which is practical and very robust.

Regards,

Boozz

• @boozz

Nice workaround, but I already have hot tap sensor, but that is used to keep the pipe always hot by controlling an auxiliary pump used to circulate hot water when not showering so that when opening the shower I do not have to wait long time before getting hot water since the pipes are quite long from the boiler.

• @samppa There is a article (in Russian, unfortunately) where solved almost exactly this problem. (Ventilation of garage)
http://habrahabr.ru/post/244135/
If you wish i can try to translate, but basic idea of algorithm is to calculate absolute humidity for inside and outside, compare and turn ventilation if inside absolutely humidity bigger than outside with threshold 0.01 gram/m3. Also, if outside relative humidity is large than 90% ventilation does not performed, because it happen in very unusual case, like heavy rain outside, and ventilation in this case is pointless.

• @samppa

I agree, In that case it cannot be used, or the pipe from the circulation pipe to your shower should have some significant length.

BTW, although you may think it's useless (or at least less effective) when the outside humidity is higher than the interior humidity to use a fan, I think it is not (always). Depends on where the fresh air comes from (probably somewhere from the house were it is not as humid as in your bathroom....)
As long as you're able to get the humid air flowing to a place somewhere outside (using your fan) and the fresh air is less humid than in your bathroom it does have the effect you're looking for, even when it's raining outside!

Boozz

• @doctor64 said:

@samppa There is a article (in Russian, unfortunately) where solved almost exactly this problem. (Ventilation of garage)
http://habrahabr.ru/post/244135/
If you wish i can try to translate, but basic idea of algorithm is to calculate absolute humidity for inside and outside, compare and turn ventilation if inside absolutely humidity bigger than outside with threshold 0.01 gram/m3. Also, if outside relative humidity is large than 90% ventilation does not performed, because it happen in very unusual case, like heavy rain outside, and ventilation in this case is pointless.

The absolute humidity idea seems simple and the formula is straightforward.

The only issue left is how to request data from other sensor so that calculation could be done in one node. @BulldogLowell suggested pushing the data, but that looks a bit complicated..

• @boozz

In my case the fresh air comes always from outside and through the ventilation unit where it is warmed up. @doctor64 got the point that in rare cases like hot summer rain the outside humidity makes ventilation pointless, or actually it makes the ventilation run full speed overnight since it does not dry the air.

By the way, thanks for everyone for great comments!

• @samppa Seems like high humidity in bathroom is a common problem, because i also plan to implement exactly this thing.
But, because i can't pump fresh air from outside, i live in multi apartment building, so i pump humid air from bathroom into existing ventilation system.
I think about just add second sensor to same node and check humidity in corridor, or may be use "dumb" node, there all calculations and decision about turning on/off the fan made at controller, OpenHab in my case. So i can take into account time of day, for example - i don't want to hear noise from the fan in the middle of night.

• @doctor64
Ok, so you can do the logic in controller. I use Vera as the controller and PLEG for the logic, but it seems there is not enough math functions available for the dew point or absolute humidity calculations..

• @samppa Sorry, i am not familiar with Vera and PLEG. As last resort, you can use OpenHab with Vera - i'm think Vera is ZWave controller?

• @samppa

yes, but you saw the little point functions your arduino is very capable of, yes?

if you post your attempt at a sketch to control your fan (or even pseudo code) we can certainly help you code it up for Vera.

37

6

9

17

6

3

6

7