Académique Documents
Professionnel Documents
Culture Documents
ABSTRACT
The paper discuss a system which makes electric bill payment easier and also controlling of digital meter more easily using
GSM technology. The GSM modem provides the communication mechanism between the user and the energy meter by means
of SMS messages. The energy meter also sends SMS alerts to the user in case of balance goes below some set limit. GSM based
prepaid electricity is a unique and new concept which saves lot of time and power for electricity department. User can recharge
the card whenever the power is required. Electricity department authorities send specially decoded SMS message to the Modem
connected to the energy meter. If the sufficient amount is recharged, then the electrical power department can send the
message through GSM with unique identification number. So the power is delivered to user. Depending upon the user usage of
power, money will be decreased depending up on the power consumption. And a LCD is placed to display the current readings.
Microcontroller is interfaced with GSM modem. GSM based Pre-paid energy meter is a modern era automation system
where we can save the power. Here the devices to be controlled are interfaced with a GSM modem unit, which is capable of
receiving instructions in the form of Short message service and performs the necessary tasks. A dedicated GSM modem with
SIM card is required for each energy meter. The bill amount is also displayed on the LCD screen. The authorities can switch
OFF the power to user if he doesnt pay the bill, through simple SMS.
1. INTRODUCTION
The GSM based energy meter uses a microcontroller which is interfaced with GSM modem. Pre-paid energy meter is
a modern era automation system where we can save the power. Here the devices to be controlled are interfaced with a
GSM modem unit, which is capable of receiving instructions in the form of Short message service and performs the
necessary tasks. A dedicated GSM modem with SIM card is required for each energy meter. The bill amount is also
displayed on the LCD screen. The authorities can switch OFF the power to user if he doesnt pay the bill, through
simple SMS. An EEPROM is provided on the board to store the updated recharge units and energy meter pulse count.
At every instant the count value and units values are stored in EEPROM so that the data will not be lost even in power
failure cases.
2. BLOCK DIAGRAM:
The block diagram and design aspect of independent modules are considered. Block diagram is shown in fig: 1:
6. MODEM SPECIFICATIONS
The SIM300 is a complete Tri-band GSM solution in a compact plug-in module.Featuring an industry-standard
interface, the SIM300 delivers GSM/GPRS900/1800/1900Mhz performance for voice, SMS, data and Fax in a small
form factor and with low power consumption.The leading features of SIM300 make it deal fir virtually unlimited
application, such as WLL applications, M2M application, handheld devices and much more.
7. GSM Architecture
A GSM network consists of several functional entities whose functions and interfaces are defined. The GSM network can be divided
into following broad parts.
1. The Mobile Station (MS)
2. The Base Station Subsystem (BSS)
3. The Network Switching Subsystem (NSS)
1) Mobile Station:
The mobile station (MS) consists of the physical equipment, such as the radio transceiver, display and digital signal
processors, and a smart card called the Subscriber Identity Module (SIM). The mobile equipment is uniquely identified
by the International Mobile Equipment Identity (IMEI). The SIM card contains the International Mobile Subscriber
Identity (IMSI), identifying the subscriber, a secret key for authentication, and other user information. The IMEI and
the IMSI are independent, thereby providing personal mobility. The SIM card may be protected against unauthorized
use by a password or personal identity number.
2) Base Station Subsystem:
The Base Station Subsystem is composed of two parts, the Base Transceiver Station (BTS) and the Base Station
Controller (BSC). The Base Transceiver Station houses the radio transceivers that define a cell and handles the radio
link protocols with the Mobile Station. In a large urban area, there will potentially be a large number of BTSs
deployed. The requirements for a BTS are ruggedness, reliability, portability, and minimum. The Base Station
Controller manages the radio resources for one or more BTSs. It handles radio channel setup, frequency hopping, and
handovers, as described below. The BSC is the connection between the mobile and the Mobile service Switching
Center (MSC).
3) Network Subsystem:
The central component of the Network Subsystem is the Mobile services Switching Center (MSC). It acts like a
normal switching node of the PSTN or ISDN, and in addition provides all the functionality needed to handle a mobile
subscriber, such as registration, authentication, location updating, handovers, and call routing to a roaming subscriber.
These services are provided in conjunction with several functional entities, which together form the Network
Subsystem.
8. PIC Compiler
PIC compiler is software used where the machine language code is written and compiled. After compilation, the
machine source code is converted into hex code which is to be dumped into the microcontroller for further processing.
PIC compiler also supports C language code. Its important that you know C language for microcontroller which is
commonly known as Embedded C. As we are going to use PIC Compiler, hence we also call it PIC C. The PCB, PCM,
and PCH are separate compilers. PCB is for 12-bit opcodes, PCM is for 14-bitopcodes, and PCH is for 16-bit opcode
PIC microcontrollers. Due to many similarities, all three compilers are covered in this reference manual. Features and
limitations that apply to only specific microcontrollers are indicated within. These compilers are specifically designed
to meet the unique needs of the PIC microcontroller. This allows developers to quickly design applications software in a
more readable, high-level language. When compared to a more traditional C compiler, PCB, PCM, and PCH have some
limitations. As an example of the limitations, function recursion is not allowed. This is due to the fact that the PIC has
no stack to push variables onto, and also because of the way the compilers optimize the code. The compilers can
efficiently implement normal C constructs, input/output operations, and bit twiddling operations. All normal C data
types are supported along with pointers to constant arrays, fixed point decimal, and arrays of bits. PIC C is not much
different from a normal C program. If you know assembly, writing a C program is not a crisis. In PIC, we will have a
main function, in which all your application specific work will be defined. In case of embedded C, you do not have any
operating system running in there. So you have to make sure that your program or main file should never exit. This can
be done with the help of simple while (1) or for (;;) loop as they are going to run infinitely.
Dumping steps:
The steps involved in dumping the program edited in proteus 7 to microcontroller are shown below:
1. Select Tools option and click on Check Communication for establishing a connection as shown in below window.
2. After connecting the dumper properly to the microcontroller kit the window is appeared as shown below.
3. Again by selecting the Tools option and clicking on Check Communication the microcontroller gets recognized by
the dumper and hence the window is as shown below.
4. Import the program which is .hex file from the saved location by selecting File option and clicking on Import Hex
as shown in below window.
5. After clicking on Import Hex option we need to browse the location of our program and click the prog.hex and
click on open for dumping the program into the microcontroller.
6. After the successful dumping of program.
10. Simluation Circuit Diagram
The schematic diagram and interfacing of PIC16F876A microcontroller with each module is considered.
The above schematic diagram of Pre-paid Energy meter using GSM explains the interfacing section of each component
with micro controller and energy meter. The crystal oscillator is connected to 9th and 10th pins of micro controller and
regulated power supply is also connected to micro controller and LEDs also connected to micro controller through
resistors
11. Interfacing GSM modem with micro controller:
#include <16F876A.h>
#include <string.h>
#include <stdlib.h>
#include <lcd.c>
#use delay (clock=20000000)
#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM)
byte ch = 0;
byte data[95];
byte help[] = {"help"};
byte rc[] = {"RC"};
byte get[] = { "get" }; //get the meter reading
byte num[17];
byte signal[] = { "0,2" };
int16 count = 0;
unsigned int balance = 0;
void beep(unsigned long duration)
{
output_high(PIN_C4);
delay_ms(duration);
output_low(PIN_C4);
}
void start()
{
lcd_putc('\f'); //Clear LCD Display
lcd_gotoxy(1,1);
printf(lcd_putc,"GSM based Prepaid");
lcd_gotoxy(1,2);
printf(lcd_putc,"prepaid Energy Meter");
delay_ms(3000);
}
void sendingsms()
{
lcd_gotoxy(1,2);
printf(lcd_putc,"Sending SMS...");
}
void shownum()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"num = %s",num);
}
void show_message()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"Received Message");
lcd_gotoxy(1,2);
printf(lcd_putc,"from:%s",num);
}
void main()
{
float energy = 0;
float total_energy = 0.0;
unsigned int freq = 0;
char bill[17];
unsigned int rc_units = 0;
int i = 0;
int j = 0;
lcd_init();
start();
output_high(PIN_C3);
output_high(PIN_C2);
delay_ms(1000);
output_low(PIN_C3);
output_low(PIN_C2);
delay_ms(1000);
output_high(PIN_C3);
output_high(PIN_C2);
delay_ms(1000);
output_low(PIN_C3);
output_low(PIN_C2);
output_high(PIN_C4);
delay_ms(100);
output_low(PIN_C4);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc," Initialising");
lcd_gotoxy(1,2);
printf(lcd_putc," GSM Modem");
output_high(PIN_C3);
init_gsm();
while(1)
{
output_toggle(PIN_C3);
lcd_putc('\f'); //Clear LCD Display
freq = get_timer0();
set_timer0(0); //reset timer after reading it's value. to avoid missing pulses //IMP
lcd_gotoxy(1,2);
READ_COST_EEPROM();
balance = balance - 1;
WRITE_COST_EEPROM(balance);
if(balance == 0)
{
output_low(PIN_C7);
}
energy = freq * (1.0/2200);
total_energy = energy + READ_FLOAT_EEPROM();
WRITE_FLOAT_EEPROM(total_energy);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc," KWH = %4.4f",total_energy);
lcd_gotoxy(1,2);
printf(lcd_putc,"Balance = %u",balance);
delay_ms(1000);
read_gsm_data();
beep(500);
show_message();
delay_ms(5000);
if(strstr(data,rc))
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"Message Received");
lcd_gotoxy(1,2);
printf(lcd_putc," RC");
i = 0;
j = 0;
while(data[i] != '*')
{
i++;
}
i++;
lcd_gotoxy(1,1);
while(data[i] != '#')
{
bill[j] = data[i];
i++;
j++;
}
bill[j] = 0;
rc_units = atoi(bill);
WRITE_COST_EEPROM(rc_units);
output_high(PIN_C7);
send_sms_num();
fprintf(GSM,"Energy Meter Recharged with %u Units\r\n",rc_units);
send_message();
}
else if(strstr(data,get))
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"Message Received");
lcd_gotoxy(1,2);
printf(lcd_putc," get");
send_sms_num();
fprintf(GSM,"Energy Meter Live Reading: %4.4f KWH \r\n",total_energy);
fprintf(GSM,"Balance: %u\r\n",balance);
send_message();
}
else if(strstr(data,help))
{
send_sms_num();
fprintf(GSM,"Send \"RC*Units(1 to 255)#\" for sending recharge amount\r\n");
fprintf(GSM,"Send \"get\" to get the KWH reading.\r\n");
send_message();
}
else
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"Invalid Message");
delay_ms(3000);
}
}
}
REFERENCES
[1]. Raj kamal Microcontrollers Architecture, Programming, Interfacing and System Design.
[2]. Mazidi and Mazidi Embedded Systems
[3]. PIC Microcontroller Manual Microchip.
[4]. Pyroelectric Sensor Module- Murata.
[5]. Embedded C Michael.J.Pont.
P. Kishor received hisB .Tech in Electrical and Electronics Engineering from Mona college of
Engineering & Technol.ogy in 2006 and M.Tech in Power Electronics & Drives from JNTU
Hyderabad in the Year 2011.During 2006-2008 worked as a assistant professor in JBIET
MOINABAD. 2011-2012 worked as a assistant professor in MREC,Dhulapally & from 2012- to till
date Working as a Assistant professor in Matrusri Engineering College,Saidabad,Hyderabad
Dr. D V M Chary completed his AMIE from Institute f Engineers (India) and Post gradation in
Electric Drives and Control from OU, Hyderabad. He received his Ph.D in the area of Power
Systems from JNTUH, Hyderabad. His areas of interest include Neural Networks, Electrical
Machines and Power systems. He has published 2 papers in International/National Conferences 5
papers in International/National Journals. He has 19 years of teaching experience. He is reviewer for
Institute of Engineers (India) Journal
M.V.S ubramanyam received his B.Tech and M.Tech degrees in Electrical and Electronics
Engineering from JNTU, Hyderabad in years 1994 and 2005 respectively. During years 1995-1997
worked as Design Engineer in Control and Schematics Pvt. Ltd. . He worked as Assistant Professor
in Adams Engineering College ,from 1999 2005 and in Vignan Institute of technology and
science during 2005-2006.He worked as Associate Professor in Vignan Institute of technology and
science from 2006-2008 ,CVR College of Engineering between 2008 2011 and in Vignan Bharati
Institute of Technology between 2011-2014.Presently he is Working in Matrusri Engineering College as Assistant
Professor. His areas of inters are Power Electronics and Drives ,Power Systems and MATLAB. He is life member of
Institute of Engineers (IEI) and Indian society for Technical Education(ISTE) .He published about 9
papers 4 in national/International Conferences and 5 in national and International journals