Auckland Winter humidity problems

I’ve got a climate datalogger in my house here in West Auckland. Its based on an Etherten from Freetronics, which is an ethernet-enabled Arduino Uno compatible board. On that is sat a wing screw shield for easy connection of wires and on top of that is sat an Adafruit LCD shield showing the readings.

image

Inside or outside it are a DHT22 temperature and relative humidity sensor, a BMP085 air pressure and temperature sensor, a DS18B20 temperature sensor and a light dependent resistor. The sensors are polled every 20s and the data uploaded to Xively. The BMP temperature sensor reads a few degrees high because its inside the plastic box, exposed to the warmth from the circuitry. The DS18B20 generally reads a couple of degrees low because its hanging down the back of the shelves the logger sits on, away from ambient air movement (although this is, of course, still interesting [to me, anyway]). The whole affair runs off a 5V power supply connected by USB. 

Here’s a shot of the log from the last few days. The gap in the data is where the logger hung and had to be reset, by the way.

As you can see, after a series of cold, wet days- indicated by the small peaks in the ‘light’ plot at the top left- relative humidity climbs to nearly 100%. This is despite us leaving the heat pump and a pair of heaters running all night. This was not helped at all by the need to dry clothes inside when its too wet outside, adding to the moisture in the air.

As a consequence I now have mould growing on the shelves in my bedroom!

image

Yay, for houses with poorly fitting, single-glazed windows and no insulation!

Here’s the Arduino sketch, if anyone’s interest.

#include <SPI.h>
#include <Ethernet.h>
#include <HttpClient.h>
#include <Cosm.h>

// ! ! USB DEBUG OPTION ! !
int debug = 0;

// Sensor setup
#include “Wire.h”
#include “Adafruit_BMP085.h”
#include “DHT.h”
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

// MAC address for your Ethernet shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip (192,168,1,65); // Available Static IP address on your Network. See Instructions

// Your Cosm key to let you upload data
char cosmKey[] = “@@@@@ your key goes between the quotes here @@@@@@@”;

#define FEED_ID 76854;
unsigned long feedID = FEED_ID;

// Define the strings for our datastream IDs
char sensorID0[] = “BMPp”;
char sensorID1[] = “DHTh”;
char sensorID2[] = “DSt”;
char sensorID3[] = “light”;
char sensorID4[] = “BMPt”;
char sensorID5[] = “DHTt”;

CosmDatastream datastreams[] = {
CosmDatastream(sensorID0, strlen(sensorID0), DATASTREAM_FLOAT),
CosmDatastream(sensorID1, strlen(sensorID1), DATASTREAM_FLOAT),
CosmDatastream(sensorID2, strlen(sensorID2), DATASTREAM_FLOAT),
CosmDatastream(sensorID3, strlen(sensorID3), DATASTREAM_FLOAT),
CosmDatastream(sensorID4, strlen(sensorID4), DATASTREAM_FLOAT),
CosmDatastream(sensorID5, strlen(sensorID5), DATASTREAM_FLOAT),

};
// Finally, wrap the datastreams into a feed
CosmFeed feed(feedID, datastreams, 6 /* number of datastreams */);

EthernetClient client;
CosmClient cosmclient(client);

// LCD shield

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define WHITE 0x7

Adafruit_BMP085 bmp;
//
//// Data wire is plugged into which pin on the Arduino?
#define ONE_WIRE_BUS 6
//
//// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
//
//// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

#define DHTPIN 3 // what pin we’re connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);

float light;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setBacklight(WHITE);
lcd.print(“initialising”);

Serial.println(“Starting single datastream upload to Cosm…”);
Serial.println();

if (debug < 1 ) {

while (Ethernet.begin(mac) != 1)
{
Serial.println(“Error getting IP address via DHCP, trying again…”);
Serial.println(millis());
// lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Error getting IP”);
lcd.setCursor(0,1);
lcd.print(millis()/1000);
delay(5000);
}
}

// set pin modes to power sensors
pinMode(7, OUTPUT);
pinMode(5, OUTPUT);
pinMode(4, OUTPUT);
pinMode(2, OUTPUT);

digitalWrite(7, LOW);
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
digitalWrite(2, HIGH);

// initialise sensors
bmp.begin();
dht.begin();
sensors.begin();

delay(100);

}

void loop() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(millis()/1000);

// Get sensor readings
// BMP085
float BMPt = bmp.readTemperature();
float BMPp = bmp.readPressure() / 100.0;

// DHT22
float DHTh = dht.readHumidity();
float DHTt = dht.readTemperature();

// DS18B20
sensors.requestTemperatures(); // Send the command to get temperatures
float DSt = (sensors.getTempCByIndex(0));

// get light
light = analogRead(0)/ 10.23;

datastreams[0].setFloat(BMPp);
datastreams[1].setFloat(DHTh);
datastreams[2].setFloat(DSt);
datastreams[3].setFloat(light);
datastreams[4].setFloat(BMPt);
datastreams[5].setFloat(DHTt);

if (debug > 0) {

/*———–( Show the values inside the streams for test/debug )—–*/
Serial.println(“—–[ Test: Check values inside the Streams ]—–”);
Serial.print(“BMPp: ”);
Serial.println(datastreams[0].getFloat()); // Print datastream to serial monitor
Serial.print(“DHTh: ”);
Serial.println(datastreams[1].getFloat()); // Print datastream to serial monitor
Serial.print(“DSt: ”);
Serial.println(datastreams[2].getFloat()); // Print datastream to serial monitor
Serial.print(“light: ”);
Serial.println(datastreams[3].getFloat()); // Print datastream to serial monitor
Serial.print(“BMPt: ”);
Serial.println(datastreams[4].getFloat()); // Print datastream to serial monitor
Serial.print(“DHTt: ”);
Serial.println(datastreams[5].getFloat()); // Print datastream to serial monitor
delay(2500);
}

if (debug < 1) {
Serial.println(“Uploading to Cosm”);
lcd.clear();
lcd.setCursor(0,1);
lcd.print(“sending to COSM”);
int ret = cosmclient.put(feed, cosmKey);

Serial.print(“COSM client returns: ”); // Get return result code, similar to HTTP code
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“COSM client”);
lcd.setCursor(0,1);
lcd.print(“returned: ”);
Serial.println(ret);
lcd.print(ret);
Serial.println();
delay(500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“BMPp: ”);
lcd.print(BMPp);
lcd.setCursor(0,1);
lcd.print(“BMPt: ”);
lcd.print(BMPt);
delay(3500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“DHTh: ”);
lcd.print(DHTh);
lcd.setCursor(0,1);
lcd.print(“DHTt: ”);
lcd.print(DHTt);
delay(3500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“light: ”);
lcd.print(light);
lcd.setCursor(0,1);
lcd.print(“DSt: ”);
lcd.print(DSt);
delay(3500);
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.