power management & measuring

I recently bought myself a couple of Plugwise smartplugs that can be used to control and measure power usage over the wireless ZigBee protocol. I wrote a bit about these and the alternatives in the last post.

The Home Start kit consists of a USB stick that is reasonably enough called Stick and two smartplugs: Circle and a Circle+ (a circle that has ZigBee router capabilities). The Stick takes care of the ZigBee communication and provides the operating system with a simple serial port interface.
The Circles are really nicely designed and reasonably priced at somewhere around 40€ per Circle (125€ for the kit), which is a lot cheaper and smaller than the alternatives mentioned in the previous post.

plugwise home start kit

Plugwise Home Start kit

Plugwise Circle

Plugwise Circle

The only problem with these things from my perspective was that they use a proprietary communication protocol and you are basically supposed to use their Windows based software for managing them. I haven’t used Windows in a decade or so and I’m interested in integrating it into my own system instead of using some special GUI app so I had to find some other method for communicating with these things. Luckily most of the protocol has been reverse engineered by Maarten Damen so I just wrote my own Python library called python-plugwise that implements this spec. It’s available under the MIT licence here.

The library also contains a small command line utility that can be used to test the basic functionality of the plug (measuring power, switching on/off). The Circles also support uploading an on/off switching schedule and reading the power usage log so you wouldn’t have to keep a computer constantly running just to do these things. I haven’t yet implemented these functions since I control these and other things from the Beagleboard. It is a very small and low powered ARM based fanless computer that uses around 3W of power so it doesn’t waste much resources to keep it always on.

I haven’t really tested the working range of these things but currently the Stick is about 7m away from both Circles and there’s a brick wall and a door between them and the communication seems to be stable so far.

Anyway here’s the first quick and dirty RRD graph of power usage from a couple of appliances:
power usage

5 thoughts on “power management & measuring

  1. Aey


    I’m using your python program to control some devices at home. I try now to deploy it on Bogoplugs but I’m having problems getting the USB Zigbee Stick from Plugwise working under it. Bogoplugs are running Arch Linux on a ARM CPU. I can see the device under /dev/usb1.3 but can’t use your software to access the stick, getting the Error “Error: Could not configure port: (25, ‘Inappropriate ioctl for device’)”. I assume that the driver for the stick is not loaded. So I spend an entire day looking for an FTDI Linux ARM driver, but couldn’t find one. In one of your blogs you mentioned that you use your software on a Beagleboard which also uses a ARM CPU. How did you manage to get the stick running there? Any help would be very appreciated! 🙂

  2. hadara Post author

    Yes, I’m using ARM based Beagleboard but I can’t really remember having done anything special to get the FTDI driver running.

    You might try doing modprobe usbserial if you havent done so yet.

    If that module (and ftdi_sio) doesn’t exist there might be some packages available with the extra kernel modules.
    Check with the package manager your distribution uses.

    If the packages are not available you might be able to compile it yourself which isn’t necessarily as hard as it sounds.
    On the other hand it might be, it really depends on how well the specific ARM SoC is supported by the mainline kernel and if you
    can compile on the target or need to find a suitable cross compiler first.
    Some good build guidelines for plug computers seem to be at http://www.nslu2-linux.org/wiki/Optware/PlugComputers

    Another option is to try to get another more fully featured Linux distribution running on it (preferably Debian).

    I’m currently using debian 6.0.3 on the beagleboard and I think the usbserial and ftdi_sio modules were included by default.

    Here’s some info aboud my system:
    hadara@beaglemonitor:~$ uname -a
    Linux beaglemonitor #1 PREEMPT Thu Dec 2 15:37:13 UTC 2010 armv7l GNU/Linux
    hadara@beaglemonitor:~$ lsmod | grep ftdi
    ftdi_sio 30829 1
    usbserial 36013 3 ftdi_sio
    hadara@beaglemonitor:~$ cat /proc/cpuinfo
    Processor : ARMv7 Processor rev 2 (v7l)
    BogoMIPS : 578.74
    Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3
    CPU implementer : 0x41
    CPU architecture: 7
    CPU variant : 0x1
    CPU part : 0xc08
    CPU revision : 2

    Hardware : OMAP3 Beagle Board
    Revision : 0020
    Serial : 0000000000000000

  3. Nigel Goddard

    Can you tell me how frequently one can get power readings from a Circle, and if they are cumulative power since the last reading, the average power over some time interval, or instantaneous power, or something else. Ideally I would like to know the power being used by each appliance once per second. (I’m not asking how frequently I can query the Circle, I’m asking how frequently it takes a reading).


Leave a Reply

Your email address will not be published.