Prepaid Energy Meter using GSM and Arduino
Prepaid Energy Meter using GSM
and Arduino
Prepaid Electricity Energy Meter is a good concept in which you can recharge
its balance, like we do in our mobile phones. In this project we are building a automated system
by using Arduino and GSM module. You can recharge the electricity balance through
this system, just by sending a SMS. It can
also disconnect the home power supply connection, if there is low or zero
balance in the system. And this system will reads
the energy meter readings and automatically send some updates to
user’s mobile phone like low balance alert, cut off
alert, resume alert and recharge alert.
Working explanation:
Here
we have interfaced electricity energy meter with Arduino using
the pulse LED (Calibration or Cal) of electricity Energy meter. We only need to connect tis CAL LED to Arduino
through an Optocoupler IC.
Components used:
·
Arduino
·
GSM Module
·
16x2 LCD
·
Analogue Electricity Energy
Meter
·
Optocoupler 4n35
·
Resistors
·
POT
·
Connecting wires
·
Bulb and holder
·
SIM card
·
Power supply
·
Mobile Phone
When
we power up the system then it reads previous values of rupees stored in EEPROM
and restores them into the variables then checks the available balance with the
predefined value and take action according to them, like if available balance
is greater than 15 rupees then Arduino turns On the electricity of home or
office by using relay. And if balance is less than
15 rupees then Arduino sends a SMS to user phone regarding low balance alert
and requesting to recharge soon. And if
balance is less than 5 rupees then Arudino turns Off the electricity connection
of home and sends a SMS to user’s
phone for ‘Light Cut’ alert and requesting to recharge soon. GSM module has been used to send and receive
messages, you can check about GSM module and AT commands here.
Now
when we need to recharge our system, we can recharge it simply by sending a SMS
to the system, through our Cellphone. Like
if we want to recharge by 45 bucks then we will send #45*, here # and * are prefix and suffix to the recharge amount. System receives this message and extract recharge
amount and update the balance of system. And system again turns On the electricity of the house or office. This flow of working can be understood through the
video at the end.
Circuit Description:
Circuit
connections for this Wireless Electricity Meter Reading Project,
are shown in the diagram; we have used a Arduino
UNO for processing all the things used in project. A liquid crystal display is used for displaying
the status of Units and remaining balance. Data pins of LCD namely RS, EN, D4, D5, D6, D7 are connected to
Arduino digital pin number 7, 6, 5, 4, 3, 2. And Rx and Tx pins of GSM module are directly
connected to the Tx and Rx pins of Arduino respectively. And GSM module is powered by using a 12 volt
adaptor.
A relay is used for switching
electricity connection which is connected at pin 12 of Arduino though ULN2003
relay driver.
How to Connect Energy Meter with Arduino:
First
user need to buy an Analogue Electricity Energy Meter. After it user needs to open it and find the Pulse
LED or Cal LED’s terminals (cathode and Anode). Now solder two wires at both the terminals and
take it out from the energy meter and then close energy meter and tight the
screws.
Now
user needs to connect anode terminal of LED at pin number 1 of Optocoupler and
cathode terminal to pin 2. Pin
number four of optocouper should be directly connected to ground. A LED and a Pull-up resistor are connected at pin number 5 of
optocoupler.
And same terminal should go
to the Arduino pin 8 too.
Calculation of Pulses and Units:
Before
proceeding for the calculations, first we have to keep in mind the pulse rate
of energy meter.
There are two pulse rates of
energy meter first is 1600 imp/kwh
and second is 3200 imp/kwh. So here we are using 3200 imp/kwh pulse rate energy meter.
So
first we need to calculate the Pulses for 100watt, means how many times
Pulse LED will blink in a minute, for the load of 100 watts.
Pulse= (Pluse_rate*watt*time)/ (1000*3600)
So
pulses for 100 watt bulb in 60 seconds, with energy meter of 3200 imp/kwh pulse rate can be calculated as below:
Pulses=3200*100*60/1000*3600
Pulses
=
~5.33 pulse per minute
Now we
need to calculate Power factor of a single pulse, means how much electricity
will be consumed in one pulse:
PF= watt/(hour*Pulse)
PF=100/60*5.33
PF=0.3125
watt in a single pulse
Units= PF*Total
pulse/1000
Total
pulses in an hour is around 5.33*60=320
Units = 0.3125*320/1000
Units = 0.1 per
hour
If a 100 watt bulb is lighting for a day then it will consume
Units =0.1*24
Units = 2.4
Units
And
suppose unit rate is at your region is 5 rupees per unit then
You
have to pay for 2.4 Units Rs:
Rupees= 2.4*5 = 12
rupees
Programing explanation:
First
of all we include required library and Define pins & variables that are
required in our project. This can be seen in first few
lines of our program code below.
After
it we initialize the LCD, serial communication, GSM and display some message
message.
After
this in loop function we read serial received data if any. And reads pulse from energy meter and show units
and balance on LCD.
void
setup()
{
lcd.begin(16,2);
Serial.begin(9600);
pinMode(led,
OUTPUT);
.. ...
... ....
lcd.print("Circuit Digest");
lcd.setCursor(0,1);
delay(2000);
lcd.print("GSM Initilizing...");
gsm_init();
.. ...
... ....
After
this in loop function we read serial received data if any. And reads pulse from energy meter and show units
and balance on LCD.
void
loop()
{
serialEvent();
rupees=EEPROM.read(1);
units=rupees/5.0;
lcd.setCursor(0,0);
lcd.print("Units:");
.. ...
... ....
void init_sms(),void send_data(String message), and void send_sms() functions have been used to send SMS.
gsm_init() function
is used for initializing the GSM module for get ready to operate with the
system.
In this we first sends AT
command to know whether GSM module is connected or not. After it we turned off the echo and then check
the network.
void
gsm_init()
{
lcd.clear();
lcd.print("Finding Module..");
boolean at_flag=1;
while(at_flag)
.. ...
... ...
In check_status() function system reads connection and Balance
conditions; like whether electricity balance is greater than the defined limit. If balance is less than 15 , then it alerts the
user by sending the SMS alert of ‘Low
Balance’ and if balance is less than 5 rupees then
system will cut the electricity and inform the user by sending SMS using
GSM module.
void
check_status()
{
if(rupees>15)
{
digitalWrite(relay, HIGH);
flag1=0;
.. ...
... ....
send_confirmaiton_sms() function is used for sending confirmation
message to the user if recharge has been done and it also update the balance in
the system.
decode_message() function
is used for decoding the amount figure from the SMS message, by using the # and
*
as starting and ending
character.
read_pulse() function
is used for reading pulse from the Energy meter through optocoupler IC. And update the unit and balance.
void
read_pulse()
{
if(!digitalRead(pulsein))
{
digitalWrite(led, HIGH);
if(units<1){}
.. ...
... ....
Demo & Code
Prepaid Energy Meter using GSM and Arduino
Reviewed by XXX
on
สิงหาคม 27, 2560
Rating:
ไม่มีความคิดเห็น