In this article, I have discussed a method to measure a power factor using **pic microcontroller**. Power factor measurement using pic microcontroller project is design to measure power factor with the help of pic microcontroller and displays it to LCD.Improvements can be done in this project by adding functionality of automatic power factor correction using capacitors. After reading this article, you will be able to answer following questions?

- What is power factor?
- Why we need of power factor correction?
- How to improve power factor?
- Advantages of power factor improvement?
- Power factor measurement using pic microcontroller.
- Automatic power factor correction using pic microcontroller.

Page Contents

- 1 What is power factor?
- 2 Why we need to improve power factor?
- 3 How to improve power factor:
- 4 Advantages of power factor improvement?
- 5 Power factor measurement using pic microcontroller:
- 6 How to measure time difference two wave for power factor measurement:
- 7 Power factor measurement circuit using pic microcontroller:
- 8 Simulation results in Proteus
- 9 Power factor meter with pic18F452 microcontroller

Let’s start with basic introduction of power factor. Power factor is basically a ration of real power absorbed by electrical circuit to total appearent power consumed by electrical circuit. In other words, power factor is a ratio of real power and appearent power. Many inductive loads are used in power system. Inductive loads need reactive power for their proper operation. So main cause of power factor in electrical power system is reactance. Capacitors provide reactive power. In other words, capacitors generate reactive power and inductors consume reactive power.

Reactive power is basically a burn on power system and transmission lines. Reactive power travel back and forth from power generation point to load and hence a lost of electrical energy. Now a days inductive loads are used in domestic as well as industrial applications. Low power factor cause losses in transmission line and voltage drops in transmission lines. Need of electrical power is increasing day by day, so can’t afford to waste power in transmission line. Therefore we need to improve power factor of electrical power system and loads. By providing reactive power locally at the load side, we can increase power factor of system and power factor of machines. Hence Power factor improvement is local issue. As I have already mentioned, capacitors are source of reactive power. So capacitors can be used to improve power factor or to provide reactive power to load locally instead of from power generations ends.

Before understanding what is power factor? Let me tell you what is good power factor? Unity is ideal power factor. Resistive loads have unity power factor. But all electrical loads are not fully resistive. Therefore we need to improve power factor of these load. Power factor can be increased by adding power factor correction capacitor to loads. Capacitors provide reactive power to load locally . There are many methods have been developed for power factor improvement. But in this article, you will learn about power factor measurement and correction using microcontroller.

Major advantages of power factor improvement are given below:

- It reduces the losses in transmission lines and cables
- It reduces the voltage drop in transmission lines and cables
- It reduces the burden on power generation utility companies

Power factor is basically due to lag and lead concept of current and voltage. When current waveform lags behinds the voltage by some angle, power factor will be lagging and when current wave form leads the voltage by some angle, power factor will be leading. Inductor causes a lagging power factor and capacitors produces leading power factor. Hence capacitors improve power factor by providing leading VARS or reactive power to system which cancels the lagging power factor effect of inductors.

Now the question is how to measure power factor using microcontroller? To measure power factor we need to measure phase angle difference between voltage and current wave form. The cosine of this phase angle is power factor. Power factor is also represented by following formula:

Power factor = Cos (θ)

Where θ is basically phase angle difference between voltage and current wave form. So we need to develop a method to measure phase angle difference between voltage and current wave form. I have used **zero crossing detection **concept to measure time difference between current and voltage wave form. Time difference between two signal or waves can also be used to measure power factor. I will discuss more about it in later part of this article. Now let’s proceed further with zero crossing detection?

Zero crossing detection is used to detect sine wave zero crossing from positive half cycle to negative half cycle or negative half cycle. To measure time difference between two waves we need to detect zero crossing of two waves. There are many methods available to measure zero crossing detection. But I have already posted an article on zero crossing detection using pic microcontroller. I have explained zero crossing detection concept in following article. So I recommend you to read following article first before reading further.

I assume that After reading an article on zero crossing detection, you got the idea about how to detect zero crossing of sine waves using pic microcontroller. In zero power factor measurement circuit, two zero crossing detection circuits are used. One for voltage wave form and other for current wave form. After detecting zero crossing for voltage wave and sine wave we need to measure time difference between zero crossing of voltage and current wave forms.

Now I will discuss how to measure time difference between two waves. It is very easy to measure time difference between two waves with the help of hardware external interrupt pin of microcontroller. hardware interrupt is used to detect zero crossing signal. Microcontroller internal timer is used to measure time. When external interrupt occur on microcontroller pin time will start and after another external interrupt time will stop counting. One interrupt will be generated with the help of current signal and other interrupt with the help voltage signal zero crossing. Timer value will be stored in one variable. This variable value is basically a time difference between two waves. For better results take 20-30 values and take their average.

So using time difference we can easily calculate phase angle using below given formula’s :

Time difference = average values of timer /1000 ;

In above equation 1000 is used to convert time into seconds because half of the sine wave is about 10us and there will 1000 counts per second.

θ = time difference * 2π;

Power factor = Cos ( θ ) ;

After that time difference is multiplied with 2π to convert it into radians and phase angle in radians. After that by using power factor formula we can easily calculate power factor. All these calculations are done in programming by writing a code in microcontroller.

Circuit diagram of power factor measurement circuit using pic microcontroller is given below. Voltage transformer and current transformer is used in power factor measurement circuit.

In above circuit diagram. voltage transformer is used to step down voltage. Because microcontroller can not read high voltage 220v AC directly. Current transformer is used to get wave form of current wave. magnitude of current depend on the load and voltage almost remains constant. After that these signals are fed to zero crossing detector circuit using LM358 operational amplifier. I have already posted an article on zero crossing detection using operational amplifier. For more information about zero crossing detector circuit check following article:

Microcontroller PIC16F877A read zero crossings of voltage and current waveform and start timer according to zero crossing detection of current and voltage wave form. PC16F877A microcontroller is main part of this project. In reads zero crossing detection. measures time difference and calulate power factor according to above given formula’s.After calculating power factor, PIC16F877A microcontroller displays it on 16 X2 LCD.

List of components for power measurement circuit using pic microcontroller is given below:

Category,Reference,Value,Order Code Resistors,"R1",2k, Resistors,"R2",4k, Resistors,"R3",4k, Resistors,"R4",4k, Resistors,"R5",4k, Integrated Circuits,"U1",PIC16F877A, Integrated Circuits,"U2",LM358, Miscellaneous,"AC SOURCE",, Miscellaneous,"CURRENT TRANSFORMER" It can be wind according to requirement, Miscellaneous,"POTENTIAL TRANSFORMER" 220V AC to 12V AC step down transformer, Liquid crystal display: ,"LCD1",LM016L, Variable resistor: ,"RV1",10k,

This guide has provided you all the information you need to measure power factor. I have tried to cover a question on ” How to measure power factor using microcontroller. I recommend you to write your own code for this project. But If you want to purchase code of this project, contact me on my email address. In next article, I will discuss about automatic power factor correction using microcontroller. Suscribe to our blog.

I have been providing project services to students and industry from last 4 years . Contact me if you want to hire me for your projects and engineering problems. Send me your project details at my email address: bilalmalikuet@gmail.com

MQ-2 gas sensor interfacing with pic microcontroller

22 May, 2018rain detector circuit using pic microcontroller – raindrop sensor

21 May, 2018Soil Moisture Sensor YL-69 or HL-69 interfacing with pic microcontroller

19 May, 2018flame sensor interfacing with pic microcontroller

11 Mar, 2018Coin Based Water Dispenser System using pic microcontroller

02 Mar, 2018IOT Based Toll Booth Manager System using pic microcontroller