Several years ago I bought The Energy Detective, a two-piece kit for measuring electricity consumption. One unit connects inside the main electrical panel, the second plugs into a regular outlet and shows a display of power consumption in real time.
The device also comes with a USB port and corresponding Windows software to allow computer logging. The implementation mixes a Windows service (with unfortunate memory leak) and a Flash-based interface. There service hosts an HTTP API which makes it reasonably easy to pull current numbers.
Here’s an example for pulling the numbers in PowerShell:
The stock solution has a few drawbacks: sometimes the numbers just stop getting updated, the memory leak requires regular restarts, and the level of granularity of the usage numbers of rounded to the minute.
Fortunately I came across a TED Modification for real-time data output which shows where to tap the PCB to get the raw output from the modem. The output is a simple 1200 bps 8N1 serial stream. With the case open it was clear that was enough room to sneak an Xbee 2mW Series 2 radio inside. The great think about Xbees is that they will happily transmit a serial stream over the air right out of the box.
Setting up the hardware interface was trivial. Just three connections are required:
Power: Ground is supplied by the third pin on programming jumper. A 3.3v supply for Xbee Vcc is conveniently available on the second pin on programming jumper.
The data line, connected to DIN on the Xbee is tapped off R20 on the PCB.
The Xbee is paired with a coordinator unit inside a ConnectPort X2 gateway. The gateway runs an embedded version of Python and Digi provides a framework called Dia which defines a pattern for interfacing with devices.
Writing the driver for the TED was relatively easy and is a subject for another post.
For reference here are some other interesting TED hacking sites out there: