Humidistat for ventilation

I am new to Arduino, so I hope somebody can help me. I want to control a ventilation fan for my basement. There are lots of similar threads about humidistats, but my control needs to be a little more complicated. I want the fan to switch on if the basement relative humidity (RH) is greater than 60% but only if the external RH is at least 10% less than the basement RH. The fan is about 30 feet from the external wall, so one of the sensor wires will be about the same length.

My questions are:

  1. What type of sensor should I use (1-wire or otherwise);
  2. How should I compare the RHs - with an op amp voltage comparator circuit, or should I use two inputs of the Arduino board.

Thanks, Juliet

I don't know anything about the sensors, but computers (and microcontrollers) are really good at math! :wink: So, I'd do the comparison (and the 60% threshold) in software.

Take a look at the "DHT11" (or 22) sensors.

Hi Juliet,

How did it go with the project?

I have never worked with arduino, but I am just about to order the pieces for a similar project.

My problem is that ventilation in the summer brings hot humid air into the colder, poorly isolated basement, which means that the water condenses on the walls and increases the humidity with all colourfull kinds of fungi as a bonus. I could of course invest in a dehumidifier, but that uses a lot of power.

It sounds like you have the same aim: only ventilate, when it would decrease the humidity. However, since most sensors (like the DHT11) measures the relative humidity, I think you will also need to take the temperature into account (which DHT11 also measures). The relative humidity gives the amount of water in the air compared to saturation at the given temperature, but for instance at 21 degree C. the air can hold roughly twice the amount of water as at 10 degree C. I would therefore compare the actual partial pressure of water vapor inside and outside to determine when to ventilate. This can be calculated from the relative humidity and the temperature. In theory this is also affected by the air pressure, but this should be of minor importance. You can read more about how to do the calculations here: Moist Air - Relative Humidity

Best wishes

DHT11 or 22 is indeed a cheap sensor to get started with. Check - Arduino Playground - DHTLib -
Furthermore you should use a relay board or so to switch the FAN

your main application will look like this:

#include <dht.h>

dht DHT;

// pin numbers (exmple
const int inside = 4;
const int outside = 5;
const int fan = 8; 

void setup()
{
  Serial.begin(115200);
  Serial.println("FAN PROGRAM 1.0");
  Serial.println();
}

void loop()
{
  // READ SENSORS
  DHT.read11(inside);
  int insideTemp = DHT.temperature;
  int insideHum = DHT.humidity;

  // read the second sensor in a similar way


  // DEBUG
  // optionally print some value for debugging
  Serial.print(insideTemp);
  Serial.print("\t");
  Serial.print(insideHum);
  Serial.println();

  ...

  // switch on/off fan
  if (insideHum > 60 && insideHum > outsideHum + 10)
  {
    // switch the fan on
  }
  else
  {
    // switch fan off
  }

  delay(60000L);  // wait for a minute, so the system will not switch too often
}