EcoHome Lab: From Monitoring to Control

Last night I attended EcoHomeLab meetup in Manchester organised by the CarbonCoop.

EcoHomeLab monthly meetups at MadLab brings householders and green-technologists together to take control of home energy use and generation.

It was great fun to catch up with regular faces as well as meet many new interesting people.

I gave a short presentation overview of our efforts as OpenEnergyMonitor to make it as easy as possible for people to get started with energy monitoring and control (home automation) with a sustainability / energy saving focus.

I presented the recent work we have been doing to integrate platforms such as MQTT, Node-RED and openHAB ready-installed and pre-configured on the emonPi, our RaspberryPi based energy monitoring platform. These additional platforms run alongside Emoncms on the emonPi.

See the Integrations section of our user guide for more info

Here are copy of my slides from the event:

HTU21D / Si72021 Temperature and Humidity Sensor

I have been been evaluating the HTU21D temperature and humidity sensor made by Measurement Specialties as a possible DHT22 replacement for the emonTH. This is quite a new sensor, released in 2013. The Si72021 is also a posiblity with an identical pin-out and specs.


The metrics speak for themselves:

Metric HTU21D Si72021 DHT22 DHT22 vs HTU21D Difference
Cost in 1k off £1.42 (July16) £2.15 £4.57 (July16) 3.2 times cheaper (£3.15 less!)
Vcc 2.1v - 3.6V 1.9V - 3.6V 3.3-6V  
Humidity accuracy ±2% RH ±2% RH ±2%RH n/a
Humidity Range 0-100% RH 0-100% RH 0-100% RH n/a
Temperature accuracy ±0.3°C ±0.4°C ±0.5°C 40% more accurate
Temperature Range -40°C +125°C -40°C +125°C -40°C +80°C 56% more accurate
Sleep Current 0.02uA 0.06uA 15uA 750 times less power
Measurement Current 0.045mA 0.09 mA 0.5mA 11 times less power
Measurement time 0.01s - 0.0026s 0.01s - 0.0026s 2s 200 times faster
Energy consumed per sample 1.5uJ 2.97uJ 3300uJ 2000 times less power
Time sampling per day* 14.4s   2800s  
Time sleeping per day* 86386s   83600s  
Energy consumed per day* 2.36mW [1]   2836mW [2] 1201 times less energy per day!
Read on →

Part 3/3: Continuous Deployment (Over-The-Air Update to ESP8266)

This post is part of a series

Following on from my last couple of posts in this series we now have a working continuous cloud-based build & test (firmware compiling) flow using PlatformIO and TravisCI, to quickly recap:

  1. Code change is committed to the EmonESP repo on GitHub
  2. TravisCI triggers a build (compile) using PlatformIO running in a TravisCI container in the cloud.
  3. If build/compilation process fails we get an email alert, if pull-request we get a warning before merging if proposed changes break the build.
  4. If a Git commit is tagged as a release the build process uploads the generated compiled binary (.bin) to the repo GitHub release page.

The next step is to get the compiled binary from GitHub-releases (EmonESP in this example) deployed to a WiFi connected production ESP8266. Here’s the user facing EmonESP web-interface for this firmware update process:


Read on →

Emoncms Docker

We have made the first steps towards running Emoncms to run in a Docker container.

Dockerfiles and setup notes are in the emoncms-docker repository:


Docker is an exciting tool to help make development, testing and deployment of web-applications easier.

What is docker? (the short version):

Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

What is docker? (the long version):

Docker is an open-source platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub, a cloud service for sharing applications and automating workflows, Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments. As a result, IT can ship faster and run the same app, unchanged, on laptops, data center VMs, and any cloud.

Quick Start

$ docker pull openenergymonitor/emoncms
$ git clone
$ cd emoncms-docker
$ docker-compose up

That’s it! Emoncms should now be runnning, browse to http://localhost:8080

Read on →

ESP8266 WIFI developments

Glyn and I have been doing a bit of development recently on using the ESP8266 WiFi board with OpenEnergyMonitor hardware, we are quite excited about the potential of this little module to both reduce the cost of the system and simplify setup and installation especially for applications that primarily post to a remote emoncms server such as

Note: we have no plans to discontinue developments and support for Raspberry Pi based systems e.g. emonPi / emonBase. Quite the opposite: the local storage and processing of a Raspberry Pi based system has many advantages particularly for systems requiring more flexibility and customisation e.g Local Emoncms storage. MQTT, openHAB & nodeRED integration. The ESP developments will be ran in parallel, in fact ESP could be configured to post to an emonPi / emonBase via MQTT for local on-site storage and integration.

We are at the moment working on three initial uses of the ESP8266:

1. EmonTx V3 + ESP8266 module

We are initially using the Adafruit HUZZAH ESP8266 module as a development platform. For anyone keen to get going with the ESP8266 Huzzah module it is available from a number of places such as adafruit (USA) and Pimoroni (UK). Any ESP8266 with ESP-12 module should work the same. See lower in the post for EmonESP firmware dev.


There will be another post very soon detailing how to use this module with the EmonTx v3.

Read on →

Part 2/3: Firmware Continuous Test & Build

This post is part of a series

Following on from the last blog post on using PlatformIO to compile and upload firmware locally, we’re now going to take things a step further and do the same but in The Cloud!

Groan…I know I just used the clichéd ‘C’ word, however there are many advantages to compiling and testing the code in the cloud. At least I didn’t mention ‘IoT’…whoops, just doing my bit for SEO!

In this instance when we say ‘compile in the cloud’ I mean use GitHub, Travis IO and PlatfromIO to compile the firmware and if the branch is tagged with a ‘Git Release’ auto-generate a compiled binary and upload it back to GitHub release page.

The motivation behind this automated-build and testing is working towards creating a robust infrastructure to push OTA updates to ESP8266 connected nodes (EmonESP dev) inspired by this blog post by Daniel Eichhorn (@squix78).

Read on →

Part 1/3: PlatformIO open-source embedded development ecosystem

This post is part of a series:

Part 1/3: PlatformIO open-source embedded development ecosystem

Getting an Arduino based project (or other embedded platform) to compile and upload can be a pain. Making sure all the libraries are installed in the correct locations and of the correct versions can be tricky and time-consuming.

I’m sure many developers will agree that the tools we use for embedded development are generally not as good as those used for web application development.

The Arduino team have done a good job with their IDE to try and make the embedded development tool-chain setup as easy as possible. However, I still find library management a cause of frustration. Especially since I move between computers and OSes frequently.

Recently I have been using PlatformIO and am rather impressed with the ease of setup, speed of compilation, uploading (auto port detection), and most importantly an excellent library manager.

PlatformIO is an open-source ecosystem for IoT development.

Cross-platform build system, IDE integration and continuous testing. Arduino, Espressif, ARM and mbed compatible.

PlatformIO IDE

This post got quite long, therefore, It’s been split into three posts:

  1. PlatfomIO overview & compiling + uploading locally and on a Raspberry Pi
  2. Continuous testing and auto release binary generation using PlatformIO & TravisCI
  3. Continuous Deployment (OTA to ESP8266)

Here are some things that have impressed me about PlatformIO (pio) after using it for a couple of weeks:

  • Fully open-source with active and friendly dev community.
  • Easy to install - Pure python based installed using pip
    • Tool-chains are auto installed on first compile / upload e.g.
      • If trying to upload to Arduino avrdude will automatically be installed
      • If trying to compile an ESP8266 project the ESP toolchain will be installed
    • Cross-platform (Linux, Windows and mac all work the same), this will make support much easier
  • Supports all the main embedded platforms
    • atmelavr (Arduino), espressif (ESP8266), ststm32 (ARM etc.)
  • Command line and IDE
    • At work I use pio via Atom IDE on Ubuntu
    • At home, I use a Chromebook with Caret IDE and interact with pio via command-line
    • When developing directly on an emonPi / RaspberryPi pio command-line works great - Yes, that’s right pio works on a RaspberryPi to compile and upload code directly!
  • Excellent library manager
    • Libraries can be searched and reviewed using command-line or web 2.0 manager
    • Required libraries can be specified in the platformio.ini file and if not present install is prompted upon compilation
    • Specific library version (as defined in library.json (emonLib example)) or git commit SHA
  • Fast compilation & pain-free uploading
    • PlatformIO’s compiler is the fastest in the business
    • USB / Serial ports auto detected
    • Since the emonPi has been added as a custom board PlatformIO can even upload direct to emonPi via RaspberryPi GPIO and trigger GPIO AVR reset, not more hacked avrdude.
  • Easy integration with continuous testing & deployment
    • Integration with TravisCI to enable compilation, code testing and binary (.hex / .bin) release generation in the cloud.
    • emonPi and emonTx git repos are now enabled for continous-testing and auto binary generation on release tag…this is a step change in embedded development.
Read on →

Electrical Supply Line Fault

Last week my home emonPi energy monitor came in handy to help diagnose an electrical supply fault.

A neighbour alerted me that her lights were flickering and internet router was dropping offline. At the time I was doing some DIY and had noticed the power drill I was using change speed erratically. I had presumed it was my drill about the give up the ghost.

I checked the Emoncms graph on my emonPi energy monitor and noticed that VRMS was well out of spec at about 150V (we usually get 230V*) and occasionally jumping up to almost 300V! The electrical company was alerted and the fault was traced back to a frayed conductor on our street. I helped the electrical contractors view the real-time VRMS value to confirm the fault was fixed.

VRMS Fault

Read on →

Substantial update to emonPi / emonBase: emonSD-03-May16 pre-built image release

This latest update to emonSD the pre-built SD card image for the emonPi/emonBase significantly enhances the out-the-box functionality of the emonPi by integrating applications such as nodeRED, openHAB and improved MQTT support.

The emonPi in its default configuration works great using Emoncms for data logging and visualisation. However there may be times when more flexibility and the ability to interface with other hardware or services is desirable.

The emonPi with this latest software update is perfectly positioned to become the heart of a smart home automation system. The ‘always-on’ requirement of energy monitoring and the processing power of the Raspberry Pi makes it a fantastic customisable home-hub. See Related Blog Posts at the bottom of this post for inspiration as to what can be achieved.

For the past few years we have made available a pre-built SD card image for the RaspberryPi. Since launching the emonPi last year the pre-built image has been developed extensively. We have now given it a name: emonSD.

The latest update to emonSD (emonSD-03May16) now incudes the following all setup and pre-configured:

Read on →

emonPi / emonBase Raspberry Pi 3

All emonPi’s / emonBase’s shipped to date have included a Raspberry Pi 2. In the next week or so we will be upgrading to include a RaspberryPi 3. This is a nice upgrade: approximately double the processor speed and on-board WiFi with zero cost increase.

Since the RaspberryPi 3 has got on-board WiFi a USB WiFi dongle is not required; even more costing cost saving for our customers, thanks to hard work of the Raspberry Pi foundation and a bit of Moore’s law.

emonPi Raspberry Pi 3 Acrylic Fascia

Read on →