POWER LINE COMMUNICATION BASED ENERGY BILLING AND LOAD CONTROLLING

Photo of author

By Jackson Taylor

Home » Electronics Topics » Arduino » POWER LINE COMMUNICATION BASED ENERGY BILLING AND LOAD CONTROLLING

As an Amazon Associate we earn from qualifying purchases.

Most electricity grids were built around large power stations, central control and one-way power flow from the utility to the customer. That design copes poorly with intermittent sources such as wind turbines and solar panels, and it gives the utility little live information about what happens at each meter. Smart metering addresses part of this problem by adding two-way communication between the meter and the utility.

This project shows a small-scale version of that idea. An energy meter’s pulses are counted by a microcontroller, the usage is converted into a bill amount, and the result is sent over the ordinary mains wiring to a PC. From the PC you can also change the tariff and switch the load on or off.

What is power line communication?

Power line communication (PLC) sends data over the same cables that carry electricity. A PLC modem adds a small, high-frequency signal to the mains wiring, and another modem elsewhere on the same wiring picks it up and decodes it. No new cable, SIM card or Wi-Fi network is needed between the meter and the monitoring point.

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

For metering this is a practical choice because meters are already connected to the grid. If you want to see a modem-based design in more detail, see our power line communication modem meter project.

What the system does

  • Energy billing: the meter side counts consumption pulses, converts them to units, multiplies by the tariff and shows the amount on an LCD.
  • Data transfer: the amount is sent over the power line to the PC side at regular intervals.
  • Load control: the PC sends a command that switches a relay, cutting or restoring power to the connected load.
  • Tariff update: the PC can send a new unit rate to the meter side without anyone visiting the meter.

Why this approach is useful

Manual meter reading is slow and error-prone. Automatic reading lets a utility bill on actual usage, spot unusual consumption sooner and disconnect or reconnect a load remotely. Extra systems can be added on top. For example, a Geographic Information System (GIS) can be linked to the metering network to show where a fault is likely to be. Finding and fixing faults faster shortens outages.

See also
TEMPERATURE SENSOR - LM35 -MSP430G2553 - ENERGIA

PLC also has limits. Noise from appliances, long cable runs and transformers can weaken or block the signal, so reliability depends on the installation. Good designs include error checking and retries, which this simple demonstration does not.

BLOCK DIAGRAM

The system has two sides that talk through the power line. The PC side is where the operator sees data and sends commands. The monitoring side sits at the meter, measures consumption and drives the relay.

PC SIDE

Block diagram – PC side

MONITORING SIDE

Monitoring side diagram

CIRCUIT

The first circuit is the main (meter) side, with the microcontroller, LCD, relay and PLC interface. The second is the PC side, which connects the computer’s serial link to the power line.

Circuit – main side Circuit – PC side

Mains voltage is dangerous. If you build this on real wiring, use proper isolation, an enclosure and a relay rated for the load, or test the design in simulation first.

How the program works

The sketch below runs on an Arduino-type board with a 16×2 LCD, a relay on pin 9 and a serial link at 9600 baud to the PLC modem. Its logic is simple:

  1. Counting pulses: an interrupt on a falling edge counts pulses from the energy meter. In this demo, every 3 pulses add one unit. For a real meter, set this to match its pulse rating.
  2. Calculating the bill: the amount is units multiplied by the unit rate. The default rate in the code is 2.
  3. Showing the result: the LCD shows the units and the amount, and the second line shows the relay state.
  4. Sending data: after a fixed number of loop passes, roughly a minute, the board sends the text AMT1- followed by the last two digits of the amount and a carriage return. It then resets the unit count.
  5. Receiving commands: the character d turns the relay output high, which switches the load off in this circuit. The character c turns it low and the load back on. The character k followed by a digit sets a new tariff.
See also
RFID INTERFACING WITH 8051 (HARDWARE AND SIMULATION)

Because only two digits of the amount are sent, the code as written cannot report amounts above 99 in one interval. Extend the conversion routine if you need larger values.

PROGRAM

#include <LiquidCrystal.h>
LiquidCrystal lcd(3, 4, 5, 6, 7, 8);//LCD RS-12,En-11,D4-5,D5- 4,D6-3,D7-2
int t=0,p=0,u=0,y=2,z; //time,pulse,unit,unit rate,amount
char g[5],a;
void setup() 
{      
pinMode(9,OUTPUT);//relay
lcdstart();
Serial.begin(9600);
attachInterrupt(0, blink, FALLING);
}
void loop() 
{
lcd.clear();  
lcd.setCursor(0, 0);
lcd.print("unit=");// Print a message to the LCD.    
lcd.print(u);// Print a message to the LCD. 
z=u*y;
lcd.print(" AMT=");// Print a message to the LCD.    
lcd.print(z);// Print a message to the LCD. 
delay(100);  
power ();
t=t+1;
if(t==600){t=0;
Serial.write('A');del();Serial.write('M');del();
Serial.write('T');del();Serial.write('1');del();Serial.write('-');del();
u=u*y;
adctoascii();
Serial.write(g[2]);   del();Serial.write(g[3]);  del();Serial.write(0xd);  del();
u=0;
}
serial();
}
void serial(void)
{
 if(Serial.available()>0)
{
a=Serial.read();
if(a=='d'){lcd.setCursor(0, 1);lcd.print("off");digitalWrite(9,HIGH);}
else if (a=='c'){lcd.setCursor(0, 1);lcd.print("on ");digitalWrite(9,LOW);}
if(a=='k') //tarif
{
while(!(Serial.available()>0));
a=Serial.read();
y=(a-0x30);
}
else;
} 
}
void power (void)
{
  if(p==3)
{
 u=u+1;  
 p=0;
}
}
void blink()
{
 p=p+1;
}
void lcdstart(void)
{
lcd.begin(16, 2);// set up the LCD's number of columns and rows:
lcd.setCursor(0, 0);
lcd.print("WELCOME");// Print a message to the LCD.
delay(500);
lcd.clear();
}
void del(void)
{
  delay(500); 
}
void adctoascii (void)
{
g[4]=' '; //LSB section
g[3]=(u%10)+0x30;
g[2]=u/10%10+0x30;
g[1]=u/100%10+0x30;
g[0]=u/1000+0x30;//MSB section
}

The comment next to the LCD line does not match the pins actually used in the code. The pin numbers inside LiquidCrystal lcd(3, 4, 5, 6, 7, 8) are the ones that count, so wire the display to match them.

Ways to extend the project

  • Add a prepaid energy meter feature that cuts the relay when the balance runs out.
  • Add tamper or power theft detection and report it to the PC.
  • Control several loads with more relays, as in relay-based home control projects such as our relay-based home control example.
  • Combine meter data with appliance control, as in the billing and home automation version of this project.
  • Add error checking to the serial messages so noisy power lines do not corrupt readings.

FAQ

How does power line communication send data?

A PLC modem superimposes a modulated signal on the mains wiring. A second modem on the same wiring filters it out and passes the data to a microcontroller or PC.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works

Do I need internet or Wi-Fi for this system?

No. Data travels over the power wiring between the two sides. Internet would only be needed if you wanted to forward the data to a remote server.

See also
RFID INTERFACING WITH 8051 (AT89S51) AND SIMULATION IN PROTEUS

Why does the code count three pulses per unit?

It is a demonstration value so the display changes quickly. For a real meter, use the pulse constant printed on it, which states how many pulses equal one unit of energy.

Is it safe to build this on live mains?

Only with proper isolation, correctly rated parts and experience with mains wiring. Beginners should use a simulation or low-voltage test setup first.

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