Climate control on Arduino
Recently, a lot of posts about the construction of air quality monitors have appeared on Habré. At the same time, I did not find a single attempt to control air quality, and as soon as we move from passive monitoring to active management, a lot of interesting problems and solutions arise. I want to share my modest achievements in this area.
So, it is given: The garage is unheated, not insulated, a two-story brick with great humidity inside, from which the wooden floor decays, on the walls in the winter there is a snow coat and other unpleasant rust.
Task: “Drain” the garage.
Decision. We will not go into details of the capillary suction of water with concrete and other sources of moisture in the air of the garage - we will focus on what we can do with the moisture that has already appeared. If you do not consider appliances that are too expensive for the garage, such as dehumidifiers, then the only way I found is to displace the internal moist air with the drier outside with a simple fan.
Arduino, two DHT22 sensors inside and out, a relay module on the fan and really interesting problems begin.
As you know, DHT22 gives off temperature and relative humidity. How to compare sensor readings? Is the outside air “drier” than the inside? What will happen to the air if it is sucked into the garage? Perhaps it is so warmer that even with lower relative humidity outside it will produce condensation on the walls inside. The internal temperature always differs from the outside, but gradually tends to the outside. The degree of "gradualness" is unknown. Whether the temperature rises or falls is also unknown.
The first thought was to try to build arrays of sensor readings and try to predict the effect of outside air on the inside, but a bunch of drawn papers did not allow me to build an intelligible model in my head for implementation.
But the following idea came. Absolute humidity is even absolute, which does not depend on pressure, temperature and other things. And if the absolute humidity of the outside air is lower than the absolute humidity of the inside, then the outside air is definitely “drier” and no matter how its internal temperature changes, it is “better” than the replaced air.
An idea is an idea, but even here there were minor problems. It turns out that the absolute humidity is calculated by temperature and relative humidity according to graphs such as this:

And there is no exact way to recalculate. But there is a fairly wide variety of approximating formulas. As a result, this formula was chosen , or rather formulas, since the formulas are different for positive and negative temperatures.
It would seem that is all. Compare two absolute humidity and if it is “drier” outside - turn on the fan, but it wasn’t there. The first problem is that if you imagine that the outside air has constant humidity, but there is no moisture inside, but there is raw air, when pumping through the garage, the outside air will mix with the air there and the inside humidity will endlessly approach the outside. but will not reach it or will reach very soon. And this is extremely inefficient in electricity. The obvious solution is to introduce some kind of humidity difference, upon reaching which the fan is turned off and the internal air is considered dry, but here a second problem arises. With a temperature difference of +30 to -30, the absolute humidity value changes a thousand times. That is, at -30 degrees, the difference is 0. 001 grams per cubic meter of air can mean that you will pass the dew point and a fur coat will fall on the walls. And at +30, this thousandth means nothing, because 20 grams of water can hang in a cubic meter.
No clear, well-grounded solution was invented. With a strong-willed scientific poke, the difference was taken at 0.01 grams per cubic meter for the reason that there is not much harm from the frost on the walls, because when the temperature rises, when the robot is working, the ice will simply sublimate and will be removed with the rest of the air. And for empirical reasons, another energy-saving limitation was introduced. With a relative outside humidity above 90%, outside air is not pumped. Just because it is an abnormally high humidity for our region, and even if this air is drier than the inside, it will be very soon and it will also have to be pumped out. The figure is 90% also from the ceiling.
Result.
A year and a half the robot plows non-stop.

Arduino in a box with a gun, there is also a power supply. On it is the right internal sensor. Relay box in the socket itself. The switch forces the fan to bypass the relay. A winter fur coat disappeared. The tree has all dried up. Nothing rots. It consumes about two kilowatt-hours per month. If you breathe in the “dry” garage for about 15 minutes - the robot turns on the fan. In general, everything works.
Side effect - freezes. Moreover, it is freezing so that a fur coat from hoarfrost now periodically appears outside, and in May, when the sun is shining and the grass is green, it shakes from the cold without a padded jacket.
Field for optimization. If you screw the SD-card and collect statistics - you can choose a more reasonable cut-off than 90%. You can think and put the difference in absolute humidity on the cutoff depending on temperature.
And now the most interesting thing is development.
A ventilation system with recovery for a private house is being developed. The task is to reduce energy consumption for both ventilation and heating. It would seem that everything is simple. CO2 sensors in rooms. We only ventilate the room where we “breathed”, but there are a lot of questions for which I have no answers yet. I will be glad to help.
1. How to control the outflow through the stove? There is a chastotnik on the supply fan, there is on the exhaust fan. If it weren’t for the stove, one could do one and turn the fans synchronously. But what about the outflow through the furnace? (Separate duct for inflow of the furnace - not to offer);
2. (excluding the stove) Fan rotation control algorithm? The current idea is that the rotation speed should not depend on the concentration of CO2, but on the rate of increase in concentration. That is, if the concentration increases - the momentum grows, falls - and some kind of cutoff, say, 500-600ppm falls. Increasing the cutoff, you can enter the winter economy mode with an increased concentration of CO2;
3. There is a desire to tie the stove shutter to the CO sensor, in the sense that it keeps the shutter as closed as possible for the maximum amount of time, but it is scary;
4. A purely technical question: how can all this sensory magnificence be cheaply hung around the house, because for the purposes of heating control there will also be DHT22 in each room?
Thanks for attention. I didn’t draw the robot’s scheme, I’ll send the sketch to everyone, I will gladly accept the constructive proposals.
So, it is given: The garage is unheated, not insulated, a two-story brick with great humidity inside, from which the wooden floor decays, on the walls in the winter there is a snow coat and other unpleasant rust.
Task: “Drain” the garage.
Decision. We will not go into details of the capillary suction of water with concrete and other sources of moisture in the air of the garage - we will focus on what we can do with the moisture that has already appeared. If you do not consider appliances that are too expensive for the garage, such as dehumidifiers, then the only way I found is to displace the internal moist air with the drier outside with a simple fan.
Arduino, two DHT22 sensors inside and out, a relay module on the fan and really interesting problems begin.
As you know, DHT22 gives off temperature and relative humidity. How to compare sensor readings? Is the outside air “drier” than the inside? What will happen to the air if it is sucked into the garage? Perhaps it is so warmer that even with lower relative humidity outside it will produce condensation on the walls inside. The internal temperature always differs from the outside, but gradually tends to the outside. The degree of "gradualness" is unknown. Whether the temperature rises or falls is also unknown.
The first thought was to try to build arrays of sensor readings and try to predict the effect of outside air on the inside, but a bunch of drawn papers did not allow me to build an intelligible model in my head for implementation.
But the following idea came. Absolute humidity is even absolute, which does not depend on pressure, temperature and other things. And if the absolute humidity of the outside air is lower than the absolute humidity of the inside, then the outside air is definitely “drier” and no matter how its internal temperature changes, it is “better” than the replaced air.
An idea is an idea, but even here there were minor problems. It turns out that the absolute humidity is calculated by temperature and relative humidity according to graphs such as this:

And there is no exact way to recalculate. But there is a fairly wide variety of approximating formulas. As a result, this formula was chosen , or rather formulas, since the formulas are different for positive and negative temperatures.
It would seem that is all. Compare two absolute humidity and if it is “drier” outside - turn on the fan, but it wasn’t there. The first problem is that if you imagine that the outside air has constant humidity, but there is no moisture inside, but there is raw air, when pumping through the garage, the outside air will mix with the air there and the inside humidity will endlessly approach the outside. but will not reach it or will reach very soon. And this is extremely inefficient in electricity. The obvious solution is to introduce some kind of humidity difference, upon reaching which the fan is turned off and the internal air is considered dry, but here a second problem arises. With a temperature difference of +30 to -30, the absolute humidity value changes a thousand times. That is, at -30 degrees, the difference is 0. 001 grams per cubic meter of air can mean that you will pass the dew point and a fur coat will fall on the walls. And at +30, this thousandth means nothing, because 20 grams of water can hang in a cubic meter.
No clear, well-grounded solution was invented. With a strong-willed scientific poke, the difference was taken at 0.01 grams per cubic meter for the reason that there is not much harm from the frost on the walls, because when the temperature rises, when the robot is working, the ice will simply sublimate and will be removed with the rest of the air. And for empirical reasons, another energy-saving limitation was introduced. With a relative outside humidity above 90%, outside air is not pumped. Just because it is an abnormally high humidity for our region, and even if this air is drier than the inside, it will be very soon and it will also have to be pumped out. The figure is 90% also from the ceiling.
Result.
A year and a half the robot plows non-stop.

Arduino in a box with a gun, there is also a power supply. On it is the right internal sensor. Relay box in the socket itself. The switch forces the fan to bypass the relay. A winter fur coat disappeared. The tree has all dried up. Nothing rots. It consumes about two kilowatt-hours per month. If you breathe in the “dry” garage for about 15 minutes - the robot turns on the fan. In general, everything works.
Side effect - freezes. Moreover, it is freezing so that a fur coat from hoarfrost now periodically appears outside, and in May, when the sun is shining and the grass is green, it shakes from the cold without a padded jacket.
Field for optimization. If you screw the SD-card and collect statistics - you can choose a more reasonable cut-off than 90%. You can think and put the difference in absolute humidity on the cutoff depending on temperature.
And now the most interesting thing is development.
A ventilation system with recovery for a private house is being developed. The task is to reduce energy consumption for both ventilation and heating. It would seem that everything is simple. CO2 sensors in rooms. We only ventilate the room where we “breathed”, but there are a lot of questions for which I have no answers yet. I will be glad to help.
1. How to control the outflow through the stove? There is a chastotnik on the supply fan, there is on the exhaust fan. If it weren’t for the stove, one could do one and turn the fans synchronously. But what about the outflow through the furnace? (Separate duct for inflow of the furnace - not to offer);
2. (excluding the stove) Fan rotation control algorithm? The current idea is that the rotation speed should not depend on the concentration of CO2, but on the rate of increase in concentration. That is, if the concentration increases - the momentum grows, falls - and some kind of cutoff, say, 500-600ppm falls. Increasing the cutoff, you can enter the winter economy mode with an increased concentration of CO2;
3. There is a desire to tie the stove shutter to the CO sensor, in the sense that it keeps the shutter as closed as possible for the maximum amount of time, but it is scary;
4. A purely technical question: how can all this sensory magnificence be cheaply hung around the house, because for the purposes of heating control there will also be DHT22 in each room?
Thanks for attention. I didn’t draw the robot’s scheme, I’ll send the sketch to everyone, I will gladly accept the constructive proposals.