HOUSE'S MONITORING CONSUMPTION
PRESENTED BY:
OMAR HAMMAD, ZAID MAHMOUD, & HAMMAM IMAD
2ND STAGE (EVENING STUDY)
DR. OMAR YOUSSEF
TABLE OF CONTENTS:
INTRODUCTION…………………………………………….2-5
PARTS …………………………………………………....…….6
CAYENNE……….…………………………………..6
SCT-013 CURRENT SENSOR ……………………………………7-8
DESIGN… …………………………………………………….9
CONNECT TO CAYENNE ……….…………………………………..10
CODING ……………….……….11
TEST ……………….……….12-13
CONCLUSION ……………….……….13-14
CODE……………………………………………….…………15-18
Page | 1
HOUSE'S MONITORING CONSUMPTION
INTRODUCTION:
Measuring and monitoring electrical energy
consumption of appliances will help in efficient utilization
and in estimation of the energy usage. The world is becoming
more automated and there is need to have more
environmental friendly usage of electrical power in a way to
save energy and to cater for global warming and future
energy challenges. The development and implementation of
smart energy consumption is of much concern among the
utility stake holders and even though the technology is very
much developed but it is still upcoming. The industries have
fully turn to automated systems whereas the residential
setting are mostly left behind in terms of automation and
efficient usage of the electricity. In line with the push for
green environment and energy efficiency procurement, there
is need to have a low cost, robust and simple to use system
that can monitor the electricity in a smart residence. This
Page | 2
may include the use of mobile communication in the
automation system using wireless networks. We may have an
instance whereby the occupants of the house may turn on or
off appliances like air-conditioner or fan before they arrived
using their mobile phone. In actual sense the electricity
challenges differ from country to country, with inadequate
capacity as the major problems in most developing
countries. However, the efficient and minimized usage of
electricity will be most welcomed in any country of the world.
The energy consumption awareness is a great facilitator of
the energy management, therefore making the energy
measurements available to the consumers and even the
utility companies will make them take appropriate action
towards efficient utilization of the energy. Most of the
Arduino researchers limit their works to power measurement
and some of the energy management systems required the
consumer involvement in order to save energy. A home
energy management system that combines measurements
Page | 3
and automatic control without the involvement of the
consumer is required. In this paper an energy consumption
management system is presented. The system is capable of
measuring the power consumption of the loads, the supply
voltage and the total current consumed by the loads. It
encompasses the use of single phase AC voltage sensor
module (ZMPT101B) and Allegro AC current sensor module
(ACS716), that are used to detect the system voltage and
current. This voltage and current sensors used in the system
are relatively cheap, easy to install in an existing system and
reliable7. The sensor outputs are processed through Arduino
Mega 2560 microcontroller board for the determination of
the relevant quantities after which the system will take
decision of reducing the total load when the system load
exceeded the threshold value. The work generally involved
the experimentation and analysis of the sensors to determine
their behavior or responses with respect to the input values.
The instantaneous calculation method is employed after
Page | 4
ascertaining the uniform sensitivity of the sensors. The
research leads to the establishment of a standalone system
that automatically provides the measurements and control of
the house loads consumption with no involvement of the
consumer action. We will show in these report strategies for
measuring energy. Systems for energy monitoring can be
classified according to different criteria, for example, the
type of sensors they use, or the spatial granularity used for
collecting data. With respect to sensors, it is possible to
distinguish between direct, indirect, and hybrid monitoring
systems. Direct monitoring systems use electricity sensors
for directly measuring energy consumption, while indirect
systems infer energy consumption by measuring other
quantities such as temperature and/or noise.
Page | 5
PARTS:
Arduino UNO
Arduino UNO WiFi shield
Arduino YUN
SCT013 current sensor
CAYENNE:
is a great service that give a platform to everybody that
want make an IoT project. Cayenne is a service for IoT and
also MQTT protocol with a great community, and a lot of
tools. You can use Arduino UNO, Arduino YUN, Raspberry Pi,
and more, for create your personal project.
Page | 6
SCT-013 CURRENT SENSOR:
The SCT-013 sensor is a
noninvasive sensor that measure
the Amps of one circuits.
You can use the sensor for
measure the current of your house. You can put the sensor
on wire that outs by the main switch of house.
Page | 7
See the circuits for preparing the sensor before connect to
the Arduino UNO.
Sensor specs:
Name: SCT-013-0302x
Measure: 30A / 100A max
Components:
10 kOhm Resistor
10 uF Electrolitics Capacitors
Library:
You can download the EmonLib library by
https://github.com/openenergymonitor/EmonLib You can install the
library by using Arduino IDE.
Page | 8
THE SYSTEM DESIGN:
The load management is the major work of the
prototype. Likewise, it measures the power consumption
parameters of the system and display them on the LCD
monitor for the purpose of monitoring. Accordingly, the
system supply to the loads is through an eight channel relay
that switch off some selected loads when the total load is
greater than threshold value. This switching off of the loads
is based priority given to the loads on relay 1 to relay 8 and
a beep alarm will sound to indicate that the total load is
higher than the threshold value before it reduces the loads.
Each time a load or loads are disconnected the system will
require pressing the Arduino reset key or it will reset all the
relays after 3 minutes by assuming that the users have
disconnected the overload.
Page | 9
CONNECT TO CAYENNE:
You can open your account on Cayenne.
Sign Up, and after add a device to your Dashboard.
Click on Add new... Device/Widget
After you can click on Bring Your Own Device. Sign your
credentials and after put this values on your Arduino Sketch
code.
Page | 10
CODING:
You must change the MQTT credentials values, and the
values of your WiFi connection. Open the Serial monitor, and
see the board connecting to internet and putting the data to
Cayenne Dashboard. Open your Cayenne Dashboard, and see
the value. You can See this value by using your computer,
your Smartphone, or your tablet. The Dashboard is in the
cloud. Yes, you can see the data wherever in the world.
TEST Project
Now you can test your project. The Arduino UNO board reads
the value of Watt, and puts this online through the MQTT
protocol. This data is stored on Cayenne server that show the
value on Dashboard. You can see the dashboard, and read
the value of Watts directly, everywhere, every time and it's
Page | 11
completely free! You can read the value in your browser, like
if you are in your house.
You can see my dashboard. If I switch on my oven, I can see
changing the value of Watts on my dashboard. The value
goes up until 2400 Watts. I can trigger this value. When this
changes, and begin to goes up, Cayenne can send a mail to
me, that inform me about the consumption.
This is an information for make me aware of the power
consumption of my house. It's is good for the planet, and for
my wallet!
Page | 12
Conclusion:
This work described the development and implementation
of energy consumption management of a smart house.
Through the effort of developing the system a reliable
analysis is done, and its accurate response is found using
Page | 13
polynomial regression. The prototype built is capable of
managing the system loads effectively by not allowing more
than the threshold value of the power (2000W) to operate in
the system and it is equipped with automatic reconnection
capability. It also correctly measures and display Voltage,
Current, Power consumption and power factor of the system.
The power measurement recorded higher error when
compared to the value obtained.
Page | 14
CODE:
//#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTWiFi.h>
#include "EmonLib.h"
// Sensor Calibrations
const int volt = 220;
const float ct_calibration = 30; // 29 default
const int currentSensorPin = A2;
float Irms = 0;
// Create an Emon instance
EnergyMonitor emon1;
// WiFi network info.
char ssid[] = "ssid";
char wifiPassword[] = "wifiPassword";
Page | 15
// Cayenne authentication info. This should be obtained from the Cayenne
Dashboard.
char username[] = "MQTT_USERNAME";
char password[] = "MQTT_PASSWORD";
char clientID[] = "CLIENT_ID";
unsigned long lastMillis = 0;
void setup() {
Serial.begin(9600);
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
emon1.current(currentSensorPin, ct_calibration);
void loop() {
Cayenne.loop();
//Publish data every 10 seconds (10000 milliseconds). Change this
value to publish at a different interval.
if (millis() - lastMillis > 10000) {
lastMillis = millis();
Page | 16
//Write data to Cayenne here. This example just sends the
current uptime in milliseconds.
Cayenne.virtualWrite(0, lastMillis);
Cayenne.virtualWrite(1, Irms*volt);
CAYENNE_CONNECTED()
CAYENNE_LOG("CAYENNE_CONNECTED");
CAYENNE_DISCONNECTED()
CAYENNE_LOG("CAYENNE_DISCONNECTED");
//Default function for processing actuator commands from the Cayenne
Dashboard.
//You can also use functions for specific channels, e.g CAYENNE_IN(1) for
channel 1 commands.
CAYENNE_IN_DEFAULT()
Page | 17
{
CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s",
request.channel, getValue.getId(), getValue.asString());
if (strcmp(getValue.asStr(), "error") == 0) {
getValue.setError("There are an error");
CAYENNE_OUT_DEFAULT()
CAYENNE_LOG("CAYENNE_OUT_DEFAULT(%u)", request.channel);
Page | 18