case -1: Serial.println("Sensor 0 Checksum
error"); break;
case -2: Serial.println("Sensor 0 Time out
error"); break;
default: Serial.println("Sensor 0 Unknown
error"); break;
}
Serial.print("Sensor 0 Humidity (%): ");
Serial.println((float)DHT220.humidity, DEC);
Serial.print("Sensor 0 Temperature (°C): ");
Serial.println((float)DHT220.temperature, DEC);
Serial.print("Sensor 0 Temperature (°F): ");
Serial.println(DHT220.fahrenheit(), DEC);
Serial.print("Sensor 0 Temperature (°K): ");
Serial.println(DHT220.kelvin(), DEC);
Serial.print("Sensor 0 Dew Point (°C): ");
Serial.println(DHT220.dewPoint(), DEC);
Serial.print("Sensor 0 Dew PointFast (°C): ");
Serial.println(DHT220.dewPointFast(), DEC);
Serial.print("Read sensor 0: ");
int chk1 = DHT221.read();
switch (chk1)
{
case 0: Serial.println("Sensor 1 OK"); break;
case -1: Serial.println("Sensor 1 Checksum
error"); break;
case -2: Serial.println("Sensor 1 Time out
error"); break;
default: Serial.println("Sensor 1 Unknown
error"); break;
}
Serial.print("Sensor 1 Humidity (%): ");
Serial.println((float)DHT221.humidity, DEC);
Serial.print("Sensor 1 Temperature (°C): ");
Serial.println((float)DHT221.temperature, DEC);
Serial.print("Sensor 1 Temperature (°F): ");
Serial.println(DHT221.fahrenheit(), DEC);
Serial.print("Sensor 0 Temperature (°K): ");
Serial.println(DHT221.kelvin(), DEC);
■ FIGURE 15: Two DHT22s on handheld prototyper.
Serial.print("Sensor 1 Dew Point (°C): ");
Serial.println(DHT221.dewPoint(), DEC);
Serial.print("Sensor 1 Dew PointFast (°C): ");
Serial.println(DHT221.dewPointFast(), DEC);
delay(2000);
temperature and humidity both inside and outside of the
castle. We will look at an algorithm in a moment that lets
us set trip points so our attic fan (Figure 14) will come on
and draw fresh air through the vent box (refer back to
This provides the data to the serial monitor shown in
Figure 13.
Figures 1 and 2) to provide us with inexpensive cooling or
heating as needed.
Fresh Air Controller Design
We hook up the I2C mini terminal part of the
handheld prototyper as shown in Figures 15 and 16. This
combines the Arduino proto shield and the I2C mini
terminal into the handheld prototyper used in this system.
In order to control the fresh air, we need to know the
The I2C mini terminal will let the user see the various
September 2013 75