Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Gsm based energy meter reading

Status
Not open for further replies.

prabin20

Junior Member level 1
Junior Member level 1
Joined
Mar 16, 2011
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
INDIA
Activity points
1,427
hi guys, I m doing a project on GSM BASED ENERGY METER READING. I have to display energy meter reading on LCD and Send this reading to the user through SMS. this SMS can be send after every 50 units. This project also includes a EEPROM memory to store the data after switching off the microcontroller module. The user also can send a sms to the energy meter to get the status of the current meter reading.

the user also can get the status of no of loads connected to the meter, their status(ON/OFF) by sending a sms and also to switch on/off the loads.



i don't know how to display energy meter reading on LCD and send it to USER by SMS. Guys, Please help me in my project.



I m attaching the block diagram of my project.
 

you need to learn at commands for the gsm first!!!
 

First you need a lcd routine which can display string data on lcd. Then you need a int/float to string conversion routine to convert the meter readings to strings so that it can be displayed on lcd. Next you need to decide which gsm module you want to use in your project. Post the datasheet of the gsm module. Finally you have to write code to send at commands to gsm module.

First write the Relay control routine, then write the lcd code, then the adc code for meter reading, then write the eeprom code, then gsm code, finally integrate all of them. Which MCU and which Compiler are you going to use?

What eeprom will you use? SPI or I2C?
 
Last edited:

sir,im using at89c51 and keil compiler. i hv interfaced energy meters' Cal led with optocoupler mct2e then output from mct2e to microcontroller. but i don't how to count the pulses and display the units on lcd. please help me in coding. 9.png
 

One irrelevant question, what will happen if someone turn on GSM Jamming device ? They need to pay or energy is free for all ?

;-)
 

Does your energy meter give pulses and you want to count the pulses? If yes, you need to use external interrupt to count the pulses.

- - - Updated - - -

@tpetar

What if GSM is jammed, enery meter still runs and meter reading runs. Will the jammer jams the gsm for infinite time? ;-)
 
Last edited:

@tpetar

But there is a time to pay the meter bills. If not paid in due time the power connection will be cut.
 
Last edited:

thanks for your interest in my project. I developed a code which will count 1000 pulses and increment unit =unit+1. i have not used external interrupt (INT0 PIN3.2 of AT89C51). Please developed this code using EXT INTERRUPT (INT0) & also help me to send the LCD display content by SMS to user after every 100 units consumed.



MY Code:

#include<reg51.h>
#define LCD P2

unsigned int Count,Unit,d1,d2,d3,d4,x1,x2,x3,d5,d6,d7,d8,x4,x5,x6,x7;

sbit rs = P1^0;
sbit rw = P1^1;
sbit en = P1^2;
sbit Pulse = P1^3;


void LCDInit ( );
void lcdcmd (unsigned char );
void lcdwrt (unsigned char );
void Delay (unsigned int );
void Conv1 (unsigned int );
void Conv2 (unsigned int );
void main(void)
{
unsigned char z,Disp;
unsigned char code str1[]="ENERGY METER";
//unsigned char code str2[]="PULSE: 0000 ";
unsigned char code str2[]="METER ID:XXX ";
unsigned char code str3[]="UNITS: 0000 ";
P0=0x00;
P1=0x00;
P2=0x00;
P3=0x00;


Count=0x00;
Unit=0x00;

LCDInit();

for(z=0;z<16;z++)
{

Disp=str1[z];
lcdwrt(Disp);
Delay(1);

lcdcmd(0x80);

for(z=0;z<16;z++)
{

Disp=str2[z];
lcdwrt(Disp);
Delay(1);

}
Delay(70);
lcdcmd(0xC0);

for(z=0;z<16;z++)
{

Disp=str3[z];
lcdwrt(Disp);
Delay(1);
}
Delay(70);


while(1)
{
Delay(30);
if(Pulse==0)
{

Count=Count+1;
Conv1(Count);
Conv2(Unit);
if(Count==1000){
Count=0x00;
Unit=Unit+1;

}

}
}
}

}

void Conv1(unsigned int val1)
{
x1 = val1 / 10;
d1 = val1 % 10;

x2 = x1 / 10;
d2 = x1 % 10;

x3 = x2 / 10;
d3 = x2 % 10;

d4 = x3 % 10;

d1=d1+0x30;
d2=d2+0x30;
d3=d3+0x30;
d4=d4+0x30;


}

void Conv2(unsigned int val2)
{
x4 = val2 / 10;
d5 = val2 % 10;

x5 = x4 / 10;
d6 = x4 % 10;

x6 = x5 / 10;
d7 = x5 % 10;

d8 = x6 % 10;

d5=d5+0x30;
d6=d6+0x30;
d7=d7+0x30;
d8=d8+0x30;

lcdcmd(0xc7);
lcdwrt(d8);
lcdwrt(d7);
lcdwrt(d6);
lcdwrt(d5);
Delay(1);


Delay(30);
}

void LCDInit()
{
lcdcmd(0x38);
Delay(10);
lcdcmd(0x0E);
Delay(10);
lcdcmd(0x01);
Delay(10);
lcdcmd(0x0C);
Delay(10);
lcdcmd(0x80);
Delay(10);
return;
}

void lcdcmd(unsigned char value)
{
LCD=value;
rs=0;
rw=0;
en=1;
Delay(1);
en=0;
return;
}

void lcdwrt(unsigned char value)
{
LCD=value;
rs=1;
rw=0;
en=1;
Delay(1);
en=0;
return;
}



void Delay(unsigned int x)
{
unsigned int i,j;
for (i=0;i<=x;i++)
for (j=0;j<=500;j++);
}

keil and simulation files : <A HREF='http://www.uploadmb.com/dw.php?id=1362234543'>pulse count.zip</A>
 
You said your meter provides the pulse and it has to be counted. Is the duration for 100 pulses from meter = duration of 100 pulses in your timer? How do you check that 100 units are consumed? Do you store a first reading eg, 00005000 and then after match it with some reading like 00005150 after sometime and if latest raeding - old reading is >= 100 then send sms?
 

I hope that GSM bill maded by SMS usage will be lower then electricity.

Generaly this concept is not good, I mention earlier, but thread original concept goes in other way.
 

@jayanth.devarayanadurga, yeah !units has to be stored on eeprom, and has to be checked whether old reading is equal to or mor than 100 units before sending sms to user. can u modify my program given above to add these things.

@tpetar can you justify what you said "GSM bill maded by SMS usage will be lower then electricity" ? it will be good for my project.
 

There are many 8051 projects at saeedsolutions.blogspot.in Do you want to use external INT0 interrupt to count the pulses of meter? How do you get the values of meter readings? Does the meter gives a fixed amount of pulses for a fixed amount of reading, like for 100 in meter, 10000 pulses, for 200 meter reading 20000 pulses... like that.

Mention how your MCU will know the value of meter reading. It is very important. I need to know that before writing the code.
 

The digital power meter was set to display six digits with one decimal point reading in kWh unit and a meter constant of 800 impulse per kWh. The digital power meter has an optocouple meant to couple the impulse count to any external electronic circuitry without direct contact to the digital power meter circuitry.

Interface the impulse and synchronize count from the power meter through optocouple circuit and store the meter reading into its internal non-volatile EEPROM memory at every single impulse count interval. In the event of power failure the last meter reading information is stored in the EEPROM. Upon power restoration the power microcontroller will be able retrieve the last meter reading and continue to synchronize with the digital power meter.
 

Your project is simple. All you have to do is use external INT0 interrupt to count the pulses from meter. You have to connect the o/p of opto-coupler to INT0 pin of MCU. Then you have to write an interrupt routine for that. Your meter gives 800 pulses for 1 kWh and you want to write new data to eeprom and send sms on every 100th pulse. right? so, for 1 kWH (800 pulses) you will write 8 times to eeprom and send 8 sms.

A question: Let us assume that the starting meter reading is 500 and in your eeprom it is 0, after 100 pulses meter reading will be 600 and value in eeprom will be 100. How do you get the actual meter reading into the eeprom?

What if the power of gsm meter reader fails. How will it syncronise the reading? What if opto coupler fails? After fixing it, how will you update the eeprom with the new value?
 

@jayanth.devarayanadurga,thanks for your questions. i don't have any idea what to do if these conditions occur during real time operation. can u help in this matter? please also help me in programming to send the meter reading via sms. i don't how to send the readings via sms...... :-(
 
Last edited:

I need the gsm module datasheet. I have to see its at commands. AT89C51 doesn't have internal eeprom. You have to use any other mcu which has internel eeprom or you have to use external I2C or SPI eeprom.

External eeprom code is here

If your initial meter reading is 0, what will be the reading after the meter gives 800 pulses?

Code for INT0 external interrupt on falling edge.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <REG51.H>
 
 
unsigned char ex0_isr_counter = 0;
unsigned char eeprom_flag = 0;
 
void ex0_isr (void) interrupt 0
{
    ex0_isr_counter++;   // Increment the count
    if(ex0_isr_counter == 100) eeprom_flag = 1;
 
}
 
 
void main (void)
{
 
/*-----------------------------------------------
Configure INT0 (external interrupt 0) to generate
an interrupt on the falling-edge of /INT0 (P3.2).
Enable the EX0 interrupt and then enable the
global interrupt flag.
-----------------------------------------------*/
IT0 = 1;   // Configure interrupt 0 for falling edge on /INT0 (P3.2)
EX0 = 1;   // Enable EX0 Interrupt
EA = 1;    // Enable Global Interrupt Flag
 
/*-----------------------------------------------
Wait forever.
-----------------------------------------------*/
while (1)
  {
    if(eeprom_flag == 1) 
    {
        //Your eeprom write code goes here
        eeprom_flag = 0;
    }
  }
}

 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top