Smart Digital Energy Meter using power line communication modem

Photo of author

By Jackson Taylor

Home » Electronics Topics » Arduino » Smart Digital Energy Meter using power line communication modem

As an Amazon Associate we earn from qualifying purchases.

Smart Energy Meter   look similar to electronic meters but they are better than both the electro mechanical meters  and the electronic meters in the sense  that  in  addition  to  providing  the  usual  services  of  a  regular  meter,  they  are connected back to the utility through the PLC . It means that there is no need of  an  official  from  the  utility  (which  provides  you  electricity)  to  come  at  your doorstep  and  take  the  meter  readings.  This  can  be  achieved  by  the  use  of microcontroller unit that continuously monitors and records the energy meter readings in its permanent memory location. Smart meters can also be used to shut off service to households and commercial establishments that don‟t pay their bills.The size of smart meters and traditional meters is same  and smart meters are digital  .  Smart  Energy  Meter  measures  more  detailed  readings  than  KWhr  so  that utility can plan the expansion of network and power quality . The Smart Energy Meter is designed so that it measures voltage and load currents by the use of  voltage and current  sensors  instead  of  potential  and  current  transformers  and  then  feeds  these values of voltage and current into energy metering IC.Initial  indications  from  deployents  globally  indicate  that  putting  in  place monitoring systems such as smart meters prevents loss due to electricity theft. It can also  lead  to  lower  power  consumption  as  consumers  who  were  earlier  using  „free‟ power  reduce it  and resort to using only as much as they can pay for legally. Also smart meters  ease the burden on  customers who regularly pay bills by billing them very accurately and often less. GSM and bluetooth technologies are both incorporated in this system. GSM  allows data transfer between the energy  meter and consumer on a regular basis. Here the bill details are send to the consumer in every two months.Bluetooth   provides the facility of accessing the bill details according to their requirement.

See also
INTERFACING RF TRANSMITTER AND RECEIVER

Objectives

  • Real time monitoring of energy meter by KSEB through Power line carrier(PLC) Communication
  • Communication with consumer through GSM and Bluetooth
  • Daily updation of electricity bill in the display
  • Disconnection and reconnection of consumer supply by KSEB according to the bill payment.
  • Power theft control

Block Diagram

Block Diagram Block Diagram Part 2

Circuit

Circuit Diagram

Program

/*-------------------------------
lcd-
D7 -PIN0      E -PIN4
D6 -PIN1      RS -PIN5
D5 -PIN2
D4 -PIN3
RELAY-PIN10 
CT 1-------------A0-
CT 2-------------A1-
TRANSFORMER------A2-
-------------------------------*/
int c1,c2,v,x,p=0,t=0,y=2,z=0;//ct1,ct1,trans,theft,power,unit,amt
u8 u=0;
char g[5],l;
void setup()
{
 pinMode(10,OUTPUT);
 pinMode(11,OUTPUT); pinMode(12,OUTPUT); pinMode(21,OUTPUT);
 digitalWrite(11,LOW); digitalWrite(12,LOW); digitalWrite(21,LOW);
 Serial.begin(9600);
 lcdinit ();
 digitalWrite(10,HIGH);
 delay(1000);
 digitalWrite(10,LOW);
 lcd.setCursor(0,1);
 lcd.printf("u=%d",u);
}
void loop()
{
 lcd.clear();
 //time();
 voltcurrntlcd();     
 theft ();
 p=((c2*v)/100) + p;
 serial1();
 lcd.setCursor(9,1);
 z=u*y;
 lcd.printf("Rs=%d",z);
 lcd.setCursor(0,1);
 lcd.printf("u=%d",u);
 lcd.setCursor(3,1);
 lcd.printf("t=%d",t);
 delay(100);
 t=t+1;
 if(p>13000)
 {
  u=u+1;
  p=0;
  //z=u*y+z;
  //bluetooth();
 }
 if(t>600)   
 {
  digitalWrite(11,HIGH);
  Serial.write('A'); del();Serial.write('M'); del();Serial.write('T'); del();Serial.write('-'); del();
  z=u*y;
  adctoascii();
  Serial.write(g[2]); del();Serial.write(g[3]); del();Serial.write(0xd); del();
  u=0;
  t=0;
  //z=0;
  digitalWrite(11,LOW);
  message();
  bluetooth();
 }
}
void bluetooth(void)
{
 digitalWrite(21,HIGH);
 Serial.printf("amt=");
 Serial.println(z, DEC);
 Serial.write(0xd);//ENTER
 digitalWrite(21,LOW);  
}
void message(void)
{
 digitalWrite(12,HIGH);
 Serial.printf("AT+CMGF=1;");//TEXT MODE
 Serial.write(0xd);//ENTER
 delay(1000);
 Serial.printf("AT+CMGS=");
 Serial.write(0X22);
 Serial.printf("9526418115");//NUMBER
 Serial.write(0X22);
 Serial.write(0xd);//ENTER
 delay(1000);
 Serial.printf("Rs-");Serial.write(g[2]);  Serial.write(g[3]); 
 Serial.write(0x1a);
 del ();
 digitalWrite(12,LOW);
}
void del (void)
{
 delay(500);
}
void serial1(void)
{
 if(Serial.available()>0)
 {
  l=Serial.read();
  //Serial.write(l);
  if(l=='k') //tarif
  {
   while(!(Serial.available()>0));
   l=Serial.read();
   y=(l-0x30);
  }
  if(l=='d'){
   digitalWrite(10,HIGH);
  }
  else if (l=='c')
   digitalWrite(10,LOW);
 }
}
void lcdinit (void)
{
 //LCDPINS----- RS -PIN5   E -PIN4    D4 -PIN3   D5 -PIN2    D6 -PIN1    D7 -PIN0
 lcd.pins(5, 4, 3, 2, 1, 0, 0, 0, 0, 0); // RS, E, D4 ~ D8 
 lcd.begin(16, 2); // set up the LCD's number of columns and rows: 
 lcd.clear();//CLEAR DATA IN LCD
 lcd.clear();
}
void voltcurrntlcd (void)
{
 lcd.setCursor(0,0);
 c2 = analogRead(A1)*10; // energy meter
 delay(10);
 lcd.printf("I=%d",c2);
 c1 = analogRead(A0)*10;
 delay(10);
 lcd.setCursor(7,0);
 v = analogRead(A2)*8/10;
 delay(10);
 lcd.printf("V=%d",v);
}
void theft (void)
{
 x=c1-c2;
 if(x>200) 
 {
  digitalWrite(11,HIGH);
  Serial.write('t'); del();Serial.write('h'); del();Serial.write('e'); del();
  Serial.write('f'); del();Serial.write('t'); del();
  Serial.write('-'); del();
  Serial.write('n'); del();Serial.write('0'); del();
  Serial.write('-'); del();Serial.write('7'); del();
  digitalWrite(11,LOW);
 }
}
void adctoascii (void)
{
 g[4]=' '; //LSB section
 g[3]=(z%10)+0x30;
 g[2]=z/10%10+0x30;
 g[1]=z/100%10+0x30;
 g[0]=z/1000+0x30;//MSB section
}

How the PLC Modem Works in a Smart Meter

A power line communication (PLC) modem sends data over the same mains wiring that carries electricity, so no separate cable or wireless link is needed between the meter and the utility. The modem adds a small data signal to the AC line. A matching modem at the other end, usually at the utility side, filters that signal out and turns it back into digital data.

See also
MOTOR DRIVERS

In this project the microcontroller talks to the modem over a serial (UART) connection. You can see this in the program above: when the usage period ends, the code writes a short text packet to the serial port, starting with “AMT-” and followed by the bill amount digits. In the same way, a theft alert is sent as a text message through the serial port. The modem sends these bytes onto the power line, and the utility side can send back single-character commands. The program reads these commands to set the tariff or to switch the relay that connects or disconnects the consumer.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

Things to Check When Building It

  • Baud rate: The microcontroller, the modem and any other serial device must use the same setting. The program above uses 9600.
  • Shared serial port: The modem, GSM module and Bluetooth module all use one serial port here. The code switches between them with the control pins, so only one module should be enabled at a time.
  • Isolation and safety: The modem connects to mains voltage, so use proper isolation and a coupling circuit. Test with a simulator or a low-voltage setup first.
  • Line noise: Motors, chargers and other loads add noise to the power line, which can corrupt data. Retrying failed messages or adding simple error checking makes the link more reliable.
  • Calibration: The current and voltage scaling in the code is specific to the sensors and transformer used. Recalibrate it for your own parts before trusting the readings.

Compared with a GSM-only meter, a PLC link avoids SIM cards and mobile coverage, but its range depends on the wiring and the noise on the line. This is why the project uses GSM and Bluetooth for the consumer side and PLC for the link to the utility.

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works