Tuesday, November 9, 2010

The Most Measured Fridge in the World

What would you measure about your fridge?

I wanted to measure Temperature and Energy Usage.

A few months ago, I used two 1-Wire DS18S20 Temperature sensors and OWFS to measure the temperature in the main fridge and the freezer compartment. It is a fairly standard and straightforward set-up which I am not going to cover here. I stick the readings in a MySQL database and produce graphs using gnuplot. Interesting in a very geeky way.

You can see the way behaviour such as leaving the door open for a minute or more can drastically effect the temperature. It can take over an hour go get to a stable temperature.

This is an average day. Not much activity. Quick opens and closes. There is a temperature spike in the freezer about 10 am. This happens about every 30 hours or so and I think this represents the automatic defrost function. This removes the requirement to have to defrost the fridge from time to time. Cool in my book.

The main reason for this article is to outline the process involved in installing a new Currentcost IAM (Individual Appliance Module) and how to extract the readings and process them.

I have using Currentcost sensors and display/receiver for a number of years to measure electricity consumption in my house.

I have a CC128 Display/Receiver Unit connected to a Linux computer which reads the XML output, parses it and stores it in a RRD database and a MySQL database.

I then use a few scripts to gather the data and product graphs which I display on a web page. Excellent stuff.

The set-up is based on the excellent write up on http://www.jibble.org/currentcost/.

So, after waiting for yonkity bonks for the Currentcost IAM to be released, I saw that they were available recently. They measure the energy usage of an particular appliance and send it to your receiver, in my case the CC128.

They are available on Amazon.co.uk for about £30. I am based in Dublin, so the postage was about £20. Feck I thought. My brother, who is also a Currentcost fan, bought 2 and posted it to me. Postage about £10, still to high. They need to do something about that.

Anyway, the time came to install one of the IAMs and set-up the logging and graphing processes. I had a look around but could not find much useful information about how to handle the extra sensors.

I found some information on the Currentcost site here http://www.currentcost.com/cc128/xml.htm. Not really much help though.

What I did at the end of the day, was just configure the new sensor and plugged in the fridge.

I watched the output from the CC128 and noticed, that there were two lines output. One was for the main energy sensor and the other one was from the new sensor.

Here is an example:



As you can see the lines are fairly similar. The first point of note is the sensor number 0 and 1. This was enough to discriminate between the sensors.

I then modified the data collection script as follows:
Original line
m!<ch1><watts>0*(\d+)</watts></ch1>.*<tmpr> *([\-\d.]+)</tmpr>!

had to be changed to

as in e.g.

#Sensor 0
if ($line =~ m!<tmpr>\s*(-*[\d.]+)</tmpr><sensor>0</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>!)
my $watts = $2;
my $temp = $1;
system("rrdtool update /var/www/html/currentcost/data/powertemp.rrd N:$watts:$temp");
system("./mysql_bit.sh $watts $temp");

#Sensor 1
if ($line =~ m!<tmpr>\s*(-*[\d.]+)</tmpr><sensor>1</sensor>.*<ch1><watts>0*(\d+)</watts></ch1>!)
my $watts1 = $2;
my $temp1 = $1;
system("rrdtool update /var/www/html/currentcost/data/powertemp_mod1.rrd N:$watts1:$temp1");
system("./mysql_module_bit.sh 1 $watts1 $temp1");

That was it basically. Everything worked.

Here is an average 4 Hour Graph and Usage of the fridge at the weekend. Some activity, not much.

Bloody hungry machines. It makes up a significant part of our electricity bill. Not much you could do except increase the general minimum temperature. Some research required, I think.

I think I will produce a daily Fridge Electricity Bill. I have done this for the house, based on Dale Lanes idea

If you need more information, leave a comment.

Tuesday, October 12, 2010

SheevaPlug Plug Computer Rises From the Ashes

I got a SheevaPlug Plug Computer over a year ago. I installed Fedora 12 on an SD card. Worked great.

I used it as part of my home automation set-up. I had 1-wire temperature and humidity sensors and a barometer running off it. I also had my Homeeasy 1-Wire remote control system running on it.

Anyway, one day I decided to tidy up the cabling in the area the plug computer lived. This also involved moving the plug computer to a new socket.

I powered it down in the correct manner and moved it. Plugged it back in and it did not come back on. Stuck an USB console on it and it was dead.

There was some furious work to port the 1-Wire scripts and functionality to another device. In this event, it was a Linksys NSLU2 which I had configured with OpenWRT a week earlier. Surprisingly, it was well capable of the job. It became my new 1-Wire controller.

I searched the forums and they were talking about the boot loader being corrupt. I followed that line of enquiry for a while and got nowhere. Still dead. All that would happen was there was flashing leds. No help.

I eventually found some talk about a dud power supply. I cracked the lid on it and tried my trusty multimeter. The result was that there was only 2.1 volts coming out of the power supply instead on 5 volts. Progress at last.

After a few snips, I was able to get a power supply from an old mobile phone soldered to the connector from the original power supply to power the motherboard of the plug computer. This was the business. The plug computer was back on the air.

The SD card was inadvertently pulled out of the plugcomputer while it was on and resulted in a crashed SD card. Feck again.

It was actually relatively easy to reinstall the Fedora 12 file system using the original Instructables article. Note to self, do a backup of the SD card this time.

I found some articles on repairing the original power supply but I decided not to go down that route.

There was also mention of www.globalscaletechnologies.com selling a replacement power supply. It turns out to be €7.54 but the delivery was €39.19. Way too much. The warranty from globalscaletechnologies was only for 1 month. I was fecked, so I said "feck that".

I found that there was a UK supplier http://www.newit.co.uk/ that had the power supply at a much more acceptable price around €20. Cool. I went about ordering it.

It arrived a few days later. The install was a breeze. Finished the set-up of SD install and off we went.


Everyone's a winner!.

Wednesday, July 21, 2010

Homeasy Remote PC Control - Linux & 1-Wire

As discussed previously, I am a big fan of the Homeeasy range of products.

I have quite a few in use around the house. 16 in total.

My first adventure in home automation involved some X10 devices. These were OK but were slow to respond and overall unreliable.

I had appliance and lighting modules, some bayonet modules, pir and remote controls. Also some wireless transceivers and a controller. Now all unused.

I then came across the Homeeasy range of products. I think my brother Peter introduced me to them. Fairly cheap, so I got a few of them.

Came across James @ Notes from a small field, who was talking about setting up an arduino to operate like a Homeeasy remote control.

After a bit of work and revision, I was able to get a working arduino/homeeasy rig working. Here is a link to that particular project: Simple/Manual Protocol Arduino/Homeeasy

The final version also contained an Ethernet shield and operated as a web server. Various commands were sent to the web server using the URL to pass parameters, which were picked up by the arduino. Very good actually. It has been running for almost a year now. No crashes.

So, it worked fairly well. It is about 80% effective. It was mainly used in the kitchen and there were some dead spots that were only about 10% effective. Don't know why. Swapped modules, etc., still dead spots. This would have been OK for me but not acceptable for SWMBO and the other house inhabitants.

As hinted above, this set-up only accounted for the transmission of the Homeeasy Simple Protocol. This is not compatible with all the Homeeasy range of products. They also use an Advanced Protocol for some of their devices, such as sockets and wall switches.

I wanted to use some of these switches and sockets, so I had to get a method to remotely control them.

Around that time, there was a lot of activity in the adruino homeeasy controller area.

There were a number of options available for Homeeasy Advanced Protocol programming on the arduino.

I tried many of them but found less then 100% reliability. Again some dead zones or sometimes it would work and sometimes it wouldn't. Definitely not acceptable.

During this journey, I noticed that the hand held remote was very reliable. I presume it was something to do with my implementation. Personally, I think there is an aerial issue. I don't know anything about that, so I parked this project and moved to another approach.

I read about using the actual Homeeasy hand held remote wired up to an arduino on Instructables and something similar in the Practical Arduino book.

Easy enough. I put it together and it worked perfectly. 100%

So, then I thought, the arduino is all very good, but all I am doing is using the arduino as a smart relay controller.

I have been using the Dallas 1-Wire devices for a number of years to read temperature and other weather readings. I also use a 1-Wire relay to control my boiler.

Using a schedule stored in a database, the boiler goes on and off as required. This is the subject of another post, I think.

I decided to use 1-Wire switches to control the hand held remote.

I got myself a breadboard some wires and a couple of DS2408 chips and my trusty USB 1-Wire controller.

Again following the wiring layout on Instructables - Arduino Home automation, got it all up and running in no time.

There are 4 on and 4 off buttons and the DS2408 has 8 switches.

To utilise the 4 zones, I needed another 4 switches. I used the other DS2408 for this.

The 1-Wire system is controlled from a Linux box on the network. I wrote a PHP script that presented me with various devices and On/Off buttons to control them.

I used OWFS (One Wire File System) suite of programs to talk directly with the 1-Wire switches.

Happy days.

Sunday, July 18, 2010

One of my mothers roses

My mother has always been a keen gardener. She had a very large garden, when she lived on the north side of Dublin. She moved to the Dark Side (south) about four years ago.

I remember, when I lived there during those eternal summers, having to work in the garden when all my friends were out playing. Possibly another blog.

The new garden was much much smaller then the previous one. Probably about one twentieth. She is pushing on a bit, so it is not too much of a problem having a smaller garden.

She was always a big fan of roses.

She has being building up a stock of roses over the past few years and was having great success with the blooms.

I often get a few rose blooms when I visit her. Some are really spectacular.

This is an example of the best yet.

Monday, June 14, 2010

I've found it. Ultimate Chilli Sauce / Salsa

After many years spent in the quest for the best Chili Sauce, I determined that the only way to find one is to make it myself.

There are basically at least two types, cooked and uncooked. I prefer the uncooked varieties, as they are usually sharper and more pungent in flavour.

I have tried many, from the US, Mexico, Africa and Asia.

Some I found were quite good but lacked the roundness in flavour I was searching for. Others were too mild or burned my face off. Not quite what I was looking for.

Anyway, I tried a number of recipes from books and the net. Not quite there.

I more or less stumbled on this one.

I bought two packets of fresh chillies in a local supermarket chain store (Dunnes Stores). This is often a bit suspect, as I am sure that they are just ordered from the suppliers, without respect to the heat they produce. In fact I bought some there a few months ago that were very very mild. The past few times I bought them they were nice and hot.

I don't have easy access to any Asian shops, so it is usually supermarket chillies or nothing.

OK. I bought my packets of chillies and did nothing with them.

They were getting a bit limp in the fridge, so I thought I better use them.

I searched in the cupboard for something suitable to make a chilli sauce with. I often use lime juice to add a bit of liquid and flavour. No limes. Feck, I said.

Found a large tin of Pineapple. Cool, I thought.

I am a big fan of Garlic, so I selected a whole bulb of it.

So, I had:

1 x Tin of Pineapple
1 x Bulb of Garlic
2 x Packets of fresh Chillies (Probably 10 or 12 in total)
1 x Blender

Peel the garlic and chop the chillies into large pieces.

Put the flesh of the pineapple into the blender. Reserve the juice/syrup. You may need the juice if the mixture is too dry.

Add a half to a full teaspoon of salt, depending on taste.

Add the chillies and garlic to the blender and zizz.

Blend until you get the consistency you like. I like it a bit chunky.

Add more juice if necessary.

Give it a taste.

Adjust seasoning.

Too Hot = Enjoy it. Or add another tin of pineapple.
Not hot enough = Add a teaspoon of chilli powder or more chillies.
Too much Garlic = Enjoy it.

I put the result into jars and store in the fridge.

Remember, this is an uncooked sauce, so all the crazy yeasts in the air will be trying to do rude things in the sauce. The fridge will take the lead out of their pencils. The worst that will happen, is that the sauce will ferment.

Love the Burn

Saturday, April 10, 2010

433mhz RF Radio Controller Wireless Remote Control

I picked up one of these gadgets recently on eBay. Pretty good, really.

It consists of a remote control and receiver module.

There are 4 buttons (A to D) on the remote that switches the lines on or off.

It works on a latch system. One press on, one press off.

While this action has its uses, I feel that it is a bit limited in a home automation scenario.

433mhz devices are not always 100% reliable. This frequency is heavily used by many devices and can cause interference.

So, you press a button and wonder, is the device still Off or On? Who the feck knows. Press it again and you are still in the same position. Did it turn On or Off???

I prefer systems that have specific On and Off buttons.

Anyway, this latch type of devices still have many uses.

An On/Off system can be easily designed. Button A = On, B = Off. The same with buttons C and D.

Or just 4 On buttons.

The receiver is fairly straightforward, as the image shows.

I had a bit of a problem with the pin outs. By receiver board had no pin legend. I was able to work out the pins of interest. Then I noticed that the advert had the pins labelled. Doh! I was correct anyway, so no problem.


* Channels: 4
* RF radio: 433MHz
* Operating range: up to 300m (984ft)
* Power: 4.5 – 7V
* Dimensions: 4.5 x 2cm (1.8 x 0.8”)
* Weight: 5g

Pin Assignment :

* D0: Output 0
* D1: Output 1
* D2: Output 2
* D3: Output 3
* GND: Ground
* VT: Switching voltage (will be transmitted to the corresponding output when pressing a button)
* VCC: Supply Voltage

I wired it up and it works.

I connected it to a 1-Wire Switch, a DS2408.

The DS2408 is a very versatile device. While it can be used as a switch, it can also be used to sense a 5 volt signal.

It is an 8 port switch but I am only using 4 for sensing voltage.

Using OWFS (1-Wire File System), I was able to detect when a button has been pressed.

Uber cool.

I can detect when a button is pressed and use the computer to take some action, such as switching on or off a device or a number of devices. Not quite sure yet.

What I think I will do is pop an opto-coupler into the mix and use the DS2408 to control the receiver.

For example:

1. Press a button
2. Sense the voltage using the DS2408 and do something
3. Switch off the power to the receiver and back on again.
4. This will clear the sensed voltage and mean that every button press is easily detected as an event request.

Saturday, April 3, 2010

In Praise of Linux

The house server, which runs Fedora Linux and does the 1-wire, currentcost etc activities plus many other things was becoming a bit unstable and was crashing every day or two.

The cry went up and 'Feck' was heard throughout the land.

It took me most of the day to sort it.

It was all caused by disk errors. Luckily they were only soft errors. File allocation errors etc.

It took a long time to find out what the problem was and then to repair it.

Anyway, all good now.

I also had an aborted upgrade issue, that left things in a bit of a limbo situation. I was able to force it through, I think.

The truth is that I really enjoyed it. Plenty of problem solving and I didn't know if I could solve it. Well, I knew I could.

If it was Windows, I think the outcome would = Bollixed.

Linux will never catch on, as it is complex under the hood.

But you can get under the hood and twiddle away and fix really obscure issues.

The new word on the street is 'Coolziod'.

I Love Fedora..............

Tuesday, March 16, 2010

Linux Mysql OpenOffice Connector

I use MySQL quite a lot as part of my Home Automation and various information web pages.

As a Linux dude, I need an application to easily update various tables.

There are not many open source utilities that would fit my requirements.

An obvious fella would be to use OpenOffice to connect to MySQL.

I previously set-up OpenOffice to connect to MySQL. It did work but often the wheels fell off and it involved varying degrees of difficulty to get the wheels back on.

Not so any more.

I am not sure when but with OpenOffice 3, things are much easier.

Here is what you need:

1. Access to a Mysql database.
2. An install of OpenOffice.
3. The latest connector extension for OpenOffice.

The Linux Mysql OpenOffice Connector is available here:

Get the connector and follow this link to complete the set-up.

Top Tip:

If you want to be able to edit the MySQL table, the table must have a Primary Key' defined. Otherwise, the result is Fecked.

A Primary Key, is simply a field in the table that has unique contents.

I used this command line to set it:

mysql> alter table "table" add constraint primary key ("field");

That's all.

JTJ (Just the job)