Digital Energy Meter

An electric meter or energy meter is an essential device that goes with consumption of commercially distributed energy. It enables systematic pricing of energy consumed by individual consumer as it measures the amount of electrical energy consumed by a residence, business, or an electrically powered device [1]. They are typically calibrated in billing units, the most common one being the Kilowatts hour, which is equal to the amount of energy used by a load of one kilowatt over a period of one hour, or 3,600,000 joules. Some meters measured only the length of time for which charge flowed, with no measurement of the magnitude of voltage or current. These were only suited for constant-load applications. Neither type is likely to be used today. In addition to metering based on the amount of energy used, other types of metering are available. Meters which measured the amount of charge (coulombs) used, known as ampere-hour meters, were used in the early days of electrification. These were dependent upon the supply voltage remaining constant for accurate measurement of energy usage, which was not a likely circumstance with most supplies. Generally, electricity meters operate by continuously measuring the instantaneous voltage (volts) and current (amperes) and finding the product of these to give instantaneous electrical power (watts) which is then integrated against time to give energy used (Joules, Kilowatt-hours etc.). Meters for smaller services (such as small residential customers) can be connected directly in-line between source and customer. For larger loads, more than about 200 amps of load, current transformers are used, so that the meter can be located other than in line with the service conductors [2]. The meters fall into two basic categories, electromechanical and electronic. This paper dwells on the electronic meter (i.e. the digital meter) An example of a traditional electromechanical meter is shown in figure 1. It has a spinning disc and a mechanical counter display. This type of meter operates by counting the revolutions of a metal disc that rotates at a speed proportional to the power drawn through the main fuse box. Nearby coils spin the disc by inducing eddy currents and a force proportional to the instantaneous current and voltage. A permanent magnet exerts a damping force on the disc, stopping its spin after power has been removed. This class of meters has a number of limitations that has made it grossly irrelevant for use in smart energy initiative environment which include but not limited to its degree of accuracy. There are many methods of error correction in digital electricity meters which are usually based on the known methods of A/D converters error correction, [5]. Most of these methods use software correction based on calibration process. While in digital electricity meter, percentage error could be as low as 0.01%, in analogue meters it is usually above 0.05%. Secondly, the orientation problem associated with electromechanical energy meter is completely a nonissue in a digital energy meter. Hence installation is made easier. Thirdly, the user friendly display in the digital meters makes energy reading from time to time very easy. The fourth and the most serious setback of the electromechanical energy meter is its no-interface capability to external devices.


Electronic meters measure energy using highly integrated components or other customized integrated circuits. These devices digitize the instantaneous voltage and current via a high-resolution sigma-delta ADC.Computing the product of the voltage and current gives the instantaneous power in watts. Integration over time gives energy used, which is usually measured in kilowatt hours (kWh).The design technique for digital meters is influenced by three major factors namely; desired device cost,efficiency and overall size. While the cost is influenced by users’ general affordability, the efficiency and size must
strictly comply with standard.

The block diagram for a digital meter. Here, two basic sensors are employed. These are voltage and current sensors. The voltage sensor built around a step down element and potential divider network senses both the phase voltage and load voltage. The second sensor is a current sensor; this senses the current drawn by the load at any point in time. It is built around a current transformer and other active devices (such as voltage comparator) which convert the sensed current to voltage for processing. The output from both sensors is then fed into a signal (or voltage) conditioner which ensures matched voltage or signal level to the control circuit, it also contain a signal multiplexer which enable sequential switching of both signal to the analogue input of the peripheral interface controller (PIC). The control circuit centered on a PIC integrated circuit. The PIC is selected because it contain ten bit analogue to digital converter (ADC), very flexible to program and good for peripheral interfacing.

The ADC converts the analogue signals to its digital equivalent; both signals from the voltage and current sensors are then multiplied by the means of embedded software in the PIC. Here the error correction is taken as the offset correction by determining the value of the input quality with short-circuited input and storing this value in the memory for use as the correction value device calibration. The PIC is programmed in C language. Such that apart from the multiplier circuit it simulates, it is able to use the received data to calculate power consumption per hour, as well as the expected charges. These are displayed on the liquid crystal display attached to the circuit.

Source Code 

*Project name: Digital Energy Meter 
for more Visit here

This code calculates electrical power and energy of load.
*Test configuration:
MCU: PIC16F887
Oscillator: Crystal, 08.0000 MHz
Ext. Modules: Character LCD 2x16
*Software: mikroC PRO for PIC
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
char txt1[] = "ELDI ";
char txt2[] = "DIGITAL ENERGY";
char txt3[] = "METER";
char txt4[] = "ENERGY METER";
char txt5[] = "KWH";
int volt_res;
int curent_res;
long power;
int energy,i;
long powerlong;
#define INT_RANGE 1000
#define DEC_RANGE 10
LCD_printFix (unsigned int v)
unsigned int w;
unsigned int d;
unsigned char n;
unsigned char blk = 1 ;
v = abs (v) ;
w = v / DEC_RANGE;
for (d = INT_RANGE / 10; d > 0; d /= 10)
n = (w / d) % 10;
if (n)
blk = 0;
If (blk)
LCD_Chr_Cp (' ') ;
LCD_Chr_Cp ('0' + n) ;
void Move_Delay () { // Function used for text moving
Delay_ms (100); // You can change the moving speed here
void Compute_Energy ()
void adc_fetch ()
volt_res = ADC_Read (1);
// Lcd_Out (2,4,"234");
curent_res = 1; //ADC_Read (0);
power = volt_res * curent_res;
powerlong = (long)power * 5000;
powerlong = powerlong / 1023;
power_dis[3] = powerlong / 10000;
power_dis[2] = (powerlong / 1000) % 10;
power_dis[1] = (powerlong / 100) % 10;
power_dis[0] = powerlong % 10;
void Time_Hour ()
Compute_Energy ();
void main ()
// ANSEL = 0; // Configure AN pins as digital I/O
ANSEL = 0x0b; // Pin RA0 and RA1 are configured as an analog inputs
TRISA = 0x0b;
TRISB = 0x00;
// C1ON_bit = 0; // Disable comparators
//C2ON_bit = 0;
Lcd_Init (); // Initialize LCD
ADCON1.F4 = 1; // Voltage reference is brought to the RA3 pin.
// ADCON1 = 0x82; // A/D voltage reference is VCC
Lcd_Out (1, 10, txt1);
Lcd_Cmd (_LCD_CLEAR); // Clear display
Lcd_Out (1,11,txt1);
// for (i=0; i<6; i++) { // Move text to the left 7 times
// Lcd_Cmd (_LCD_SHIFT_RIGHT);
// Delay_ms (20);
// }
// for (i=0; i<6; i++) { // Move text to the left 7 times
// Lcd_Cmd (_LCD_SHIFT_LEFT);
// Delay_ms (20);
// }
Lcd_Cmd (_LCD_CLEAR); // Clear display
Lcd_Out (1,2,txt2); // Write text in first row
Lcd_Out (2,6,txt3); // Write text in second row
Delay_ms (100);
//Lcd_Out (1,1,txt2); // Write text in first row
//Lcd_Out (2,5,txt3); // Write text in second row
//Delay_ms (2000);
Lcd_Cmd (_LCD_CLEAR);
Lcd_Out (1,3,txt4); // Write text in first row
Lcd_Out (2,12,txt5); // Write text in second row
While (1) { // Endless loop
//Lcd_Out (2,4,"234");
adc_fetch ();
// power = volt_res * curent_res;
Lcd_Out (2,6,power);
For (i=0; i<8; i++) {
Lcd_Chr (2,5,48+power_dis[3]); // Write result in ASCII format
Lcd_Chr (2,6,48+power_dis[2]); // Write result in ASCII format
Lcd_Chr (2,7,48+power_dis[1]); // Write result in ASCII format
Lcd_Chr (2,8,'.');
Lcd_Chr (2,9,48+power_dis[0]); // Write result in ASCII format
// Delay_ms (500);

More Posts

gElectron. Powered by Blogger.