Many houses in the UK have an electricity meter with a light on it that flashes at a rate proportional to how fast electricity is being used (typically 800 times per kilowatt hour). I built a system that took advantage of this to measure our house's electricity usage.
We already had a PC (our router) sitting on the floor next to the meter cupboard, so the easiest way to measure the rate was to clamp a photocell over the flashy light and connect it (via a little bit of interface hardware) to the router's parallel port, then run a program to measure the time between flashes.
The photocell was connected via a buffer circuit to the PE input line on the parallel port:
The pot should be adjusted so that the flashy light causes the transistor to turn on and off. The STROBE line from the parallel port is normally high, and is thus used as power (the circuit only draws a tiny amount of current). The BC108 can be replaced with any generic NPN transistor, and the parts values in general are not very sensitive — this was a quick kludge based on whatever bits I could find around the house! The original version was constructed in free space and wrapped in a discarded food container; I rebuilt it later on stripboard which could just be mounted to the back of the D-type.
The photocell is mounted on the end of a long cable, and can just be stuck over the light on the meter with Blu-Tak for ease of removal:
The code is here; you'll need to edit it to set your parallel port base address, the number of flashes per kilowatt hour, and the number of readings to average over (the history of readings start as 0, so it'll take as many readings as you've set before you get the true value). This needs to be run as root, and takes two filenames as parameters; the output (the power usage measured in watts, as an integer) is written to the second, which is then atomically renamed to the first. This means that you can read from the first without worrying about it being overwritten while you're reading.
We used MRTG to graph the output of this with this script as an external input.
The system as described above worked fine for nearly four years; unfortunately the house I moved to has the meters outside, and no convenient route to run cable to a machine inside. It looks like a future incarnation of this project will use a couple of cheap radio modules...
Similar projects
Sean Adams has built a similar metering system for a mechanical electricity meter, using a light source that's interrupted by the spinning disc in the meter.
Poul-Henning Kamp has built a similar system that senses the 0 going past on his gas meter.