Monitoring SolarPV, Heatpump and house electric, EmonTx v2 system upgrade example

Several years ago we did a community energy monitoring project in our local area, Penrhyndeudraeth, North Wales. It involved installing 20 openenergymonitor energy monitors in 20 households and carrying out energy assessment looking at electricity, heating and transport, there is a little more about it and some of the tools we developed here.

The houses that where most engaged in the monitoring part of the project still have those energy monitors installed and yesterday I went to upgrade one of these systems, I thought Id write a blog post on what I did (written half as a guide) as it might be useful for those using older hardware such as the emonTx V2 and its also quite an interesting example of what you can do with the monitoring system.

The upgrade essentially involved replacing a first generation nanode basestation with a RaspberryPI basestation running the latest image and also upgrading the emontx v2 that was in place with new firmware that both does the higher accuracy continuous sampling (developed by Robin Emley) and the watt hour calculation on board.

This particular system is measuring Solar PV generation, household electric consumption and the electrical consumption of a heatpump. It has an EmonGLCD Display running the SolarPV firmware, with the red/green glowing ambient light depending on whether more power is being used than generated or vice versa and the data is also posted to for graphing.

Here's a system diagram:


Upload to the EmonTxV2 the continuous sampling + watt hour firmware: 

The same thing can of course be achieved with an EmonTxV3 but with the added benefit of a fourth channel and only needing the one ACAC Power adapter. If you have the EmonTxV3 upload the continuous sampling + watt hour firmware found here:

Open the SolarPV example:

On lines 68 and 69 change the emontx radio packet defenition from:

    typedef struct { int power1, power2, power3, Vrms; } PayloadTX;
    PayloadTX emontx;


    typedef struct {
        unsigned long msgNumber;
        int heatpump; // heatpump
        int power1; // house power
        int power2; // solar power
        long wh_CT1;
        long wh_CT2;
        long wh_CT3;
    } PayloadTX;
    PayloadTX emontx;

I've named the second variable here heatpump instead of power1 and then powers 1 to 3 because power1 and power2 are used as house power and solar power lower down in the firmware.

RaspberryPI Basestation
I used the latest (28th of July emonSD image) that has EmonHub (thanks to Jerome and Paul Burnell) and emoncms ready to go but without the local emoncms installation enabled, the PI was just used as an EmonHub gateway forwarder to I used the nice pimoroni berryblack raspberrypi case so that the installation was tidy.

Download ready-to-go image: [link updated]

To configure EmonHub to post to, SSH into the raspberrypi and put the PI in read/write mode with:


and then open the emonhub configuration file:

    nano /boot/emonhub.conf

Set the dispatcher url to: and the apikey to your account write apikey.

In order to decode the emontx continuous + watt hour radio packet add a node decoder to the nodes section in the emonhub config file at the bottom:

        Datacodes = L,h,h,h,l,l,l

Secure the pi user by changing the password (the default password is raspberry)


Place the PI back in read only mode:


Emoncms configuration

With the emontx running and the raspberrypi configured as above the inputs will now appear in, but they will be un-named. For this particular installation I named them as in the picture below to correspond to the radio packet format and what I knew I was monitoring on each CT channel.

I then logged each of the power inputs to a fixed interval with averaging (PHPFiwa) feed and used the Wh Accumulator input processor to record the Watt hour totals. The Wh Accumulator checks if the watt hour total has reset and if it does it continues the accumulation from the last point. I used the fixed interval without averaging feed engine for the watt hour feeds.

To make use of the higher accuracy calculating of watt hours on the emontx and the recording of watt hour feeds, there is a slightly different procedure for creating dashboard kwh per day graphs:

Creating a daily electricity consumption graph in a dashboard using watt hour feeds (instead of the old power_to_kwhd method).  

Create a new dashboard and select visualisations > bargraph.

Click on the bargraph and click configure to bring up the configuration dialog. Select the watt hour feed that you want to display daily totals from, enter interval, units, dp, scale and delta=1 as below: (Note that you could change the interval here to any interval: hourly, half day, week etc)

Click save and continue to add any other text and widgets as required. A simple dashboard showing daily consumption and the current power could look like the screenshot below and could be repeated adding a graph for each channel, heatpump, solarpv and house consumption.

To engage in discussion regarding this post, please post on our Community Forum.