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
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;
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:
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.