Emoncms (early) Heating Control Demo

I've just hooked up a relay to control my central heating boiler and am successfully controlling it via the new emoncms packet generator feels like the future has arrived in my house :-)

The next step will be to make a nice user facing interface which allows setting heating control time schedules and pulling in temperature data from emonTH and even making it smart by using energy data to try and detect if someone is home or not. Lots of exciting possibilities now the enabling hardware is in place.

Gas Combi Boiler Relay Control Unit top left
Please excuse the old boiler, yes I know it should be a no brainer to replace it with a modern efficient condensing unit however things are never simple in rented accommodation. In practice I hardly use the boiler since bottled LPG is very expensive (no mains gas available here), luckily I have a wood stove and a good supply of wood!

Here's a demo of the heating boiler being turned on remotely:


Raspberry Pi with RFM12Pi expansion module running emoncms (on external HDD file system): see blog post. The Raspberry Pi and emoncms are also used to log my home power consumption from my emonTx V3, and room temperatures and humidity from my emonTH's. It also mirrors the data to a remote emoncms server for backup.

Raspberry Pi with RFM12Pi module with emoncms running locally on HDD file system

Control Node:

If switching mains voltage is involved only undertake tasks you are comfortable with, making sure everything is isolated before starting work and don't take any chances. 

Heating systems vary widely, as does the type of control available. Some heating boilers can be controlled via an RF protocol, this could be preferable since tapping into the boiler direct and switching high voltage would not be required.

My old Worcester Bosch 240 with Honeywell controller requires connecting two terminals together to switch the heating on (see image below). I managed to wire in an additional control wire while keeping the original timer unit in place.

I used an emonTx V2 with JeeLabs relay module, this is just what I had to hand, any RFM12B node with an appropriate relay module could be used. We're looking into making a prototype PCB with an RFM12B, relay unit, on-board power supply and in-line energy monitoring (why not?!). The important consideration here is to make sure everything is properly enclosed and wired up to a high standard if you're controlling mains voltage. DON'T TAKE CHANCES WITH MAINS VOLTAGE.

It's important that the relay module used can handle the current being switched in my case this was only about 500mA @ 240V AC but if you're controlling an electric heating direct this is an important consideration.

Old Honeywell timer controller unit with front face removed - connect terminal 5 to 3 to turn heating on - black wire goes to relay (caution 240V AC)

emonTx V2 with RFM12B and JeeLabs relay module


Emoncms Raspberry Pi Server
emoncms running on Raspberry Pi with the new packet generator module, see blog post. This is included in the emoncms Raspberry Pi external HDD image (it's still in beta). For the moment as shown in the video the relay is switched on and off from the emoncms backend web page by browsing to the Pi's local IP address and logging into emoncms and selecting the packet gen module under the extras menu.

emoncms RFM12B control packet generator module - beta

To enable control from outside the house the the http port would have to be opened on my router's firewall and a dynamic dns setup on the external IP address. As mentioned at the beginning of this post the next stage is to design a user facing interface dashboard for emoncms control modules.

Arduino Firmware: 
I've pushed the Arduino sketch running on the emonTx to the emoncms packetgen module GitHub as an example.

Fail safe
I choose a non latching relay so in case of control unit power failure the relay will default to the open / off position.

I've tried to make the code on the relay control unit as fail safe as possible (independent of Raspberry Pi and network) and as boiler friendly as possible by including a fail safe time after which the relay will default to off (1hr - I'm a frugal user of heating), and a maximum switching rate of 5 min to stop the boiler repeatedly being switched on and off should something go wrong. A hardware watchdog on the ATmega328 was included to try and ensure the microprocessor never locks up.

emonTx Family Tree

Now that the new emonTx V3 has been launched in the shop, all pre-orders have been shipped and documentation for the new units is slowly coming together this feels like a good time to take stock of where we've come from in the last couple of years.

It's been interesting this evening to look back through old photos. Here's a few photos of us etching our first emonTx PCB ourselves using a laser printed transfer and horrible acid, not recommended! 

Etching the first emonTx V0.1 in Jan 2011

First emonTx V0.1 prototype in Jan 2011
Needless to say they results were not great. Still, a fun experience.

emonTx V1 - May 2011
In 2011 we got our first emonTx V1 PCB manufactured, see introduction blog post. Only a few (about 10 in fact) of V1's were made, we sent most of them out for free to friends and developers. If you have one, it's a rare piece of hardware! We quickly moved to V2, tweaking a few things. The design did not really change huge amount to the V2.2 design which we're still selling in the shop.

emonTx V2 - March 2012
The emonTx V2.2 design which has been the backbone of the project for the last year and a half, in that time we've sold almost 5000 of these! They have been shipped all over the word from Hawaii to Korea and most places in between! 

emonTx SMT prototype V? - Aug 2012

In the summer of 2012 we worked on an emonTx SMT prototype, we threw all bells and whistles into this basing the design on an Atmel energy monitoring app note. This design was based on the ATmega32U4 and would be very accurate with adjustable gain pre-amps on the CT channels. However after building a first prototype (which worked!) we realised that the price of this unit would probably be more than most would be willing to part with for an energy monitor. Keeping in mind that a web-connected base station and LCD display would probably also be desired for a full monitoring system. We also realised that for our first intro into SMT manufacture this design with it's very extensive BOM was perhaps a little ambitious.

The first emonTx SMT design was shelved (at least for the time being) and we put our efforts into designing a simpler more streamline unit with performance on par with the emonTx V2 which is good enough for most energy monitoring applications. Here was born the emonTx V3:

emonTx V3 - Dec 2013

The emonTx V3 was designed to be easily SMT manufactured, fit nicely into a tidy wall mountable enclosure, be flexible in terms of RF and MCU and have some useful additional features such as the ability to power the unit from a single AC power adapter which also provides an AC signal for Real Power and Irms calculations.

emonTx V3 SMT pre-assembled

The finished emonTx V3 unit

Feeling like a proud parent as the first emonTx V3 is shipped...while also rocking a Movember!

We're proud of where we have got to, however (as always!) there is still much work to do. Hardware wise we plan to make the emonGLCD pre-assembled SMT and (hopefully) reduce its cost in 2014 and also dip our toes into control of appliances as well as making system setup as easy as possible. 

Thanks for your continued support along this journey. We would not have achieved half as has much if we were not standing on the shoulders of many other open-source projects and community contributions. 

emonTx V3 AC Adapter Socket Error

Just quick post to highlight a small bug in the first batch of emonTx V3...there had to be something!

The barrel-jack socket on the first batch of emonTx V3's has got a middle pin with a diameter of 2.5mm. Our adapters don't fit since they are 2.1mm..Doh! 

To solve this we're shipping a little adapter unit with each emonTx V3:

The AC-AC adapter is important and very useful on the emonTx V3 since it can power the unit as well as simultaneously providing an AC voltage sample for IRMS and Real Power readings.

It's been a busy day of order fulfilment today, all emonTx V3, emonTH and emonTx Shield SMT pre-orders will be shipped by tomorrow. Sorry for the slight delay, waiting for these adapter units to arrive was the cause for the delay. Hopefully the orders should all arrive at the destinations before Christmas.

Onwards! We're working hard to keep shipping out right up until Christmas. See my last post regarding last postage days for guaranteed delivery before Christmas.

Setup Emoncms on a RaspberryPI with a Hard drive

After the SD Card write issue setback I've been keen to get an alternative that works for running emoncms locally on a raspberrypi. I now have my home monitoring setup running off a raspberrypi with a hard drive (as recommended by Paul Reed, thanks Paul!) and a pihub as in the picture above and I've uploaded an image and details of this option to the documentation here:

I think there are quite a few benefits to running emoncms locally especially as we start to add the ability to control things from emoncms in addition to monitoring. Being able to set a heating profile shouldn’t depend on a working internet connection or a remote server's uptime. Control needs to be as robust and secure as possible.

I also think there is an important benefit of improved privacy: Energy, temperature and other environmental data is often sensitive personal data. Storing data locally is probably the best way to ensure you have full control over the privacy of your data as it never needs to leave the home unless that is you decide to share certain feeds for an open dataset or enable remote access for access while away or on the move.

Another benefit that I make regular use of is to develop new features such as the recent open source building energy modelling work (see application guide), because my data and the application was local I could edit the visualisations and model and see the results on my data straight away.

The emoncms raspberrypi hard drive image comes with quite a few add-on emoncms modules installed out of the box including the Event and MQTT module by Nick Boyle (elyobelyob). I tested the NMA notify my android feature and it worked great.

Here are all the add-on modules installed out of the box:
  • PacketGen, A new module for sending control packets.
  • Event module for sending Prowl, NMA, Curl, Twitter and Email notifications.
  • MQTT module for subscribing to MQTT topics containing data to be logged to emoncms.
  • Notify module sends an email if feeds become inactive
  • Energy module. Create a David MacKay style energy stack
  • OpenBEM module. Open Source Building Energy Model. Investigate the thermal performance of buildings.
  • Report module. Create's electricity use reports including appliance list exercise
There are two images in the zip attached in the documentation, one is called boot.img and the other pi_hdd_stack.img.

The boot.img goes on the SD card and just tells the PI to use the filesystem that is on the external harddrive. The second image pi_hdd_stack.img needs to be written to the hard drive.

With the harddrive connected to the PI through a powered hub and the boot SD card inserted in the PI, the pi should just boot-up and and be ready to use.

Environmental Considerations 

Adding a HDD to a Raspberry Pi setup does increase power consumption however I measured that my 2.5" 1TB USB external hard drive connected to the Pi only added 1.8W to the over all setup (3.9W). This modest increase in power can probably be justified.

Obviously purchasing a HDD has a considerable embodied energy, however there is an excess of low capacity second hand IDE hard drives commonly sold on ebay which are perfect for this application. A 20Gb drive (masses of space for emoncms!) can be picked up for a few £. With regular backup should provide a few years of service. It's great to be able to make use of something which otherwise would have to thrown away or at best recycled for raw materials.

Adding control to emoncms: RFM12b Packet Generator

I've had many conversations with people recently about controlling things like radiator set points, boiler thermostat's, heatpump's and so on.

I visited John cantor of today who is implementing an impressive control and monitoring system for a heatpump central heating system which involves EmonGLCD's with relay's connected to radiator valve actuators in each room. The buttons on the EmonGLCD are used to set the target temperature for the room and information is displayed on the EmonGLCD about heatpump power input and outside temperature.

On the way back I stopped at the Centre for Alternative Technology where Marnoch who is on their student placement there is working on doing something similar but for a radiator system connected to a wood chip boiler.

Both Glyn and Ynyr are keen to get boiler thermostat controllers working in their houses and Ken Boak who designed the NanodeRF phoned up the other day suggesting we start an openenergymonitor sub project and discussion on this topic, Ken's been working on central heating control for quite some time.

Its something I have a growing interest in too as we will be soon installing a heatpump system at home which has a lot of opportunity for control and monitoring to make sure its running efficiently.

So I've been giving some thought to how control features could be added to emoncms in a more integrated way than initial efforts I've made before.

I like the simplicity of the way Jean Claude Wippler designed the jeelib library to use c structures as the method in which data is packaged and sent via the RFM12b radio's and so I thought that maybe a good basis for adding control functionality to emoncms would be to first make it possible for emoncms to easily generate RFM12b data packets in the format that can be easily decoded with a struct definition on the listening control nodes. Emoncms would then broadcast this control packet containing all the state information about the system at a regular interval in the same way as an emontx broadcasts it's readings. Listening nodes can then be programmed to selectively use variables in that control packet depending on what they need to do.

I've put together an initial working concept of a module that can be used to do this and its up on github here:

Here's a screenshot of the main interface:

One of the nice things about it is that as you generate your control packet the module generates example Arduino code to make it easier to start coding a control node, you can just copy the code any drop it into the Arduino IDE and upload to a atmega+rfm12b based node and it should start receiving the control packet right away.

I see this module and control in general being run on a local installation of emoncms running on a raspberrypi + harddrive combination rather than The next step is an image with all this installed and working out of the box.

2013 Christmas Ordering Info - Royal Mail Last Posting Dates for Delivery before Christmas

It's that time of year again! We're busier than ever with the launch of our new hardware modules this week.Thanks to everyone who's helped support the project by ordering through the shop or contributed to the project in some way shape or form. All pre-orders for the new hardware will have been shipped by beginning of next week. 

Since I last posted a similar post this time last year we have shipped over 2500 orders and have moved into a new office

Here are the last posting dates for delivery in time for Christmas according to Royal Mail. We will continue to ship right up until Christmas but to avoid disappointment if you would like your items before Christmas please get your order in soon! 

International Airmail including
Airsure® and International Signed For™

Wednesday 4 December Asia, Far East (including Japan), New Zealand
Thursday 5 December Australia
Friday 6 December Africa, Caribbean, Central & South America, Middle East
Monday 9 December Cyprus, Eastern Europe
Tuesday 10 December Canada, France, Greece, Poland
Friday 13 December USA
Saturday 14 December Western Europe (excluding France, Greece, Poland)

UK Services  
Friday 20 December 1st Class
Monday 23 December Royal Mail Special Delivery Guaranteed™

We will also be shipping between Christmas and new year and as soon as the postal system opens again beginning of Jan. 

We will hopefully get another post up when I have a bit more time over the festive period taking stock of the year; what we've achieved and our aims and hopes for next year. Until then, here's a quick couple of photos from the office today:

emonTH assembled PCB's tested, firmware uploaded and ready to go
Trystan's been testing a setup with Raspberry Pi with RFM12Pi running emoncms on an external hard drive, potentially a great low cost solution for home emoncms microserver with robust logging and local storage...expect blog post and HDD image soon

emonTx V3 cases getting ready to case you're wondering, yes we did give that poor suffering plant in the background some water later today!

Trystan and the the dev bench

Myself and Trystan 'working', I should add that I'm doing 'Movember' , only a few more days to go, please donate, it's for a good cause

Printing postage for order parcels

Order fulfillment 

New hardware is in the shop and starting to ship this week

If you have been following the blog and twitter over the past couple of weeks you will probably have noticed that we've been gearing up for and starting manufacture (part 1 and part 2) of a trio of new hardware units:

1. emonTx V3

The emonTx V3 is our new flagship energy monitoring wireless node. Thanks to community contributions and user feedback we've improved on the previous through-hole emonTx design while trying to keep as much flexibility and user customisation potential as possible.

Full emonTx V3 system with 4 x CT-sensors an AC-AC power adapter: Real Power, Power Factor and VRMS measurements

The unit uses the same Atmel ATmega328 Arduino compatible microprocessor and all free I/O pins have been made accessible on a screw-terminal block for easy expandability.

Apart from the obvious change in enclosure and move to SMT pre-assembled electronics, the most notable hardware improvement is the addition of an AC-DC circuit. This enables the emonTx V3 to be powered from a single AC-AC plug-in adapter while simultaneously providing an AC voltage sample for VRMS and Real Power measurements.

emonTx V3 with ATmega328, RFM12B and on-board 3 x AA batteries

Instead of having a separate firmware sketch example for each function as we had with the emonTx V2 (e.g. Real Power (CT123_voltage), Apparent Power (CT123), Temperature etc.) we have for the emonTx V3 made progress combining all these into one 'auto-adaptable' piece of firmware. We have called it emonTxV3_discrete_sampling, it's  based on EmonLib but no longer relies on the internal bandgap of the Atmel chip for ADC measurements. This will increase ADC accuracy and reduce the need for additional calibration. The main features of the firmware at present are:

  • CT detection – only sampling from required channels
  • Power supply detection & presence of AC-AC adapter – VRMS and Real Power measurements are enabled if powering from AC-AC adapter and power saving mode is enabled of powering from batteries
  • Temperature sensor detection – external DS18B20 temperature sensors are auto detected and temperature readings added to measurements

The name 'discrete sampling' was used to draw distinction between the EmonLib based discrete sampling approach and Continuous Sampling. A Continuous Sampling PLL example is included in the emonTx V3 examples, after some testing we hope to integrate this into the main firmware: the emonTx V3 could switch to a more accurate continuous sampling mode when powered from AC-AC adapter of 5V DC USB.

The emonTx V3 is now available from the OpenEnergyMonitor shop. 

2. emonTH 

Wireless Temperature and Humidity Node

emonTH Temperature and Humidity Node

The emonTH is a new unit to replace the Low Power emonTx Temperature node (which was bit of a cludge!).

emonTH installed in my house, I will be keeping a close eye on temperature and humidity in my house over the winter in North Wales

Working with community groups like the Manchester Carbon Coop who are involved in retro-fitting houses with insulation we realised the need for an easy to deploy, long lasting temperature and humidity monitoring node. Many emonTHs can be deployed thought a house or building to inform a building performance model, heating control system or just for general interest! The emonTH supports DHT22 and DS18B20 sensors as well as simultaneous indoor and outdoor temperature readings using a remote DS18B20 sensor wired into terminal block.

As with the emonTx the data is logged via a web-connected base station to emoncms server for logging, graphing and analysis. As with all our hardware, the emonTH is open-source and Arduino IDE compatible using the ATmega328 with the Arduino serial bootloader.

The emonTH comes pre assembled and has an on board DC-DC converter to increase battery life.

The emonTH is now available from the OpenEnergyMonitor shop. 

3. emonTx Arduino Shield SMT

Arduino compatible energy monitor shield add-on. 

emonTx Shied SMT on Arduino Leonardo

For prototyping and lab experiences an Arduino is a great tool to quickly try something. The emonTx Shield allows energy monitoring functions to be added to a standard Arduino Uno / Leonardo or Yun as well as a Nanode RF. As with all our hardware units we provide as many software examples to help you get up and running. The emonTx Shield SMT uses Surface Mount (SMT) pre-assembled electronics. To keep costs down the through-hole components (headers and connectors) require manual solder assembly.

The emonTx Shield SMT is now available from the OpenEnergyMonitor shop. 

Hardware Manufacture Begins! Part 2: emonTx V3 and emonTx Arduino Shield SMT

This morning I visited Kaizen Technology in Royston near Cambridge. They're manufacturing the emonTx V3 and emonTx Arduino Shield SMT energy monitoring nodes. We choose Kaizen since we have worked with them before to supply us with components and as far as manufacture goes that have very good capabilities. They are able to perform wave soldering to automate the soldering of thru-hole components. This keeps the cost down on a board like the emonTx V3 where there are many thru-hole connectors. 

Since the emonTx Arduino Shield has got thru-hole components which are inserted from the rear of the board this could not be wave soldered. To keep cost down we will be shipping the emonTx Shield with only the SMT components placed and the thru-hole components supplies as a kit. The emonTx V3 will be fully assembled (SMT + thru-hole), apart from the RFu328 to retain user flexibility as some users might want to use an SRF instead of the RFM12B or even use a different MCU in place of ATmega328. 

Mm lots of components

Video showing solder paste being applied and pick-and-place doing it's thing

Checking the placements with the pick-and-place camera

Big re-flow oven, wave soldering machine on the right hand side
Manufacture of the emonTx V3 and emonTx SMT shield should be done by the end of this week and we expect to receive them next week. We hope to start shipping the pre-orders soon after:

Fully assembled emonTx V3, emonTx Shield SMT and emonTH

Complete emonTx V3 energy monitoring node

Hardware Manufacture Begins! Part 1: emonTH Temperature and Humidity Node

It's a busy for weeks for us at the moment. If you've been following us on twitter you will have see in the last week we have had the production PCB's designs for the emonTx V3, emonTx Shield SMT and emonTH (temperature and humidity) back from our manufactures. This coincided with manufacture of all three units starting this week.

Even though the designs have undergone several iterations and have been extensively tested over the past 12 months or so it was still a nail biting moment assembling, powering up and testing the final designs. Luckily it all went smoothly and all functions on all three designs seem to be working exactly as planned..just as well since we have 500 PCS of each!

Building up the final productions designs..scary! Thankfully it all went smoothly

Final designs for emonTx V3, emonTx Arduino Shield SMT and emonTH all working!
Last week I traveled over to Ciseco  in Nottingham to oversee starting manufacture of the emonTH Temperature and Humidity monitoring node. Ciseco have come a long way since I first visited them over a year ago. They've moved new offices, upgraded their pick-and-place machine and picked up a few more pairs of hands along the way. 

Here's a few photos of the manufacture of the emonTH:

Step 1: solder paste being applied

Step 2: Setup the pick-and-place to identify the 'fiducials' on the emonTH...Google it! If you look hard you will see these little shiny round marks on all SMT boards.

Step 3: practice placements

Step 4: let the pick-and-place do it's stuff! I love watching machines at work

Step 5 & 6: Reflow the board in the oven then add the thru-hole bits

Step 7: Test, test and test! Here's show's testing of the RFu328 (ATmega328 MCU + Radio) modules 

Step 8: Done!

Unfortunately we had a few issues during step 7; a some of the RF12B's which were reflowed onto the RFu328's were not working as they should. We think this was down to the large MCU package on the RFM12B absorbing more heat during the reflow process than expected. For the next batch we will look at tweaking the reflow oven's temperature profile. For now we will be hand soldering the RF modules. These sorts of niggles are not uncommon in manufacture, this is why testing is so important. We will be testing the units at several stages before they're shipped to ensure all functions are working. 

emonTx V3 final production design ready to go! 

The emonTx V3 and emonTx Arduino Shield are now in our shop on pre-order. The emonTH should be in the shop in the next few days (just waiting to tie down pricing). We hope to start shipping at the end of this month (November), so hopefully everyone who want's one should get them in time for Christmas. Documentation for all the units is slowly coming together, please bare with us during the next week or so; we hope to have all the documentation and open-source designs ready for we start shipping. Likewise it would be most helpful if you spot any typos (or screaming errors!) in the shop description or wiki documentation please let us know. If you want to take a look the Arduino compatible firmware code for all three units has been pushed to GitHub.

I'm currently on on the train down to London ready to travel to Cambridge tomorrow to meet with another manufacturer and begin manufacture of the emonTx V3 and emonTx Arduino Shield. Stay tuned for another post in the next couple of days! I will also try and tweet some sneak-peak photos of the manufacturing process as it happens tomorrow. 

Documentation highlight: Application guides

To try and bring the work on the application guides more to the fore, I've rearranged the OpenEnergyMonitor Getting Started Guide bringing the application guide list up to the top of the page.

There you will find Robin Emley's documentation on his MK2 PV diverter and Martin Robert PLL PV diverter documentation. I have also made a start on updating the heat-pump application guide and writing a guide on building thermal performance monitoring.

Here's the full application guide list so far:

Home Electricity monitor
Solar PV Monitoring
Diverting surplus PV Power, by Robin Emley
Solar PV power diversion with emonTx using a PLL, emonGLCD and temperature measurement, by Martin Roberts
Building thermal performance monitoring and modelling
Heatpump Monitoring
Solar Hot Water monitoring and control