Saturday, July 31, 2010

Leaving the immersion water heater on – mildly expensive or financial ruin?

I recently stumbled across this blog post about the horrors of forgetting to switch off the immersion water heater. Now that I have my real time energy monitor I thought it would be interesting to see how financially crippling "leaving the immersion on" would actually be.

Here is the result:


There is two phases in "leaving the immersion on" phenomenon:

  1. The initial heating of the water cylinder from cold to target temperature (set by the thermostat in the heater)
  2. Short bursts of about 5 minutes every hour or so to keep the water at target temperature
Phase 1 does take a huge whack of energy. About 6kW for well over 1 hour in my case. And that's in summer when cold water isn't that cold.

However if left on indefinitely and no hot water is consumed, the only additional energy required is to keep the cylinder at the target temperature. With modern well insulated cylinders it's not that much (relatively speaking). In my case a 5 minute burst of 6kW every 1.5 hours. That works out at about €1.20 / day or €8.40 / week assuming no hot water is consumed.

The blog post referred to above mentioned the ESB (power utility company) estimated the cost to be about €20 / week. Allowing for colder weather and reasonable hot water use that sounds about right. (I am assuming electricity costs €0.15/kWh unit.)

BTW: physics sanity check: my cylinder is 117 liters. Heating water from 20C to 80C ie ΔT of 60C. Requires 60 x 4.4kJ x 117 = 30888kJ. At 6kW that requires 30888/6 seconds = 5148 seconds = 1.43 hours. Which approximately squares with what I'm seeing above.

Friday, July 30, 2010

What most energy monitors don't tell you!

I received a Efergy Elite energy monitor (sold in Maplin and other retailers) as a Christmas gift few years go. The Elite provides current use, daily and weekly average and all that green CO₂ nonsense. While useful for tracking down unnecessary drains it doesn't give you a true picture of electricity use throughout the day.

The Efergy Elite comprises a wireless sensor and a receiver/display unit. The sensor is a clamp ammeter which clips to the output from your ESB electricity meter. It transmits real time power use [*] to the receiver every 6 seconds. The receiver unit displays the current consumption and computes daily and weekly averages – not a huge amount of extra info that your electricity bill won't tell you.

Despite getting all this juicy data every 6 seconds the Elite won't share it with you. There is no computer port.  So I hacked it.

I soldered a wire on the baseband signal from the radio receiver, into a cheap little PIC MCU for some decoding and at the other end a stream of numbers every 6 seconds. Bung that into a graphing package and you get a chart like that above.

[*] Actually it can only sense current. So you assume that the supply is at a constant 230V rms and you can calculate the power (power = V*I). It's not accurate enough for billing, but certainly good enough for consumer energy monitoring.

Thursday, July 1, 2010

Unique address for wireless sensors

When designing wireless sensors any sensible communications protocol will feature a device address so that multiple instances of the setup can exist in the same space.

So how do you ensure that wireless devices have a unique address? One approach is to embed a fixed serial number in every device (much like the 48 bit WiFi or Bluetooth MAC address). This requires that each device is programmed with the number at manufacture time.

Another other approach is to use a random number generator to assign an address when the device is configured. For consumer devices is normally involves pressing an associate button on the sensor device for a few seconds.

It is not possible for a CPU to generate a genuine random number without outside help. Fortunately there is a workaround, which utilizes one of the best sources of randomness there ever existed: a human.

My approach (which I suspect is common, but I cannot find any references to it) is to generate a random number when the device is associated using the duration of the associate button press as the source of the random number.

The idea is to time the duration of the button press with as much resolution as possible (eg in microseconds). Then take this duration modulo the size of your address space and you have a pretty good random number.

For example, let’s assume we can time the button press with µs precision and that we are looking for a random 16 bit address (ie a number between 0 and 65535). The clock will cycle through this entire address space in just under 66ms – less than the time that a typical human will take to press a button.

Let's look at some real data. I rigged a micro switch on a pin on the Arduino and wrote a simple timing loop. I pressed the micro switch about 1000 times in succession.

You can see that the typical micro switch press lasted about 100ms +/- 50ms. As the experiment progressed I started getting bored so you will notice a slight decrease in button press duration as impatience set in. A histogram view of this data looks like this:

A normal distribution as one would expect. Now if we take these time values modulo 2^16 (65536) we have a distribution that looks like this:

Nicely spread across the entire address space, with a slight bias in the 30000 - 60000 region, but good enough.