Documente Academic
Documente Profesional
Documente Cultură
List of Tables
Table 1: Units of electrical parameters for PZEM-00T ................................................................ 10
Abstract
Internet of Things (IoT) is widely used in industries and businesses like, smart cites, smart grids,
automotive industries, logistics and healthcare. In Electric Power and Energy Systems (EPESs),
smart grids techniques are being implementing to meet the energy demands, improve the energy
efficiency, and reduce energy loses by implementing latest sensing and communication
technologies. In several developed countries, automatic meter reading (AMR), advanced metering
infrastructure (AMI) or smart energy meter with instantaneous energy information report have
been applied at the domestic level. This project, design and implement a low-cost IoT energy
monitoring system (smart energy meter) for real time monitoring of all electrical parameters i.e.
AC voltage, AC current, active power, total energy consumption, power factor, frequency, and
tariff. The design is based on a low-cost PZEM-004T, using non-invasive Current Transformer
(CT) sensors, Arduino and Raspberry pi. Electrical measurements are done by PZEM-004T and
CT sensors through Arduino. Raspberry pi communicates with Arduino through serial
communication to retrieve these sensor’s data and send it to server via internet. As a result, the
developed energy monitoring system can successfully record the voltage, current, active power,
power factor, frequency, accumulative power consumption and tariff. Consumers will be able to
see their electricity usage and the tariff according to the energy usage in real-time through web
and mobile application. In case of any fault e.g. short circuit or power supply cut off, the consumer
will receive a text massage on his mobile number. Moreover, consumer will be able to receive the
tariff on weekly or monthly basis.
1 Introduction
1.1 Smart energy meter
The smart energy meter is a wireless energy monitoring system containing an energy meter with a
communication network topology to efficiently send data from the meters to a server or
coordinator and a cloud platform to visualize the data in actual [1].
1.2 Internet of Things
Internet of Thigs (IoT) is a new architype in communications technology now a days. IoT
concept that is "anything, anywhere, anytime" inspires the development of communication
technology. IoT framework has three elementary concepts, things oriented, internet oriented,
and semantic oriented [2].
The figure 4 show the connection configuration of PZEM-004T module with Arduino. GND and
5V points of module relate to GND and 5V pins of Arduino, and TX and RX points of module
relate to 9 and 10 pins of Arduino.
Figure 4: Arduino connection with PZEM-004T [11]
Now the Arduino is coroneted with Raspberry pi through USB cable. Raspberry pi receive data
from Arduino by serial communication and send it to server. Figure 5 shows the complete circuit
diagram of smart energy meter. The code for Arduino and Raspberry pi is attached in appendix B
and C, respectively.
(a)
(b)
Figure 6(a & b): The dashboard of energy monitoring system
4.1.1 Mobile Application
In Figure 7, the energy patterns on android mobile application. The thingspeak application is
available in google app store. Afte installing the application user will login by his channel ID to
see the dashboard.
6 Future work
Number of improvements can be done in future in term of
• Integrating home automation with smart energy meter dashboard to control electric loads
• Process data for short-term load forecasting and real time decision making.
7 References
[1] S. Yasir, C. Noel, H. R. Mubashir and C. Rebecca, “Internet of Things-aided Smart Grid:
Technologies, Architectures, Applications, Prototypes, and Future Research Directions,”
IEEE Access, vol. 7, pp. 62962 - 63003, 2019.
[2] L. Atzori, A. Iera and GiacomoMorabito, “The Internet of Things: A survey,” Comuputer
Networks, vol. 15, no. 54, pp. 2787-2805, 2010.
[3] M. Yun and B. Yuxin, “Research on the Architecture and Key Technology of Internet of
Things (loT) Applied on Smart grid,” International Conference on Advances in Energy
Engineering, pp. 69-72, 2010.
[4] L. T. Berger and K. Iniewski, Smart Grid Applications, Communications and Security, New
Jersey: John Wiley & Sons, Inc, 2012.
[5] A. C. Swastika, R. Pramudita and R. Hakimi, “IoT-based Smart Grid System Design for
Smart Home,” International Conference on Wireless and Telematics, pp. 49-53, 2017.
[6] H. G. R. Tan, C. H. Lee and V. H. Mok, “Automatic power meter reading system using GSM
network,” International Power Engineering Conference, pp. 465-469, 2017.
[8] K. Chooruang and K. Meekul, “Design of an IoT Energy Monitoring System,” International
Conference on ICT and Knowledge Engineering, 2018.
[9] B. K. Barman, S. N. Yadav, S. Kumar and S. Gope, “IOT Based Smart Energy Meter for
Efficient Energy Utilization in Smart Grid,” IEEE journal, 2018.
[10] J. Mandula, “Interface library for the upgraded version of PZEM-004T v3.0,” Get Hub, 2019.
[Online]. Available: https://github.com/olehs/PZEM004T. [Accessed 28 11 2019].
Appendix A
The PZEM-00T library is available on Get Hub [10].
Arduino code:
//* Code to get the voltage, current and power from two AC PZEM
sensors connected to the Arduino Mega microcontroller, then all the
values *//
// are concatenated in one char variable in order to send it through
serial communication
//
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/
#include <SoftwareSerial.h>
#include <PZEM004Tv30.h>
//#include <PZEM004T.h>
// IPAddress ip(192,168,1,11);
// IPAddress ip1(192,168,1,10);
char Vx[10];
char Ix[10];
char Px[10];
char Ex[10];
char Fx[10];
char PFx[10];
char conc[360];
float V; //Voltage
float I; //Current
float P; //Power
float E; //Energy
float F; //Frequency
float PF;//Power Factor
void setup() {
Serial.begin (9600);
}
void loop() {
float voltage = pzem.voltage();
if( !isnan(voltage) ){
V=voltage;
//Serial.print("Voltage: "); Serial.print(voltage);
Serial.println("V");
} else {
V=0;
// Serial.println("Error reading voltage");
}
float pf = pzem.pf();
if( !isnan(pf) ){
PF=pf;
//Serial.print("PF: "); Serial.println(pf);
} else {
PF=0;
//Serial.println("Error reading power factor");
}
//PZEM004T pzem(10,11); //(RX TX)
//pzem.setAddress (ip);
//V=pzem.voltage(ip); //voltage obtained from the pzem library
//i = pzem.current(ip); //current obtained from the pzem library
//p = pzem.power(ip);//power obtained from the pzem library
delay(1000);
sprintf(conc,": %s, : %s, : %s, : %s, : %s, : %s,\n", Vx, Ix, Px, Ex,
Fx, PFx); // function used to concatenate all the values in one unique
char variable
Serial.write(conc);
}
Appendix B
Raspberry pi python code:
import serial
import time
import re
import thingspeak
import urllib.request
import datetime
import nexmo
start_time = time.time()
chid = 935217
tskey = "TYILB5PXIGBNYSGW"
tsurl =
"https://api.thingspeak.com/update?api_key=TYILB5PXIGBNYSGW&field1=0"
ts = thingspeak.Channel(chid, tsurl, tskey)
def bill_sms():
client = nexmo.Client(key='17e0c2af', secret='eo8eHPkUh4yS9UtR')
client.send_message({'from': 'Nexmo','to': '+447749532518','text':
' Your Electricity Bill is: '+str(Tariff) +"£"})
print("bill sent")
def sms_alert():
client = nexmo.Client(key='17e0c2af', secret='eo8eHPkUh4yS9UtR')
client.send_message({'from': 'Nexmo','to': '+447749532518','text':
' Supply Disconnected!!! '})
def readData():
global Voltage
global Current
global Power
global Energy
global Frequency
global Power_Factor
global Tariff
def sendDataTs():
data = {"field1": Voltage,
"field2": Current,
"field3": Power,
"field4": Energy,
"field5": Frequency,
"field6": Power_Factor,
"field7": Tariff,
}
Ts = urllib.request.urlopen(tsurl +
'&field1=%s&field2=%s&field3=%s&field4=%s&field5=%s&field6=%s&field7=%
s' % (Voltage,Current,Power,Energy,Frequency,Power_Factor,Tariff ))
#print ("Data sent for 6 fields: ", Voltage, Current, Power,
Energy, Frequency, Power_Factor)
while True:
if s1.inWaiting()>0:
inputValue = s1.readline().decode()
#x = "None"
if inputValue:
m =
re.search('.*:(.*),.*:(.*),.*:(.*),.*:(.*),.*:(.*),.*:(.*),',inputValu
e) # command used to read the information and split it between the
charcaters ':' and ','
if m:
readData()
try:
sendDataTs()
T=(time.time() - start_time)/60 #time in minutes
if T>5:
bill_sms()
time.sleep(10)
if Voltage==0:
print("Supply Discunnected")
sms_alert()
time.sleep(15)
except (KeywordInterrupt):
print("Finishing")