Open access peer-reviewed chapter

Low Cost, Robust and Multi-Functional Smart Meter

By Akindele Olufemi Abegunde, Doudou Nanitamo Luta and Atanda Kamoru Raji

Submitted: February 15th 2021Reviewed: February 26th 2021Published: April 26th 2021

DOI: 10.5772/intechopen.96895

Downloaded: 208

Abstract

Environmental awareness, current trends in the power market, the quest for energy efficiency, and the progressive transformation of electricity consumers to prosumers are the primary drives for the gradual shift from the old power grids into the smart grids. The deployment of renewable dispersed generation systems and energy storage units uncovered the need for smart metering to oversee and control those generation systems. This chapter presents the design and development of a robust, efficient, multi-functional, and low-cost smart meter. The proposed metering system has added features that enabled the utilities to recover the meter energy measurement data remotely. The system allows monitoring and transmission of energy consumed in real-time. It considers using a microcontroller board as the controlling unit to execute control and monitor activities. A liquid crystal display displays standard electrical measurements such as current, voltage, power, and energy consumption. The external communication device is required in the unit’s actualization, in conjunction with the control unit based on the existing mobile technology. It stands as the intermediary between the nearby available utility station and consumers or end-users. In conclusion, liquid crystal display displays real-time based data for the end-user to visualize. The usage data billing is done within thirty seconds, stored, and trans-received the process for data collection, keeping, and billing generation.

Keywords

  • smart grid
  • smart meter
  • evolution of electricity meter
  • LCD
  • GSM

1. Introduction

In recent times, the deployment of renewable dispersed generation systems and energy storage units uncovered the need for smart metering to oversee and control the generating units. The first-generation of the smart meter was developed in 2005 to transmit data back to the energy supplier. During the process, transferring data every month was upgraded to sharing of data daily or hourly. The process has helped the customers to be able to consume and produce concurrently. This demonstrates smart meters’ significance to electromechanical devices [1], which is only limited to electricity consumption measurement. References [2, 3] reported that in a year time (2020), an estimated one billion smart meters would be produced globally. The researcher further stated that the US would be closed to 65 million demands quota of smart meters by the said year: the expected highest demand by any country out a billion quantities. More so, dated as far back the year 1990, exploring gathered information collected from an energy metering device to bill through a central database came to limelight through a technology called Automatic Meter Reader over from then electromechanical meter.

The flowchart diagram displayed in Figure 1 illustrates the process involved in smart meter evolution [2, 4]. Reference [5] stated that smart energy meter operates in two formats, such as the automatic meter reader (AMR) and the advanced meter infrastructure (AMI). According to Reference [6], AMR is an electronic meter that employs one-way communication data collection. It is a classy system that automatically calculates billing and relays the information about the energy supplier’s consumption rate remotely. The system could involve various techniques to communicate, including general packet radio service (GPRS), supervisory control and data acquisition (SCADA), radiofrequency (RF), and global system for mobile (GSM). Given this, the researcher concluded that GSM is the most adaptive device with many users and the coverage zone for data transmission. This quality enhances the chances of using the system for metering purposes. Also, energy meters that use GSM prepare data for easy access to energy consumers and energy suppliers.

Figure 1.

Evolution of energy metering to the smart meter.

On the other hand, AMI is an electronic meter that communicates between the energy provider and customers by informing them about the specific interval data. AMI integrates two-way communication and an electronic meter designed to observe and regulate the grid system [7].

A smart metering system could be described as an energy system that measures energy consumption, data collection, data creation, and energy billing activities. References [6, 8, 9, 10, 11, 12] define smart meters as the device built and installed around a home or business to measure real-time consumption rate of electric, gas, and water used to envisage the improvement required for the accuracy, reliability, and efficiency enhancement of the outdated or/and overburden electrical, water and gas grids. Reference [13] categorically stated that a smart energy meter is an electrical device that tracks energy usage, and instantaneously communicates the energy supplier’s outcome. Understandably, the process of transferring the energy captured, recorded, and stored at the electricity distributors through a wireless network takes ≤30 seconds to deliver. Reference [14] described the impact smart meter energy has on enhancing energy efficiency challenges through a concept called intelligent energy network. This concept comprises energy meter devices and intelligent communication technology (ICT). Intelligent energy networking was pointed out as the ultimate energy device needed in achieving smart energy metering systems. This device can effectively monitor and control energy data exchange between the utility and the consumers. This process is performed in two-way directionally between meters to meters regarding the networking type imbibed. Reference [15] mentioned the significance of smart metering as an antidote to a more energy-efficient and metering system that gives accurate meter reading and billing system. However, smart metering has related working principles with the conventional meter in arrangement and calculation of physical quantities but differs from the computational aspect. Smart metering computes less energy consumption rate either in hourly or in seconds rather than in monthly. Reference [5] said that smart energy meter operates in two formats, such as AMR and AMI. AMR communicates and collects data for the utility company just in one direction. In the same section, AMI was described as an electronic meter that communicates between the energy provider and customers by informing them about the data collected at a certain interval. The further description illustrates that AMI integrates two-way communication and electronic meter to observe and regulate the grid system [7]. Additionally, a first-generation smart meter was developed in 2005 to transmit data back to the energy supplier. During the process, transmitting data on a monthly basis was upgraded to sharing data daily or hourly. The process has helped the customers to be able to consume and produce concurrently. This demonstrates smart meters’ significance to electromechanical devices [16], which is only limited to electricity consumption measurement. Apart from that, the electromechanical device lacks consistency when it comes to energy measurement and encouragement for criminal activities. The demand for the supply of electrical energy brings about the existence of electronic meters with additional functions. However, electronic meters work on a principle of digital micro- technology (DMT). The application of this principle has no involvement in the moving disc, which results in wear and tear of the moving parts [17]. The electronic meter performs the automatic meter reading from consumers to both production and control executes by the utility. In that case, the smart energy meter combines the electronic device, intelligent communication technology, and control system in real time.

Advertisement

2. Architectural structure of smart meter

Although smart metering has related working principles with the conventional meter in the arrangement and calculation of physical quantities, they differ in the computational aspect. Smart metering computes less energy consumption rate either in hourly or in seconds rather than in monthly. Figure 2 depicts a smart meter’s general structure comprising two parts: hardware and software. The hardware part consists of three central units: acquisition, data processing, and data transmission units. These units represent the combination of components like a voltage sensor (VS), a current sensor (CS), an energy metering integrated circuit (EMIC), microcontroller unit (MCU), liquid crystal display (LCD), power supply/real-time clock (PS/RTC) and communication unit (CMU) [9, 18, 19].

Figure 2.

Basic architecture of smart meter.

2.1 Data acquisition unit

As one of the units considered in a smart meter’s architectural development, data acquisition is referred to as a unit where analog data is obtained, processed, and converted into a required digital input for data processing. It is advised that careful execution of this process is necessary to generate a reliable result. This unit consists of the voltage sensor (VS), current sensor (CS), and level shifter circuits (LSC) [18]. The VS and CS function as the facilitators of data acquisition before being transmitted to the energy metering integrated circuit (IC) for signal conditioning while simultaneously convert analog to digital developments. This type of controller is a “system on chip (SOC).” SOC constitutes analog front end (AFE) with a microcontroller unit (MCU). More so, AFE is a section of the smart energy device that is connected to the high voltage lines [18, 20]. This component regulates the high voltage and high current rates from the mains into smaller values ADC and MCU can easily absorb or process [21]. The MCU can be referred to as the device’s brain because it dictates and controls all functions initiated within the smart energy meter.

2.2 Data transmission unit

The data transmission unit is responsible for transferring and receiving generated energy parameters to fully notify the billing and monitoring purposes to both the energy supplier and customers. Data is transmitted to a centralized server with customers’ identities stored to determine the customers’ unwillingness and criminal activities such as unpaid electricity usage, electricity theft, and electricity property vandalism [12].

Advertisement

3. Communication network system

Communication network systems for smart energy meters are the essential existing networks adapted into energy metering. It can be subdivided into cables and wireless networks, as shown in Figure 3. According to references [22, 23], a smart meter should be built to carry out functionalities like measuring, applying, and communicating energy parameters to stimulate efficiency and energy supply across households and industries. However, this efficiency is possible through a proper selection of communication networks and ports to manage energy data transmission and reception. Communication network systems must be cost-productive, give great transmittable extent, better security characteristics, data transmission, power quality, and the slightest conceivable number of repetitions.

Figure 3.

Communication network systems for smart energy meters.

Communication can be achieved using various communication procedures, including power line communication (PLC), ethernet, coaxial cable, RF, Wi-Fi, ZigBee, Bluetooth, GSM, and other available methods. The PLC carries data on conductors employed simultaneously for AC electric power transmission or electric power distribution. PLCs have proven to be a cost-effective solution in a large number of scenarios. Moreover, it provides a distribution system operator with a proprietary communication network and innately integrates the sensing and communication functionalities. Consequently, it has become the predominant smart metering technology in the EU and China [24].

Ethernet is the protocol of choice compared to fiber infrastructure for short and long distances. This technique injects a high-frequency carrier into power lines and modulates the carrier with the data to be transmitted [25]. Typically, Ethernet connections are rated at 1, 10, 40, and 100 Gbps, depending on the technology used [26]. Coaxial cable is a high-speed data transfer technology based on cable television infrastructures. Coaxial cable networks were primarily designed for broadcast services, including television and radio channels. Coaxial cable communication is employed as a communication link between home devices, such as smart meters, an electric distribution company, home automation services, home security, and energy management systems in the smart grid context. Its disadvantage is that the entire bandwidth is shared along the line among many customers making the connection slow [25].

ZigBee [24, 27] is an efficient and cost-effective wireless mesh network built on the IEEE standard 802.15.4. However, it offers a low data rate for personal area networks (PANs). The technology can be employed in device control, reliable messaging, home and building automation, remote monitoring, consumer electronics, health care, and several other areas. Estimated data rates are 250 kbps per channel in the unlicensed 2.4 GHz band, 40 kbps per channel in the 915 MHz band and 20 kbps per channel in the 868 MHz band [28].

Wi-Fi technologies consist of 802.11n (300 Mbps), 802.11b (11 Mbps), 802.11 g (54 Mbps) and 802.11a (54 Mbps) [28]. WI-FI support the computer, laptop, game console or peripheral devices. Wi-Fi is generally an upper layer protocol, with IP being the most predominant protocol, allowing communications over the internet without needing a protocol translator. Smart meters with Wi-Fi modules may be utilized for signal repetition, and the addition of repeaters increases the coverage area and network capacity [28]. Bluetooth [28, 29] is another common wireless communications system used to exchange data over short distances. It employs short-wavelength radio transmission (2400–2480 MHz). Its main features are low power consumption and fast data exchange, and widespread availability. Bluetooth technology can be a viable alternative for the communication of control signs and transmit vitality utilization information.

GSM modem [28, 30] operates in similar ways to the mobile phone because they both require internet connectivity to send and receive information. A GSM modem comprises a dedicated modem device with a USB, serial, or Bluetooth connection. Communication with the GSM can be carried out using machine instructions to activate structures on an intelligent modem known as AT command set. The AT command set is widely known as the Hayes standard AT command set. This functions as a set of instructions for configuring and controlling modems. The commands are short sequences of ASCII characters. All command strings (that is, sequences of characters) must be supplementary by the letters AT, an abbreviation for attention that accounts for the set name.

Advertisement

4. Performance evaluations

4.1 Proposed smart meter block diagram

The smart energy operational block diagram in Figure 4 depicts the components of making the smart energy meter for an advanced metering system, thus lessening consumers’ stress in purchasing energy credit units from vendors’ utilities. The device will reduce the production cost, billing cost, and maintenance cost of procuring one from the utility viewpoint.

Figure 4.

Smart meter components.

The smart meter measures the current, voltage, power, and energy consumed by loads. The energy meter comprises the voltage and current sensor that helps with the voltage and current signals’ acquisition. The amount of power utilized, the voltage, and current per time are evaluated, enabling the consumer to understand its consumption. More so, energy usage per time is derived per time, thereby providing a fast energy management method. The metering system is also responsible for relaying the amount of voltage and current consumed by the load to the micro controlling unit for the required parameter computation. Hence, if the measured power rating exceeded 2000 Watts, the micro controlling unit sends a command to the relay to control and reduce consumption rate charges. Therefore, the whole system starts to return the entire process to the initialization input all over again. The code in the micro controlling unit is shown in the appendices.

4.2 Performance assessment

The meter was designed with technical specifications that are identified as accuracy (class 1.0); rated voltage; single-phase (230 V → 250 V); frequency (50 Hz/30A); display (LCD), information record, and energy parameters such as power, current, voltage, power, energy, and cost of billing.

The proposed smart meter was simulated using proteus software. Proteus combines mixed mode SPIC circuit simulation and animated components with various microprocessor models, which facilitate simulation. This assists in developing design and test cases. It emerges amongst the simulation software for electronic design.

The simulated design shown in Figure 5 displays the initialization stage of the smart energy meter. The components are interfaced through the connecting probe. It is seen that the schematic diagram within the simulation showed that the power supply is connected to a potential transformer serving as the voltage sensor. A Zener diode protects the microcontroller unit against any upsurges. The current sensing is based on the Hall effect sensor, with its output increasing by 60 mV for every ampere increment in the measured current. For the voltage sensor, when no current is flowing in the circuit, the device voltage is 0.6 Volt, which is directly proportional to an increase in voltage when increased linearly by 60 mV/A. Caution is taken to ensure that the measured voltage does not exceed the microcontroller’s reference voltage. This is achieved using the zero-crossing detector for enhanced current and voltage measurement.

Figure 5.

Smart meter simulated diagram.

The zero-crossing detector is a device used for the detection of voltage and current crosses in whichever direction. However, a comparator can be used as a zero-crossing detector. Assuming our reference voltage for the comparator is chosen as zero (Vref =0), the input voltage will saturate the comparator. Therefore, two Op-Amp is employed in place of zero-crossing. Both Op-Amps are configured so that their output goes high whenever their negative input goes lower than zero. The voltage sensor minimum voltage is set to 0.6 Volt.

The circuit has a transistor-driven relay connected to the collector side. The voltage impressed on this relay is a rated full coil voltage at the peak period. Although, in OFF time, the voltage is completely zero to avoid any hazard during use. The PNP transistor is connected to control the switching of the relay. This process facilitates the selection of BC 327 PNP transistors because of their capacity to handle the current, voltage, and power supply. The transistor is also driven into saturation (turned ON) when the Logic 1 signal is written on the port pin. Thus, turning ON the relay. The relay is turned OFF by writing Logic 0 on the Port 5 and 13 of the ATmega328P. Also, a free-wheeling diode 1 N4148 is connected across the relay coil. This is done to protect the transistor from damage due to the back electromotive force (EMF) generated within the relay’s inductive coil. Thus, the transistor is turned OFF. The energy is stored in the inductor as dissipated through the diode and the relay coil’s internal resistance when the transistor is switched OFF.

The designed smart meter is depicted in Figure 6, while its tested results are tabularized in Table 1, based on the meter’s response when a fan and a blower are connected. The results show the voltage, current, power, energy, the resulting cost of energy every second, and the cumulative cost of energy.

Figure 6.

Designed smart meter.

TimeVoltage (V)Current (AMP)Power (kW)Energy (kWh)CostTotal cost
17:08:34224:515.411.220.34US$ 0.08US$ 0.08
17:08:35224.285.411.210.34US$ 0.08US$ 0.16
17:08:35224.285.411.210.34US$ 0.08US$ 0.23
17:08:35224.285.471.230.34US$ 0.08US$ 0.3
17:08:35224.285.441.200.34US$ 0.08US$ 0.38
17:08:35224.285.411.210.34US$ 0.08US$ 0.5
17:08:35224.045.441.220.34US$ 0.08US$ 0.54
17:08:35224.045.441.220.34US$ 0.08US$ 0.61
17:08:35224.045.391.210.34US$ 0.08US$ 0.69

Table 1.

Result of smart energy meter when loaded with fan and air blower.

Advertisement

5. Cost assessment

Table 2 presents lists of all variables considered in the smart energy meter design and development, including their costs. The overall cost of the designed smart meter prototype was evaluated to approximately US $ 157. The cost of producing a unit may seem expensive due to the procedures and methods of executing the design. However, a cost comparison between the developed smart energy meter prototype and selected intelligent energy meters (See Table 3) with similar functionalities available in the market was conducted. This comparison demonstrated that the project is cost-effective. For mass production on a commercial scale, the cost will further reduce since components are purchased in bulk.

S/NComponent nameManufacturerPiecesCost (US $)
1USB TTL Serial/RS232 ConverterEIE16.16
2Term N/C PCB 2 W 2.54 GRNDEGSON41.07
3ENCL ABS N/R BK 197 x 114 x 62Plaster Converter18.14
4Socket Banana 4 mm 6A w/h RedEIE21.35
5Socket Banana 4 mm 6A w/h BlackEIE21.39
6Plug Banana 4 mm Stack Rub BLKELE22.51
7Plug Banana 4 mm Stack Rub RedEIE22.47
8PSU W/M I-90/264 o = 09 V @2A2HG POWER119.71
9TRF P = 220 S = 9.5 V 1.5A PCBEIE39.64
10Zener DO-35 500 mW 5.1 V 1N5231BFairchild120.22
11Terminal Block PCB 10 mm 2 W SILDEGSON20.70
12Current Detector BoardEIE15.57
13CAP ELEC RAD 1000uf 6 V3RUBYCON/HITANO41.86
14PS TO92 EBC 50 V 0.8A 60 M 160SOT TECH20.07
15PS TO92 EBC 50 V 0.8A 60 M 160 SMDNXP20.04
16Header SIL STR 40 W 2.54GTX10.225
17Jumper WiresARD117E (40 15 cm)16.78
18GSM Shield SIM900KEYES168.64
19ARDUINO UNO R3CPUT20.04
20LCD1602 module(16x2)HD44780 Adafruit212.92
US$ 156.93

Table 2.

Smart energy meter individual component costs.

CostAvailable smart energy meterCost
Designed low cost smart energy meterUS$ 156.93SMA energy meterUS$ 428.57
CAK smart meteringUS$ 142.86
DMED 130 meterUS$ 176
Linky rolloutUS$ 186
Ontec systems/Itron SAUS$ 103

Table 3.

Smart energy meters in the market.

Furthermore, economies of scale can be described as the cost benefits companies acquire when production becomes effective. It is of utmost importance for every company to increase its production, enhancing the lowering of costs. Reference [31] states that mass production and mass customization determine manufacturers’ products’ behavior. A system that engages mass production operates within a standard that generally accepts and forecasts price reduction through economies of scale. And the price difference between mass-produced and customized goods helps lower the prices of units to achieve ‘low-cost’ in its generality.

Advertisement

6. Conclusions

The chapter presents a smart energy meter design that meets low-cost, energy-efficient, robust, and multi-functional requirements. The device was developed to measure energy consumption rates and billing. Additionally, the proposed system has added features that allow the recovery of the meter energy measurement data remotely. The system enables monitoring and transmission of energy consumed in real-time. A microcontroller board is used as the controlling unit to execute control and monitor activities. An LCD displays standard electrical measurements such as current, voltage, power, and energy consumption. The external communication device was required in the unit’s actualization, in conjunction with the control unit based on the existing mobile technology. It stands as the intermediary between the nearby available utility station and consumers or end-users. In conclusion, liquid crystal display displays real-time based data for the end-user to visualize. The usage data billing is done within thirty seconds, stored, and trans-received the process for data collection, keeping, and billing generation.

Advertisement

Conflict of interest

The authors declare no conflict of interest.

Advertisement

Algorithm Used to Program the Microcontroller Unit.

The code below was programmed into the micro controlling unit, debugged, and simulated through proteus with prototype executed in detail.

#include <mega8.h>

#include <delay.h>

#include <math.h>

#include <stdlib.h>

#include <string.h>

#include <io.h>

//#include <util/delay.h>

//#include <lcd.h>

//#include "lib/sim300/sim300.h"

//#include <sim300.h>

char *number = "9999999999";

float old_energy = 0;

float reference = 300.0;

//LCD

#define RS PORTD.6

#define E PORTD.7

char t1,z1;

//Global Variables initialization

unsigned char buf[10];

//Power facotr values and functions initialization

void pf_func();

unsigned int k=0,x=0,g=0;

float P=0;

float pf=0;

//________Amperemeter & Voltmeter Functions & Variables start_________

int adc_read(int ch);

int adc;

unsigned char buf[10];

float am=0,energy=0;

float vm=0;

// initialize adc

void adc_init()

{

  // Internal Reference Voltage 2.56

  ADMUX = (1<<REFS0) | (1<<REFS1);

  // ADC Enable and prescaler of 128

  // 8000000/128 = 62500

  ADCSRA = (1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);

}

 // read adc value

int adc_read(int ch)

{

  // select the corresponding channel 0∼7

  // ANDing with '7' will always keep the value

  // of 'ch' between 0 and 7

ch &= 0b00000111; // AND operation with 7

  ADMUX = (ADMUX & 0xF8)|ch; // clears the bottom 3 bits before ORing

  // start single conversion

  // write '1' to ADSC

  ADCSRA |= (1<<ADSC);

  // wait for the conversion to complete

  // ADSC becomes '0' again

  // till then, run loop continuously

 while(ADCSRA & (1<<ADSC));

  return (ADCW);

}

//_____Voltmeter Functions End__________

//_____________UART Functions__________

void uart_transmit (unsigned char data)

{

  while (!( UCSRA & (1<<UDRE)));

  // wait while register is free

  UDR = data;

  // load data in the register

}

void string_transmit(char *str){

  unsigned char i=0;

  while (str[i]!=0)

  {

 uart_transmit (str[i]);

 i++;

  }

}

//________Power Factor start______

int powerfactor()

{

k=0;

// To complete number of counts

g=g+1;

//To convert into seconds

pf=(float)g/1000000;

//To convert into radians

pf=pf*50*360*(3.14/180);

pf = cos(pf);

k=abs(ceil(pf*100));

return k;

}

//.....................End Power Factor Code

//............................Begin LCD Code......................................................

int lcd_data(char t)

{RS=1;

PORTB=t;

E=1;

delay_ms(1);

E=0;

delay_ms(1);

t1 = t << 4;

PORTB=t1;

E=1;

delay_ms(1);

E=0;

delay_ms(1);

return 0;}

int writecmd(char z)

{RS=0;

PORTB=z;

E=1;

delay_ms(1);

E=0;

delay_ms(1);

z1 = z << 4;

PORTB=z1;

E=1;

delay_ms(1);

E=0;

delay_ms(1);

return 0;}

void lcd_print(char *str)

{unsigned char i=0;

while (str[i]!=0)

{lcd_data(str[i]);

i++;}}

void lcd_init(void)

{writecmd(0x02);

writecmd(0x28);

writecmd(0x0c);

writecmd(0x01);

writecmd(0x06);}

void lcd_gotoxy(unsigned char x, unsigned char y)

{

  unsigned char firstcharadrs[] = {0x80, 0xC0,0x94,0xD4};

writecmd(firstcharadrs[y-1] + x - 1);

delay_us(100);

}

//___________End of LCD code____________

/*

interrupt [USART_RXC] void intrp()

{

data1=string_receive1();

while(1){

if(strncmp(data1,"off",3)==0){

PORTD.2=1;}

lcd_print("House Disconnected");

data1=string_receive1();

if(strncmp(data1,"on",2)==0){

PORTD.2=0;

break;}

 }

}

 */

void Tx_data(char *str)

{

string_transmit("AT+CMGS=");

uart_transmit('"');

string_transmit(number);

 uart_transmit('"');

uart_transmit('\r');

 while(*str)

{

uart_transmit(*str);

str++;

delay_ms(0);

}

 uart_transmit('\r');

uart_transmit(0x1a);

}

void main(void)

{

//Local Variables

int adc_int[41];

int max=0;

int i=0;

int a = 0;

float max_power = 4000;

// Input/Output Ports initialization

DDRB = 0xff;

DDRC = 0x00;

DDRD = 0b11001100;

//____________UART Initializaion_____________

UBRRH=0x00;

UBRRL=12;

UCSRA=(0<<RXC) | (0<<TXC) | (0<<UDRE) | (0<<FE) | (0<<DOR) | (0<<UPE) | (1<<U2X) | (0<<MPCM);

UCSRB=(1<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (1<<RXEN) | (1<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);

UCSRC=(1<<URSEL) | (0<<UMSEL) | (0<<UPM1) | (0<<UPM0) | (0<<USBS) | (1<<UCSZ1) | (1<<UCSZ0) | (0<<UCPOL);

#asm("sei")

//__LCD Initialization____

lcd_init();

lcd_gotoxy(1,1);

lcd_print("SE METER");

string_transmit("SE METER\r\n");

while(1)

{

 if (a == 0){ PORTD.3 = 1; a = 1;} // Pin n goes high

else{ PORTD.3 = 0; a = 0;} // Pin n goes low; // (PORTD.3 == 1

UCSRB=(1<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (1<<RXEN) | (1<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);

delay_ms(1500);

//_____POWER FACTOR____

pf_func();

x = powerfactor();

P=x;

delay_us(20);

lcd_init();

itoa (x,buf);

lcd_print(buf);

lcd_data('%');

lcd_print("PF");

lcd_data(',');

lcd_data(' ');

//______Ammeter_____

// Initialize ADC

adc_init();

for(i=0; i<=40; i++)

   {

 adc_int[i] = adc_read(1); // read adc value at PORTC.1

   }

   max=adc_int[0];

for(i=0; i<=40; i++)

   {

   if(max<adc_int[i])

   max=adc_int[i];

   }

adc=max - 240;

itoa(max,buf);

//am = (float)(adc*0.006849);// 7/1024

am = (float)(adc*0.0416709 *0.7071);// 32.67/(1024 - 240)

ftoa(am,3, buf);

lcd_print(buf);

lcd_data('A');

lcd_data(',');

//______________Voltmeter___________

 adc_init();

for( i=0; i<=40; i++)

   {

adc_int[i] = adc_read(0); // read adc value at PORTC.0

   }

   max=adc_int[0];

for( i=0; i<=40; i++)

   {

   if(max<adc_int[i])

   max=adc_int[i];

   }

adc=max;

itoa(max,buf);

vm = adc*0.30585 * 0.707; //313/1024

ftoa(vm,2, buf);

 lcd_gotoxy(1,2);

lcd_print(buf);

lcd_data('V');

delay_ms(700);

lcd_init();

lcd_print("***POWER***");

lcd_gotoxy(1,2);

P=P/100;

am=am*vm*P;

if (am/P > max_power){

PORTD.2=1;

}

if (am/P < max_power){

PORTD.2=0;

}

ftoa(am,2, buf);

  //string_transmit(buf);

  // string_transmit("\n\r");

lcd_gotoxy(1,2);

lcd_print(buf);

lcd_data('W');

delay_ms(700);

  am=3.4*am;

  am=am/3600;

  energy=am+energy;

ftoa(energy,2, buf);

  //string_transmit(buf);

  //string_transmit("\n\r");

lcd_init();

lcd_print("***ENERGY***");

lcd_gotoxy(1,2);

lcd_print(buf);

lcd_print("Wh");

  if ((int)energy > (old_energy + reference)){

old_energy = (int)energy;

ftoa(old_energy,2, buf);

Tx_data(buf);

Tx_data("KWH\n\r"); }

}

}

//_________POWER FACTOR FUNCTIONS_____________

void pf_func()

{

while(1)

{

if ( PINC.2==1 )

{

TCNT1=0;

TCCR1B = 0x01; // Start timer at Fcpu/1

break;

}

else

 {

 continue;

}

}

while(1)

{

if ( PINC.3 == 1 )

{

TCCR1B = 0x00;

g=TCNT1;

break;

}

else

 {

 continue;

}

}

}

© 2021 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

Akindele Olufemi Abegunde, Doudou Nanitamo Luta and Atanda Kamoru Raji (April 26th 2021). Low Cost, Robust and Multi-Functional Smart Meter, Smart Metering Technologies, Inderpreet Kaur, IntechOpen, DOI: 10.5772/intechopen.96895. Available from:

chapter statistics

208total chapter downloads

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Advancing Off-Grid Electrification by Uncovering the Holistic Risk Landscape Using a Standardized Risk Management Procedure (SRMP)

By Inken Hoeck and Elmar Steurer

Related Book

First chapter

Membrane Micro Emboss (MeME) Process for 3-D Membrane Microdevice

By Masashi Ikeuchi and Koji Ikuta

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us