Its been more than five years since I last did a energy monitoring project, a DSP project using a Current Cost ENVI and a Mac Mini. So, since I was given a shiny Raspberry Pi 3 for Christmas now seems like a good time to do something based on openenergymonitor.org.
I like products such as the WeMo® Insight Switch and the TP-link Wi-Fi Smart Plug with Energy Monitoring but as elegant as the designs are, they still stick out an extra 3cm+ from the wall which is impractical for some of the appliances I want to monitor. Plus at €45+ each they are expensive when, on a quick count, there are at least seven appliances I’d like to monitor.
What if, instead of a energy monitor plug, I could modify my existing wall sockets to be energy monitors? That way the electronics would be hidden inside the wall. The obvious first question is there room? Taking a screwdriver the nearest sockets, the answer is: yes! The (pattress) boxes containing the sockets are 60mm in diameter and 50-60mm deep. Allowing for the fact that Type F (Schuko) sockets are recessed, that leaves free space with a depth of around 35-45mm above and below the mechanism.
Next question: what about power? Hmmm… Clearly I could add an AC-DC converter but I don’t like the idea of doing it myself (potential fire hazards, invalidated insurance and all that sensible stuff), so are there any ready made choices? Yes, sockets with built-in USB charging! A ready made supply of 5v, just what I need. A quick trawl of alibaba.com and then the comments on amazon.de led me a double socket like this.
The socket plus USB charger is 40mm deep, so there should be sufficient room left in the box for some additional electronics. The single (1-gang) sockets are generally all one piece but the double (2-gang) sockets typically come in two pieces and fit the common Gira System 55 which means they can be mixed with other items such as light switches. (Great, if like me, you have light switches and power sockets side-by-side.) The user comments and pics suggest they are easy to disassemble, meaning easy access to the USB power. And as a bonus, I’ll get to do away with the plethora of USB chargers – nice!
The Smart Part
To make the socket smart I’m going to need a micro-controller and a radio link of some kind. To measure the energy consumption I’ll use a current transformer (CT) sensor to convert the AC current into a DC voltage. So the micro-controller will need to have an analog to digital converter (ADC). That assumes that I don’t want to include additional functionality to turn the power to the socket on and off remotely. Which I don’t. I’m a huge fan of keeping the user experience straightforward and to the point. Almost all my appliances have energy saving standby functions and the ones that don’t, like my fridge, are the ones that I don’t want turned off.
Since I already have a Raspberry Pi 3, I’ll use the emonBase for the OpenEnergyMonitor base station. The smart sockets will take the place of the emonTx. Allowing the data collected from the smart sockets to be logged and visualised in the emonCMS.
The emonCMS can be run locally, which means I’m not forced to share the data unnecessarily, and it looks awesome. So good in fact, that I’m considering fitting the Raspberry Pi with a 7″ touchscreen and wall mounting it. Normally a project like this would inhabit my router cabinet alongside the hub for the Philips Hue.
The emonBase uses ISM band (433MHz in Europe) radio, which is license free. That may prove problematic given the antenna will be under/behind the socket, in a wall, close to lots of metal and unshielded AC cables. Wifi and BLE (Bluetooth low energy) are possible alternatives since they are present in the Raspberry Pi. I’m going to rule out ZigBee as an alternative since it doesn’t offer any practical benefits over BLE, ISM band radio or Wifi.
A rough (pessimistic) calculation puts the cost at €40 for a single smart socket: €10 for the power socket with built-in USB charger; €10 for the micro-controller; another €10 for the radio transceiver or BLE/Wifi module; and €5-€10 for the CT sensor. A similar cost to the TP-link smart plug.
That’s the cost for a single socket. Assuming the micro-controller has sufficient ADCs, monitoring an additional socket only requires the addition of an extra CT sensor (€5-€10). That brings the cost down to €25/socket for 2-gang sockets and €20/socket for 3-gang sockets.
At that price point it may be cost-effective to monitor some of my lighting too. Particularly the ones with switches that are co-located with power sockets (I have six of these) and/or that include ceiling fans or extractor fans on the same circuit (another two of these). The Philips Hue and, most recently, IKEA Tråfri LED lights don’t consume sufficient energy to make it cost-effective to monitor them.