This is the algorithm I came up with for
deciding whether to turn the fan on or off,
based on the above variables:
humidityOutdoor
tempOutdoor
tempLow
// Run the algorithm
if(humidityOutdoor >= setHumidity)
{
fanState = 0;
}
else if( (tempOutdoor > setTempLow) &&
(tempOutdoor < tempIndoor) &&
(setTempLow != -1))
{
fanState = 1;
}
else if( (tempOutdoor < setTempHigh) &&
(tempOutdoor > tempIndoor) &&
(setTempHigh != -1))
{
fanState = 1;
}
else
{
fanState = 0;
}
setFan(fanState);
■ FIGURE 16: Fresh air controller schematic view.
Please note that in the above code the
else if statement should be all on one line in
the Arduino code. I split it up here for
readability.
temperature and humidity parameters on the LCD, and
input temperature and humidity setpoints using the keys
to select from menu items on the LCD.
First, we check to see if the humidity outdoors is
greater than the set humidity (meaning it is raining). If so,
we turn the fan off.
The Fresh Air Controller Algorithm
Next, we check to see if the temperature outdoors is
greater than our low temperature setting AND that the
temperature outdoors is less than the indoor temperature,
The tasks for the fresh air controller seem fairly simple
when you first think about them. If it is too warm indoors
and cooler outdoors, you turn on the attic fan. If it is too
cold indoors and warmer outdoors, you turn on the attic
fan. If the attic fan is on and it starts to rain, you turn off
the attic fan.
AND that the user has set the low temperature. If all that
is true, we turn the fan on.
Then, we check to see if the temperature outdoors is
less than our high temperature setting AND that the
temperature outdoors is greater than the indoor
temperature, AND that the user has set the high
temperature. If all that is true, we turn the fan on.
What you need is for the user to specify what is 'too
warm' and 'too cold,' then let the computer logic do the
rest. First, you will want to get the user to specify the
following values:
Finally, if none of that is true, we turn the fan off.
Did I say 'fairly simple'? Well it is, but it took me a
while to get my head around the logic. Maybe that says
something about my head?
setHumidity
setTempLow
setTempHigh
Then, you have the Arduino read the DHT22 for the
following values:
Next month, we will see how to complete the design
for this handheld prototyper project using the I2C mini
terminal to display the fresh air controller data on the LCD
and get user feedback from the keys. NV
76 September 2013