Is your home energy efficient? Bluemix can figure it out – Part 2

Share this post:

In part one of this series, we introduced you to the idea of utilities monitoring and how “Internet of Things” technology along with IBM Bluemix and its services can be utilized to harness the data associated with household electricity consumption patterns.

In this post, we are going to conclude this idea with an actual project replicating the model setup that we presented in part one.

Project Setup

As a recap, here is the block diagram of the project setup that we presented in the part one of this blog.

There are three components in this project.

  1. IBM Bluemix based energy monitoring server, which captures the net energy consumption data from the energy source and loads in the setup.
  2. Web Dashboard, which provides a real-time view of energy monitoring.
  3. Electrical network, which models the regular electricity supply and distribution within a house. This network also includes an Arduino YUN based controller and sensors for measuring the energy at various points within the network.

The complete source code along with build and configuration details are available the shyampurk/iot-for-utilities project on GitHub.

Energy Monitoring Server

The energy monitoring server program is based on Python and is hosted in IBM Bluemix platform. This application also relies on two Bluemix services, DashDB and PubNub. DashDB is IBM’s in-house database platform for data warehousing needs. PubNub is one of the third party services available under Bluemix catalog which offers a real-time messaging service over the internet. Refer to the steps in README file to understand how to setup and host a python application under Bluemix with DashDB & PubNub.

The source code for this energy monitoring server is located under powerGrid_server directory in the GitHub repository.

Web Dashboard

This is the user interface for monitoring the energy consumption of the model electrical network used for this project.

The web dashboard is hosted on Bluemix, as part of the server application. The communication between a web client and energy monitoring server is orchestrated via PubNub.

The source code of web dashboard is located in powerGrid_webApp/IOTEG directory under the GitHub repository.

Electrical Network

The electrical network is modeled using a solar panel supply and a battery supply ( representing the actual Grid supply). Two loads, a light, and a fan, act as the electrical devices whose consumption pattern need to be tracked. Three sensors are connected to the network, and their measurements are fed to the Arduino YUN controller.

Here is the schematic diagram of this project.

The battery charging circuit in this schematic represents the part of the electrical network which gives back excess energy generated from the solar panel, back to the Grid (the battery in our case). This happens when the energy consumed by the loads is less than what is generated from the solar panels.

The Arduino YUN runs an OpenWRT Linux images which continuously monitors the sensor readings and pushes them to the energy monitoring server every second. PubNub also orchestrates the communication between Arduino YUN and the energy monitoring server.

The source code for the program running under Arduino YUN is located under yun_pubnub & device/current_sense_new directories under the GitHub repository.


PubNub acts as the communication middleware for the entire system. It provides a cloud-based real-time Data Stream Network which supports more than 70+ SDKs, such that it can enable any device to communicate with any other device on the Internet. This application uses three of PubNub’s SDKs for all components to seamlessly communicate with each other. These are:

Building the setup

The Hardware and overall electrical network setup of this project is a little complex than the usual. To simplify things, we can divide it into four steps.

  • Step 1: Power Supply
  • Step 2: Solar Panel Supply
  • Step 3: Battery Charging Circuit
  • Step 4: Final Assembly

Refer the hardware build section under README file to see how the hardware is built.

Get, Set Go !

Once everything is setup regarding the hardware, we have to ensure that our energy monitoring server and its associated services are up on Bluemix dashboard.

Now we are all set.

Fire up the circuit. Launch the web dashboard, and we are all set to track the energy consumption and generation status of this system.

As you can see, the sensor gauges show the readings of the total energy generated from the solar panel, total energy given back to the grid and total energy consumed by the loads. With the light on, the energy consumed is less than generated by the solar cell. Hence the grid supply is not utilized. But with both light and the fan in on state, the consumption exceeds the generation and hence the grid is called into action.

Practical Uses of Energy Tracking

Why would you want to track energy? Apart from the obvious reasons of monitoring and auditing, there are some practical benefits of this.

  • Proactive tracking: Maintaining a periodic moving window average of the energy consumption pattern can help keep things in check and help drive future consumption forecasts. It also helps in generating alerts in case of abnormal deviation from the normal or predicted pattern.
  • Preventive Maintenance: All energy producing sources have an inherent capacity which decays with time. Take the case of a battery. The energy output decays over time and this can be measured and can be acted upon well before a complete breakdown cripples the system.
  • Fault Identification: Electrical appliances do suffer from faults from time to time. This could be a case of outage due to fault in the wiring or connectors, or it could be due to drawing excess current by an old appliance which is not meeting the energy star compliance.
  • Monetization: As mentioned earlier in part one of this blog, net metering can provide some benefits to homeowners by charging them for the net energy consumed. This is a great incentive and can significantly boost the development and sales of alternative, renewable sources of energy.


This project portrays the possibilities of a connected economy of essential services. With every industry getting revitalized with the new landscape of business and service model possibilities, electricity supply and other utilities industries are also evolving towards a smarter world.

Be leveraging the IBM Bluemix ecosystem, we have shown you how we can elevate the concept of connectedness to a new level and assist enterprises and utility service providers to scale up their offerings as per the trend easily. This is also an exciting area for IBM Watson as the amount of data generated is huge and deriving practical benefits of energy tracking from that data could become the real game changer in the medium to long term.

Test link

More How-tos stories
May 1, 2019

Two Tutorials: Plan, Create, and Update Deployment Environments with Terraform

Multiple environments are pretty common in a project when building a solution. They support the different phases of the development cycle and the slight differences between the environments, like capacity, networking, credentials, and log verbosity. These two tutorials will show you how to manage the environments with Terraform.

Continue reading

April 29, 2019

Transforming Customer Experiences with AI Services (Part 1)

This is an experience from a recent customer engagement on transcribing customer conversations using IBM Watson AI services.

Continue reading

April 26, 2019

Analyze Logs and Monitor the Health of a Kubernetes Application with LogDNA and Sysdig

This post is an excerpt from a tutorial that shows how the IBM Log Analysis with LogDNA service can be used to configure and access logs of a Kubernetes application that is deployed on IBM Cloud.

Continue reading