Tuesday, December 30, 2008

Results! and progress in the logging!

So finally I managed to write about the results of my logging experiment!

I didn't get to collect much data before a considerable portion of the attic was insulated, but nevertheless I guess it is enough to get a rough idea that the stuff is at least doing something to prevent heat from escaping - at least it prevents drafts in the attic, which I guess is half way to improvement!

So here is a rundown of the results:

before the insulation: average of 4.8 degrees C difference between inside and outside
more than half installed: average of 6.5 degrees C difference between inside and outside
almost all of it installed: average of 8 degrees C difference between inside and outside

The split in the graphic corresponds to the moment when more than half the stuff was installed, so before the split is before the insulation, after the split is more than half installed. One can see that the graphic for the inside temperature in the second part is smoother than in the first part, even as outside temperatures drop further down!

These results have to take into account that the house below the attic is warmed up regularly (although to a low setting of 18 degrees C), but nevertheless, for the same outside temperature before and after I do see that the inside temperature is higher now. Also the variance of the inside temperature is much lower than the variance of the outside temperature, which was not the case before the insulation was applied.

Overall, I think it was worth the money and work invested.

Furthermore, and as an additional proof of the worthiness of the investment, I verified that I spent an amount of gas in December 2008 identical to December of 2007, while the average month temperature was 1.4 degrees Celsius lower, and I spent the whole month of December 2008 at home, whereas in 2007 we took 4 days of holiday.
My estimate is that the extra insulation gives me an extra 10% savings in gas consumption compared to the situation without.
Next Spring - Insulate the floor of the ground floor of the house!

On another subject, I was finding it strange that the temperature logger was not going below 0 degrees, so I decided to investigate. I placed the sensor in the freezer, and it did go to -16 before I took it out. I then figured that due to rounding, the temperature would need to be below -1.45 before the sensor and the arduino code would register a negative temperature of -1. All this due to the quantification in the A/D converter and integer logic.
SO I have decided to adapt the code to include a true low pass software filter (and an efficient one also, from the computational point of view) and work with one decimal place, so I managed to get better results! Send me a note if you are interested in the arduino code to do it.
It also includes 2 keys - Select and Reset - which allow you to navigate in a small menu showing the maximum and minimum temperatures, reset the max min log, and see how full the inside EPROM is.

I also included a low pass hardware filter - RC - but somehow it prevented the sensor from registering values below 0, so I took it off for the outside sensor. Still must investigate what went wrong!

There are some more news, but I'll keep that for the next post!

Saturday, November 1, 2008

What you can not measure you can not control

Or, what you did not measure you cannot evaluate, the latest being my own adaptation of the quote. So, as I mentioned in the last post, I am in the process of insulating the attic. Yes, it is still not finished. It is a lot of work and dirty work as well, as it involves crawling in the floor to unaccessible corners to staple the stuff.
I am using a material called Xlmat which is a reflective barrier together with standard wool insulation. it is 3cm thick and composed of 17 layers of materials - reflective layers, plastics and wool. Although as far as I understood you cannot really give a R value to a reflective barrier, I think I read somewhere that this material is equivalent to a material with R=6 (SI).
Meanwhile I have been doing some logging of the temperatures inside and outside the attic - see previous post - so that, as the title indicates, I can control and evaluate the effectiveness of the insulation.
After having the logging on and off for some time, it happened that things were not always working fine, with the contacts and strange values were being read. So I decided to add a display to see what was going on. So I bough a one line, 16 characters LCD and plugged it to the Arduino. Here is my current setup.

AH! almost forgot: plugged the wires for the in and outside lm35 wrong, so in is out and out is in :)

It appears that the display has some particularities, which I will elaborate upon in the next posts. I'll post a graphic with the results soon...but I think there are so many factors in play that I might not be able to conclude anything...While I was preparing this post, I came across this other quote:

"measure what is measurable, make measurable what is not: - Galileo

Sunday, October 26, 2008

Standalone temperature logger with Arduino

As I mentioned in the previous post, I am in the process of insulating the attic. Of course, that couldn't go without some sort of measurement to check the effect of said insulation. Therefore, I decided to check the temperature delta from the inside of the attic to the outside before applying the stuff, and after.
So yesterday I finally decided to connect an LM35 to an arduino board, and get it to log the temperatures. Of course, I needed 2 LM35 connected to it. Luckily, I had 2 around, from Joao (sorry for the lack of the tilde), and one of them was even already on a long lead, this from my initial attempts at reading temperature with the computer - Joao then built a parallel port temperature sensor interface.
I built the circuit in the figure using the arduino. The diode is to enable the setup to read negative temperatures, which was not yet necessary, but will be soon.
Since I didn't want to have a computer running all the time just for that I made the arduino store the values into the EPROM. There are 512 bytes in the EPROM, so, for 2 sensors I could have 256 measurements. I decided to get a measurement every 30 minutes, which would allow the setup to run for about 5 days before running out of place in the memory.
To read the contents of the EPROM, I had initially thought of having a switch which would indicate the mode to run in - log or report - , but went for the easier solution of dumping all the contents of the EPROM upon starting the arduino.

So, yesterday I placed the thing in the attic, tried to get the long sensor outside, didn't quite managed, but it was pretty close to be out in the cold.

This morning I couldn't resist: went to get it, downloaded the data and plotted it in Excel. I get a constant 2 degrees difference between the inside and the outside, which I think is very small, might explain why the house gets cold so quickly.

Here is the arduino code. It is not clean nor pretty, but seams to do the job:

* temperature logger
* reads and logs 2 temperature sensors to the EPROM


int refPin = 1; // select the input pin for the potentiometer
int potPin = 2; // select the input pin for the potentiometer
int potPin2 = 3; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
int ref;
int out;
int val2 = 0; // variable to store the value coming from the sensor
int out2;

int avout, avin;
int addr = 0;
int index = 0;
int outtemps[10];
int intemps[10];

int ledPin = 13; // LED connected to digital pin 13
int value = LOW; // previous value of the LED
long previousMillis = 0; // will store last time LED was updated
long logpreviousMillis = 0; // will store last time LED was updated
long interval = 1000; // interval at which to blink (milliseconds)
long loginterval = 1800000; // interval at which to log (milliseconds)

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT

Serial.println("ready to dump! data every 30 minutes");
Serial.println("address \t out \t in");

for (int in = 0; in<256; in++)

value = EEPROM.read(in*2);

Serial.print(value, DEC);
value = EEPROM.read(in*2 + 1);
Serial.print(value, DEC);



void loop() {
ref = analogRead(refPin); // read the value from the sensor
val = analogRead(potPin); // read the value from the sensor
val = val - ref;
val2 = analogRead(potPin2); // read the value from the sensor
val2 = val2 - ref;

outtemps[index] = out;
intemps[index] = out2;
if (index == 10)
index = 0;


// check to see if it's time to blink the LED; that is, is the difference
// between the current time and last time we blinked the LED bigger than
// the interval at which we want to blink the LED.
if (millis() - previousMillis > interval) {
previousMillis = millis(); // remember the last time we blinked the LED

// if the LED is off turn it on and vice-versa.
if (value == LOW)
value = HIGH;
value = LOW;

digitalWrite(ledPin, value);

//log the temperatures to the eprom
if (millis() - logpreviousMillis > loginterval) {
logpreviousMillis = millis(); // remember the last time we blinked the LED

avout = 0;
avin = 0;
for (int aa = 0; aa<10 ; aa++)
avout += outtemps[aa];
avin += intemps[aa];
avout = avout/10;
avin = avin/10;

EEPROM.write(addr*2, avout);
EEPROM.write(addr*2+1, avin);
addr = addr + 1;
if (addr == 256)
addr = 0;

Serial.print(" - ");

// if the LED is off turn it on and vice-versa.
if (value == LOW)
value = HIGH;
value = LOW;

digitalWrite(ledPin, value);


Friday, October 24, 2008

Just got my yearly report from the utilities company, and once again managed to get some money back by saving energy! In the last 2 years I have reduced my energy consumption by about half! From almost 3500KWh in 2006 to a bit more than 1500KWh this year, and from almost 4000m3 of gas in 2006 to less than 2000m3 this year! You can see the graphics provided by the company that compare my consumption with that of the neighbors.

In terms of gas I am now at the same level as the neighbors, but most neighbors have smaller houses that I do...so I hope that that explains it...anyway, I am currently in the process of properly insulation the attic. More of that soon! Also in the plan is to acquire a new, more efficient boiler. I would like to get the consumption below the 1000m3/year.

In terms of electricity I don't really know what to do further to save electricity...

In the plans for this season is also to finally reuse rain water to flush the toilets. This year we spent about 90 liters of water per person per day. I would like to reduce that!

Monday, October 6, 2008

Hello again!

The door bell project is working in full swing! although not many people seem to ring it...next project: detect bangs from people using the door knock.

On another note, I got my wife a small tablet (wacom bamboo) and it is really nice! to celebrate, I decided to make a handmade schematic of my circuit to read the electricity meter. So here it is on the right. On the bottom is the LDR which has a value of about 20K ohm when in the dark and goes down to 200 or less in bright light. So I get the little LDR, which is about 3mm in diameter right in front of the blinking led on my new digital electric meter and every time it blinks the input of the arduino goes down, signaling one watthour having been consumed. The Arduino then communicates that to the computer which dumps the time into a database, from which I can then generate graphics and check consumption.
On the next post, and to try to improve my tablet skills, I'll describe the circuit used to read the gas meter.

Furthermore, I just got a new Arduino today, the Diecimila, ordered by Joao, so I'll try to get the thermometer and other environment variables going.

Wednesday, September 24, 2008

First ring!!

Finally someone rang the bell, besides me that is! Since I enabled the logging no one rang the bell, until today!

Yesterday I improved the web list of events to enable to remove the ones I have seen, so now each door bell ring appears as a link which, upon clicking is removed from the list. It does stay in the database (MySQL) and I will do a page to display the old ones.

The next step is the web cam taking pictures. I hacked a cheap web cam which couldn't handle the street - to bright - and the darkness, and turned it into a IR web cam, which works great at night with IR led illumination provided by a remote control. It still doesn't handle the street light that well, so I think I'll have 2 cameras: one visible for the day pictures, and an IR one for the nights...or I might try to find a decent web cam that can handle it all, and works with linux out of the box.

Update: Just finished getting the house to Twit, and report to twitter whenever anybody rings the bell! check it here! well, in fact it is not really real time, every hour it checks if anyone did and puts it to twitter, this because I switch the modems off whenever they are not in use. The script turn on the modems, reports to twitter and the modems get turned off again automatically after a few minutes.
As an extra it also reports to twitter if the electricity consumption was over 1Kwh in the last hour!

Monday, September 15, 2008

Computerized Door Bell

Finally I managed to get the door bell to be connected to the computer!! and make a schematic from it! I used a arduino shield that a friend lent me to check the functioning and then made a small board using those prototyping boards! I'll upload a photo later on! I drew the schematic using http://draw.labs.autodesk.com/ADDraw/draw.html

It was difficult to find a nice tool to make a schematic using free software...
Now, each time someone rings my bell, an entry gets added to a database. Nothing else happens yet, but the plan is to get a ring tone (stereo!!), but I found out that the audio out of the server is not enough to make noise via a small un-amplified speaker, so I am now investigating the possibilities!

I hope the transistor is the correct one - the library at the site doesn't have that many!

Friday, August 29, 2008


A long time has passed since that initial post...and indeed I managed to finalize the reading of the utility meters with an arduino connect to the home server.

I now have a real time graphic of each watt hour and each hundredst of cubic meter of gas used in the house. I did switch it off during the holidays, but the system was then synchronous with the numbers on the real meters. Enclosed is an image of the graphic for the last 24 hours of electricity usage.
When the winter comes and the gas starts burning, I hope that the gas graphic becomes more interesting. Now it only shows little bars when we take shower and cook.
I'll add the schematics soon.

Next step is to connect the doorbell to the server and broadcast to the network whenever someone rings, as well as taking a snapshot of course.

Tuesday, March 25, 2008


First post, now that I am about to finally automate the reading of the utility meters, and collected plenty of energy consumption data for the house, I thought it was the time to share a bit.

Also I finally seem to have caught up with 10 finger typing so I need some regular typing to keep it active.

So here goes some background. We bought the house where we currently live a bit more than 2 years ago, and having always been interested in energy efficiency I started measuring our energy consumption. I did this on a daily basis, (almost) every day, at 20:00, recorded the values on the electricity and gas meters - the water meter is not so accessible and I had less ideas to save water.

After the first year, using the standard basic manual Honeywell thermostat, I automated the central heating, implementing independent zone control for living room, sleeping room and kitchen, by means of some electronic controls and a server supervising the whole thing.

Either by using the system or by lowering the general set point, we saved about 40% on the energy bill!

I'll elaborate on the setup later on.

Plan for this summer: insulate the attic and possibly the floor, and, for saving water, use rain water for the toilets! It's been on my mind since we moved and it's about to happen...I hope.

But the closest goal is to do the data collection automatically, and we're almost there for electricity and gas. I hope to be ready by the weekend. I'll keep posting.