3 Phase Smart Energy Meter using Arduino

3 Phase Smart Energy Meter using Arduino

In this article, we are going to discuss that how to design a 3 Phase Smart Energy Meter using Arduino. The meter will enable us to measure Energy Units consumed by 3 phase loads. Also, the same meter can connect or disconnect the 3 phase load remotely. The communication medium between Energy Meter and User may vary with respect to the application.

Currents and Voltages of the appliances will be sensed using Current and Potential Transformers. Arduino will convert analog values from Current and Potential Transformer into digital values. After that it will further processes these values to calculate Power and Energy.

After getting measured Energy and Power values Arduino will manage to send these values over the communication medium. This communication medium can be GSM / GPRS/ Wi-Fi/ ZigBee/ PLCC etc.

A complete discussion on the comparisons of different communication mediums can be studied here.

Here we will focus on how to design a 3 phase Smart Energy Meter using Arduino without going into the details of communication medium.

Components Description

Components needed for the project is as follows:

You can buy the high-quality components in lowest price possible by clicking on the item name:

Complete Circuit Diagram

Without going into the details of the setup let’s have a quick look on the complete circuit diagram.

3 phase Smart Energy Meter Circuit Diagram
Figure1: 3 phase Smart Energy Meter Circuit Diagram

Hardware Part

To explain the hardware part of the project, I am going to break the circuit into small parts so that it will be easy to understand.

Let’s start with the Energizing circuit of the system.

Energizing Circuit

We are discussing this part at first because this will energize the whole circuit including micro-controller, Communication Medium Device, LCD or whatever other devices are connected. Let’s have a look on this part:

Energizing Circuit for 3 phase Smart Energy Meter
Figure 2: Energizing Circuit

A separate transformer will be required to step down the voltage, so that we can make it possible to energize the whole circuit without any external adapter. This circuit will help the system to make it completely independent of the requirement of externally energizing of the system. The voltage regulator 7805 will hold the output voltage of the circuit at 5 volts. A LED is present here for the indication whether the Smart Energy Meter is Powered ON or OFF.

A ground symbol in present beneath the circuit which directs that the circuit should be connected with the ground of whole system.

Study some other ways how to make 5 volts for your circuit here.

4 bit LCD interfacing to Arduino

First we need to enable the header file (‘#include <LiquidCrystal.h>’), this header file has instructions written in it, which enables the user to interface an LCD to UNO in 4 bit mode without any fuzz. With this header file we need not have to send data to LCD bit by bit, this will all be taken care of and we don’t have to write a program for sending data or a command to LCD bit by bit.

Second we need to tell the board which type of LCD we are using here. Since we have so many different types of LCD (like 20x4, 16x2, 16x1 etc.).

Here we are going to interface a 16x2 LCD to the UNO so we get ‘lcd.begin(16, 2);’. For 16x1 we get ‘lcd.begin(16, 1);’.

Thirdly we are going to tell the board where the pins of LCD will be connected. The pins which are connected need to be represented in order as “RS, En, D4, D5, D6, D7”. These pins have to be represented correctly. Since we have connected RS to PIN 22 and so on as show in the circuit diagram, we represent the pin number to board as “LiquidCrystal lcd(22, 23, 24, 25, 26, 27);”.

Lastly,  the data which needs to be displayed in LCD should be written as “ lcd.print( “3 Phase SEM");”. With this command the LCD displays ‘3 Phase SEM’. Connection Diagram is as follows:

4 Bit LCD interfacing with Arduino
Figure 3: 4 Bit LCD interfacing

Voltage Measurement Circuit

The voltage measurement circuit consisted of three main parts: the voltage transformer, DC rectification and voltage divider. The voltage transformer steps down the voltage from the 220 V AC to 6V AC. Then a diode is used to rectify the negative part of the voltage. ADC of Arduino is only rated for voltages between 0 and +5V DC on any input pin. Therefore, the voltage was once again lowered by a voltage divider circuit. Have a look on the circuit diagram:

Voltag measuring Circuit of 3 phase Smart Energy Meter
Figure 4: Voltage Measuring Circuit

A complete article related to AC voltage Measurements can be study here.

For simplicity I haven’t included angle measuring parts of voltages. If you want to study comprehensive article on 3 phase voltage measuring part. Then click the link below:

3 phase voltage measurement with Angle Measurement

Current Measurement Circuit

This current measuring circuit should be connected with the series of the Load and Source. So that whole current should pass through the CT. The components used are as follows: the current transformer, burden resistor, , rectifier, and voltage divider.

The current transformer stepped down the current down from line current to a more tolerable level. However, the Arduino micro-controller cannot read the current directly, it can only read voltages, so a burden resistor was used. This burden resistor converts the current to a limited voltage for the Arduino to read. This voltage will then be converted into suitable calibrated value. As shown in figure below.

Current Measuring Circuit of 3 phase smart energy meter
Figure 5: Current Measuring Circuit

A complete article related to AC current Measurement can be study here. 

Control Circuit

This circuit will connect and disconnect he load w.r.t the requirement. Here diode is for the protection of sensitive parts, it will prevent relay to send back currents to the sensitive areas.

Side Note: Here in the circuit diagram only one control circuit is present on 1 phase only but in professional system you have to connect three relays on each phase.

Control Circuit of 3 phase Smart Energy Meter
Figure 6: Control Circuit

A complete discussion on Electro-mechanical relay can be studied here.

Simulation of 3 Phase Smart Energy Meter using Arduino

This circuit is only for debugging purpose of coding areas. As next we are going to discuss coding, so it is necessary to have a look on the simulation diagram. This diagram is designed on Proteus 8. You can download simulation file from the button present below the article.

Simulatin of 3 phase smart Energy Meter
Figure 7: Simulation Diagram

Output of virtual termial

Output of Virtual Terminal
Figure 8: Output of Virtual Terminal

Coding Part

Complete code can be downloaded from the button present at the end of Article, here we are going to discuss some specific parts of codes only.

Voltage & Current Measuring part

First of all look at the code present below, this part will measure the voltage of phase 1.

//------Phase 1 Voltage ---------
    for(int i=0; i<=39; i++){
          adc_int[i] = analogRead(A0);
           }
          int max = adc_int[0];
   for(int i=0; i<=39; i++){  
           if(max < adc_int[i])
           max = adc_int[i];  
           }
  float V0 = max * (5.0 / 1023.0);
        V0 = V0 * 220;
        // This is your calibration value
        // Adjust this value according to your circuit

Upper portion of this part consists of two loops. Both loops are trying to get the peak upper value of the voltage waveform. After getting the peak value of the voltage waveform, calibrate it with some reference meter or some reference load. Same goes to current measuring part.

Power & Energy Measuring Part

This part will calculate the power and then accumulate in Energy Variable to finally get the measured energy units. Let’s have a look:

// Formulas to Convert Currents
// and voltages into Power and Energy
float P = V0*I0 + V1*I1 + V2*I2;
      P = P/1000;
int   xnew =  millis()/1000 - xold;
      xold = millis()/1000;
float kW = P* xnew;
      kW = kW/3600;
      AkWh = kW + AkWh;

To get power from measured voltage and current, we used 3 phase power formula.

P = V1xI1 + V2xI2 + V3xI3

This formula will help us to get instantaneous power of the load. To simplify the system I didn’t include power factor part of the formula. If you want a professional version of the 3 phase Smart Energy Meter than you have to include power factor circuit as well.

To Study how to measure power factor click here.

After getting power convert it into kW so that we can ultimately get kWh (Energy Units). I hope you have a basic concept of Energy units. If don’t then study here.

Now that we have power in kW, so we can convert it into kWh by multiplying it into time consumed between the measurement of two samples of power. This time consumed is measured through a very efficient and simple function of Arduino: Millis Function.

As we have Energy in kWh, we will accumulate it into AkWh variable.

Load Controlling part:

This part will connect/disconnect the load if the consumer if using load above the sanction load. In this example sanction load of the consumer is 16kW.

if (kW > 16){
 digitalWrite(53, LOW);
 delay(5000); //Warning for 5 seconds
 // Can be ajdusted according to the requirement
}
if (kW <= 16){
 digitalWrite(53, HIGH);
}

After interfacing communication medium we will able to connect/disconnect load remotely according to the coding lines above.

I think this is enough discussion regarding 3 phase Smart Energy Meter using Arduino.

If you need more help or have some more to share then feel free to comment below and don’t forget to like our facebook page.

Click the buttons below the get whole simulation file of Proteus 8 and Complete Code of the Project.

Ismail Sarwar

Electrical engineering is my profession, my hobby and my passion. I completed bachelors of electrical engineering in 2015. Currently I am working with an Electric Utility Company. Power Electronics, Embedded Systems and Energy Metering are my fields of specialization. In free time I listen music and watch movies.

What do you think?