Introduction: E-BillBreaker: Smart Power Meter With Dragonboard

This project aims to quantify the power consumption in different environments. They can be homes or even factories.

Step 1: Materials:

Here is the list of materials:

1 - Non-Invasive Current Sensor: SCT013

1 - 220 ohms Resistor

1 - Dragonboard 410c

1 - Shield board 96board arduino

Step 2: Current Sensor

This is a sensor SCT013:

For 1 ampere measured in equipment the sensor show 500uA in your output.
A important point is: Do not connect the sensor in a cable, you have separate the phases and connect it in just one phase.

The sensor have a plug like this (plug), then conect the resistor (220 ohms) between points L-output and K-output.

Then connect the GND in K-output and ADC input in L-output, see picture above.

Step 3: ATmega System

The ATmega software was written to read the value of ADC and calculate the power spends this time and then send the measure to Dragonboard through the serial port.

1 - Using EmonLib to read the ADC and calculate power;

2 - Setup serial port to 9600 bauds to send data;

3 - Calculate simple average from 20 samples to refine the measure;

4 - Send it to DragonBoard 410 via the serial port;

ATmega Firmware

Step 4: Python Script in the Dragonboard

We have used Linaro Linux, which is based on Debian GNU/Linux 8 - kernel version 4.4.23

This script reads the data collected by Mezzanine Board, and sends it to the web server in JSON format. The steps are:

1 - Open the serial port (baudrate = 9600bps);

2 - Read the data in this serial port;

3 - Put data into JSON object:

{

"sensor_value": {

"value": 0,

"sensor_name": "sensor_1",

"region_name": "geladeira",

"region_lat": "-23.611771",

"region_lng": "-46.697565",

"datetime": "2016-06-20T06:37:52.000Z"

}

}

It is important to notice that this package is divided into value measured, the sensor name, region information and information about when the value was collected.

4 - Send it to the Web server through "post", which is a HTTP request method.

The entire code for this step can be accessed here.

Step 5: Web Server

To develop the web server and database, we have used Cloud9
(https://c9.io/). It is an online development environment (which means that there is no need to install anything) that supports many languages such as Python, HTML5, PHP, and Ruby, which is the one that we are used. To be more specific, we have used Ruby on Rails - Ruby is an Object Oriented Programming Language and Rails is a Web Application Framework.

First, we have structured the database. We came up with three main topics: location information, sensor identifier and value measured. The idea is that a region might have one or more sensors and each sensor has its values stored over time.

The code of this part of the project is available here.

Step 6: Interface Google API

Finally, it is necessary to show to the user how much energy each device (or area) is consuming. So, we have used the Google API to generate consumption of a Electrolux RE120 fridge.

Google Charts provides a way to visualize data on your website. From simple line charts to complex hierarchical tree maps, the chart gallery provides a large number of ready-to-use chart types. The most common way to use Google Charts is with simple JavaScript. It loads some Google Chart libraries, lists the data to be charted, selects options to customize charts, and finally creates a chart object. Then, later in the web page, it's necessary to create something with that id to display the Google Chart.

So, we created a web page inside of our database that is responsible for getting data to generate the chart. This webpage asks to the database using JavaScript that returns data in JSON format, just like this:

{

"resources": [{

"sensor_name": "sensor_1",

"lat": -23.611771,

"lng": -46.697565,

"values": [{

"value": 453.82,

"date": "2016-10-30T15:11:32.000Z"

}, {

"value": 453.79,

"date": "2016-10-30T15:11:37.000Z"

}]

}]

}