OpenEnergyMonitor is a project to implement an open source whole house energy monitoring system built on the Arduino platform. This guide will show you how to make a complete system that will monitor your mains power usage and transmit it over a wireless link to a base station which will upload the data to a web server where you can view graphs of your power usage over time. The image to the right shows one example of the output from the web interface.
There are many options when it comes to building an OpenEnergyMonitor system and you can have systems with multiple current sensors, pulse count sensors and temperature sensors. The OpenEnergyMonitor website is a mine of information but it is very spread out and there isn’t really a simple description of how to build a complete wireless system from end to end so I thought I would document how I made my single sensor system for use on single phase electricity systems such as that used in the UK.
First of all you are going to need some parts. I used a Nanode as the base station which receives the data from the transmitter and uploads it to a web app running on your server. For the transmitter I used a Xino Basic for Atmel which is a no frills Arduino compatible with a handy prototyping area which allows everything to be made on the one board. Here is my full parts list:
1 x Nanode Kit
1 x Xino Basic for Atmel Kit
2 x RFM12B transceivers
2 x Jeelabs RFM12B breakout boards
1 x Efergy CT Sensor
1 x ATmega 328 chip with the Arduino bootloader
1 x 16 MHz crystal
8 x 10K resistors
6 x 4.7K resistors
1 x 24 Ohm resistor
2 x 22pF ceramic capacitors
4 x 0.1uF/100nF ceramic capacitors
2 x 10uF electrolytic capacitors
2 x 100uF electrolytic capacitors
1 x LM7805 5V voltage regulator
1 x MCP1702-33 low dropout 3.3V voltage regulator
1 x 8 way male header
1 x 5 way male header
2 x 165mm length of wire for antennas
1 x 7V to 9V DC power supply for the Xino
1 x 7V to 9V DC power supply for the Nanode or a USB power supply
1 x Stereo 2.5mm jack socket
2 x 2.1mm DC power sockets
2 x ABS plastic cases
The current is measured using a current transformer or CT sensor which works by induction. A CT sensor contains a split ferrite core which is clipped around the live wire bringing the mains feed into to the house, the current in the mains wire produces a magnetic field in the ferrite core which induces a current flow in a secondary coil that is proportional to the current in the mains wire. As the current in the secondary coil is electrically isolated from the primary current it offers a safe, non invasive way of measuring the mains current.
The efergy CT sensor I used needs to connected across a resistor (the 24 Ohm “burden resistor”) to get a voltage reading (some CT sensors have this resistor built in) and then a voltage divider is used to bias the output around 2.5V instead of 0V so that it can be connected to one of the analogue inputs on the transmitter (an Arduino needs a positive voltage).
I used the Efergy CT sensor which doesn’t appear to be available on their website at the moment but is available from them on eBay. If you want to use a different CT sensor you will need to know if it has a burden resistor built in and how many turns the secondary coil has.
The Transmitter (Xino)
Any Arduino type board can be used here, or you could even roll your own. I decided to use the Xino as it is very cost effective and the prototyping area allows the burden resistor, voltage divider and filter capacitor to be installed all on the one board.
The biased output from the CT sensor will connect to an analogue input on the Xino which will then transmit the power reading over a 433MHz radio link to the Nanode base station.
Build the Xino to match the picture below, you don’t need to fit the 6 pin headers or the 8 pin for the 0 to 7 digital pins but you will need the one for 8 to 15. You won’t need the 6 pin ICSP headers and you can also omit the power LED and the 1K resistor as I have.
Now we need to add the other components in the prototyping area of the Xino to regulate the power input and connect the CT sensor. Fit the 24 Ohm burden resistor, two 10K resistors, 10uF capacitor, two 100uF capacitors and the LM7805 voltage regulator as per the following diagram. Connect the two wires for the CT sensor to the tip and collar pins of the 2.5mm jack socket (it doesn’t matter which way round), the center ring isn’t used. The V IN and GND IN are for connection of your power supply, I connected these to a 2.1mm DC power socket so a standard 7 to 9V DC power supply can be used.
The Xino should now look like this:
The Base Station (Nanode)
The Nanode is an ethernet enabled Arduino workalike, it will act as the base station and receiver for the OpenEnergyMonitor, receiving the power reading from the Xino based transmitter and uploading it to the web server.
Build the Nanode as per the instructions here but note that you must make the modification to allow the RFM12B transceiver to be used at the same time as the ethernet, this involves not fitting R13 (the 10K resistor one down from the 1 ohm ferrite) and lifting pin 4 of the ENC28J60 so that it is not connected to the socket. You do not need to fit the standard Arduino headers but you will need to fit one 8 way header for the RFM12B port. If you intend to power the Nanode via the USB port you won’t need to fit the screw terminals or voltage regulator and conversely if you intend to power using the screw terminals you wouldn’t need to fit the USB socket. I fitted both so I have the option.
Your Nanode should now look like this:
The Radio Link
To link the two boards wirelessly two 433MHz RFM12B transceivers are used, to connect these boards to the Arduino platform requires a few extra components and the easiest way to achieve this is to use a breakout board.
Build one RFM12B breakout board for the Xino with all the components. With the board positioned with the headers at the bottom you want to fit 3 x 4K7 resistors on the left and 3 x 10K on the right. Fit two 0.1uF/100nF ceramic capacitors in the C1 and C2 positions and a 10uF electrolytic capacitor in C4 (positive to the right hand side as marked on the board). Fit the MCP1702-33 to follow the orientation marked on the board and fit a 5 pin male header across the GND, SCK, SDO, SDI and SEL positions. When soldering the RFM12B to the breakout board you only need to solder the top 3 and bottom 3 pads on the left hand side and the bottom 2 on the right. Solder a 165mm length of solid core wire to the hole next to the top left pin of the RFM12B for use as an antenna.
Solder a wire from the 5V pin on the RFM12B breakout board to the 5V on the Xino and solder one from the IRQ pin to the Xino’s D2, plug the breakout board into the 8 way header on the Xino so that it is across the GND and D10 pins.
Build a second RFM12B breakout board for the Nanode but this time you don’t need to fit the capacitors or the voltage regulator as the Nanode will provide the 3.3V to run the RFM12B. Fit an 8 pin male header to this one and plug it into the 8 way header fitted to the Nanodes RFM12B port.
Fit the RFM12B boards to the Nanode and Xino and that is the hardware completed.
Now you need to install the web interface and load the sketches onto the Nanode and Xino.
First install the emoncms2 package on your web server and register an account.
Now load the sketches onto the Nanode and Xino using the Arduino IDE and an FTDI cable/board. The Xino has a 5 pin header for programming so you might wanto make an adapter to convert it to a normal FTDI connector.
Before uploading the Nanode sketch make sure you set the mac to something unique and change the emoncms details to reflect where you installed emoncms and copy the write only API key from your emoncms2 web interface.
If you now fit the CT sensor around your mains feed and plug it into the Xino transmitter and connect the Nanode receiver to your network or router and you should soon start to see data appearing in your emoncms web interface.
The system is now working but should be calibrated against a known source. I used an old Owl energy monitor system I had for this, you need to adjust the “double CAL” value in the sketch for the Xino until the readings match your known source across a range of loads. If you change “#define SERIAL 0” to “#define SERIAL 1” you can use the Arduino IDE serial monitor to view the readings as they are read which can help speed this process up, don’t forget to change it back afterwards as it can apparently affect stability otherwise.
To make things a bit neater you will probably want to put the Nanode and Xino in a case. Ciseco, the maker of the Xino do a nice ABS plastic box which is perfect for housing Arduino boards and will just about fit a Nanode too once a hole is cut for the ethernet jack.
Here is my completed transmitter and receiver:
Next I’m going to look at making a graphical LCD display unit which will involve another Arduino based board with an RFM12B and some sort of graphical LCD. I found a nice 128×64 pixel display from an old car alarm programmer in my salvage pile that I hope to be able to use for this.