The Prepaid Energy meter is rechargeable like mobile phones and theft detection functionality will detect any theft easily. This project consists of an Energy meter with Arduino UNO as the main controller, GSM module, and other sensors. Using this meter one can easily pay his bill just by sending SMS. Also using the Theft detection feature of the meter if someone tries to tamper the meter it will send a message to the electricity department.
Working of Prepaid and Theft Detection Energy Meter:
Components used:
- Analogue Energy Meter
- Arduino
- GSM Module
- 5 Ampere Switching Relay
- 20*4 LCD
- Resistors
- Connecting wires
- Load
- 6-Pin DIP Optoisolators Transistor output(4N35)
- SIM card
- Power supply
- Mobile Phone
When we turn on the smart energy meter it will read the previous reading from EPROM and check its current balance will be less than 25 rupees then through GSM, Arduino will send a warning message to the user phone and if the balance will be less than 5 then through switching relay Arduino will cut off the load. In order to switch on the load user will have to recharge its balance for the prepaid energy meter. If some try to open the meter then it will send a message to our electricity supply company. GSM module is used in the circuit to send and receive messages between uses and electricity Supply companies.
GSM Based Smart Energy Meter With theft Detection and Load control
Advantages (Arduino based Energy Meter)
The advantages of smart meter are as follow
- No need of a meter reader
- Prepaid friendly
- Accurate bills- no more estimates
- Theft Detection
Disadvantages ( Energy meter Using Arduino)
- Installation Cost
- GSM Dependent System
Prepaid and Theft Detection Energy Meter Using Arduino (Code)
#include<EEPROM.h>
#include <LiquidCrystal.h>
#include<SoftwareSerial.h>
/* you can change pin configuration. As per your requirement for lcd*/
LiquidCrystal lcd(7,6,5,4,3,8);
int led=13;
int alert=9;
#define pulsein 2
#define relay 12
#define theft 11
unsigned int pusle_count=0;
float units=0;
unsigned int rupees=0;
float watt_factor=0.3125;
unsigned int temp=0,i=0,x=0,k=0, count;
int theftState = 0;
int pulseState = 0;
char str[70],flag1=0,flag2=0;
boolean theft_flag=1;
boolean relay_flag=1;
String bal=””;
void setup()
{
pinMode(pulsein, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(pulsein), read_pulse, FALLING);
lcd.begin(16,2);
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(alert, OUTPUT);
pinMode(pulsein, INPUT);
pinMode(relay, OUTPUT);
pinMode(theft, INPUT);
digitalWrite(pulsein, HIGH);
/*pinMode(9, OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);*/
lcd.setCursor(0,0);
lcd.print(“Smart Energy”);
lcd.setCursor(0,1);
lcd.print(” Meter “);
delay(2000);
lcd.clear();
lcd.print(“GEEKY Engineers”);
lcd.setCursor(0,1);
lcd.print(“Youtube:”);
lcd.setCursor(0,1);
lcd.print(“Geeky Engineer”);
delay(2000);
lcd.clear();
lcd.print(“GSM Initilizing…”);
gsm_init();
lcd.clear();
lcd.print(“System Ready”);
Serial.println(“AT+CNMI=2,2,0,0,0”);
init_sms();
send_data(“System Ready”);
send_sms();
delay(1000);
digitalWrite(led, LOW);
lcd.clear();
EEPROM.write(1,0); /* here 0 means inbuit zero balance, if you write 30
then inbuit 30 rs balance, 1 is a memory location*/
rupees=EEPROM.read(1);
}
void loop()
{
theftState = digitalRead(theft);
pulseState = digitalRead(pulsein);
serialEvent();
rupees=EEPROM.read(1);
units=rupees/5.0;
lcd.setCursor(0,0);
lcd.print(“Units:”);
lcd.print(units);
lcd.print(” “);
lcd.setCursor(0,1);
power_theft();
if(rupees<15)
{
lcd.print(“Low Balance:”);
}
else
{
lcd.print(“Balance:”);
}
lcd.print(rupees);
lcd.print(” “);
check_status();
if(temp==1)
{
decode_message();
send_confirmation_sms();
}
}
void serialEvent()
{
while(Serial.available())
{
char ch=(char)Serial.read();
str[i++]=ch;
if(ch == ‘*’)
{
temp=1;
lcd.clear();
lcd.print(“Message Received”);
delay(500);
break;
}
}
}
void init_sms()
{
Serial.println(“AT+CMGF=1”);
delay(200);
Serial.println(“AT+CMGS=”+92XXXXXXXXXX””);
delay(200);
}
void send_data(String message)
{
Serial.println(message);
delay(200);
}
void send_sms()
{
Serial.write(26);
}
void read_pulse()
{
if(!digitalRead(pulsein))
{
digitalWrite(led, HIGH);
count++;
units=watt_factor*count/1000; /* 1000 impulse means 1 kwh */
if(units<1){}
else
units–;
rupees=units*15;
EEPROM.write(1,rupees);
while(!digitalRead(pulsein));
delay(2000);
digitalWrite(led,LOW);
}
}
void check_status()
{
if(rupees>25)
{
digitalWrite(relay, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
flag1=0;
flag2=0;
}
if(rupees<25 && flag1==0)
{
lcd.setCursor(0,1);
lcd.print(“Low Balance “);
init_sms();
send_data(“Energy Meter Balance Alert:”);
send_data(“Low Balancen”);
Serial.println(rupees);
delay(200);
send_data(“Please recharge your balance.n Thank you”);
send_sms();
message_sent();
flag1=1;
}
if(rupees<5 && flag2==0)
{
digitalWrite(relay, LOW);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
digitalWrite(9, HIGH);
lcd.clear();
lcd.print(“Light Cut Due to”);
lcd.setCursor(0,1);
lcd.print(“Low Balance”);
delay(2000);
lcd.clear();
lcd.print(“Please Recharge “);
lcd.setCursor(0,1);
lcd.print(“UR Energy Meter “);
digitalWrite(9, LOW);
init_sms();
send_data(“prepaid energy meter Balance Alert:nLoad has been cut off due to low BalancenPlease recharge your balance.n Thank you”);
send_sms();
message_sent();
flag2=1;
}
}
void decode_message()
{
x=0,k=0,temp=0;
while(x<i)
{
while(str[x]==’#’)
{
x++;
bal=””;
while(str[x]!=’*’)
{
bal+=str[x++];
}
}
x++;
}
bal+=”;
}
void send_confirmation_sms()
{
int recharge_amount=bal.toInt();
rupees+=recharge_amount;
EEPROM.write(1, rupees);
lcd.clear();
lcd.print(“Energy Meter “);
lcd.setCursor(0,1);
lcd.print(“Recharged:”);
lcd.print(recharge_amount);
init_sms();
send_data(“prepaid energy meter Balance Alert:your balance has been recharged Rs:”);
send_data(bal);
send_data(“Total Balance:”);
Serial.println(Rupees);
delay(200);
send_data(“Electricity Has Been Sucessfully Connected n Thank you”);
send_sms();
temp=0;
i=0;
x=0;
k=0;
delay(1000);
message_sent();
}
void message_sent()
{
lcd.clear();
lcd.print(“Message Sent.”);
delay(1000);
}
void power_theft()
{
theftState = digitalRead(theft);
if(theft_flag==1)
{
if(theftState == HIGH)
{
lcd.clear();
lcd.print(” Power Theft “);
lcd.setCursor(0,1);
lcd.print(” Detected “);
delay(2000);
lcd.clear();
digitalWrite(relay, HIGH);
digitalWrite(relay, LOW);
init_sms();
send_data(“Theft Detected n Meter ID:1990”);
send_sms();
delay(1000);
message_sent();
delay(2000);
lcd.clear();
lcd.print(“Contact Your”);
lcd.setCursor(0,1);
lcd.print(” Distributor “);
theft_flag=0;
while(relay_flag==1)
{
digitalWrite(relay, LOW);
digitalWrite(relay, LOW);
}
relay_flag=0;
}
}
}
void gsm_init()
{
lcd.clear();
lcd.print(“Finding Module..”);
boolean at_flag=1;
while(at_flag)
{
Serial.println(“AT”);
while(Serial.available()>0)
{
if(Serial.find(“OK”))
at_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print(“Module Connected..”);
delay(1000);
lcd.clear();
lcd.print(“Disabling ECHO”);
boolean echo_flag=1;
while(echo_flag)
{
Serial.println(“ATE0”);
while(Serial.available()>0)
{
if(Serial.find(“OK”))
echo_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print(“Echo OFF”);
delay(1000);
lcd.clear();
lcd.print(“Finding Network..”);
boolean net_flag=1;
while(net_flag)
{
Serial.println(“AT+CPIN?”);
while(Serial.available()>0)
{
if(Serial.find(“+CPIN: READY”))
net_flag=0;
}
delay(1000);
}
lcd.clear();
lcd.print(“Network Found..”);
delay(1000);
lcd.clear();
}
After reading this article “Arduino Based Energy Meter” you will be able to make energy meter for your final year project. We have tried to cover each aspect of meter and will look for more and try to add those in the next update. How does it work for you? Let us know in the comments section below.
amazing, keep it up
How Can I buy it from u ,
7892523038 wts ap me.i need this
contact me on Instagram
hey sir, i thing its great project i am final year student and i want to complete my project with this project so can you kindly send me the full circuit diagram and simulation diagram or demo if there is my email mebratuhaiu54@gmail.com