top of page
Writer's pictureSanskruti Ashtikar

Automatic Power Factor Correction using PIC Microcontroller

Introduction


Power Factor (PF) is a crucial parameter in electrical systems that measures how efficiently electrical power is being used. In an ideal scenario, the power factor should be 1 (or unity), meaning all the power supplied by the source is being effectively utilized by the load. However, due to inductive loads like motors, transformers, and fluorescent lighting, the power factor tends to drop below unity. A low power factor indicates inefficient utilization of electrical power, leading to increased power losses and higher electricity bills.

Automatic Power Factor Correction (APFC) systems are designed to improve the power factor automatically by compensating for the reactive power in the system. This article explains how to design an APFC system using a PIC Microcontroller.


Working Principle of Power Factor


Power Factor is the ratio of real power (kW) to apparent power (kVA). It is given by the formula:

Power Factor (PF)=Real Power (kW)Apparent Power (kVA)\text{Power Factor (PF)} = \frac{\text{Real Power (kW)}}{\text{Apparent Power (kVA)}}Power Factor (PF)=Apparent Power (kVA)Real Power (kW)​

A power factor of less than 1 means that some of the power is wasted. The presence of inductive or capacitive loads causes the current to lag or lead the voltage, resulting in a phase difference. The cosine of this phase difference is the power factor.


Importance of Power Factor Correction


  1. Reduction in Electricity Bills: Poor power factor leads to higher energy consumption, which translates into higher electricity bills.

  2. Increased Capacity: By improving the power factor, the electrical system can carry more real power for the same apparent power.

  3. Reduction in Transmission Losses: A higher power factor reduces the losses in electrical transmission.

  4. Prevention of Overloading: Improper power factor can cause overloading of equipment, leading to frequent breakdowns.


Components Required


  1. PIC Microcontroller (e.g., PIC16F877A)

  2. Zero Crossing Detector Circuit (using an Operational Amplifier or Optocoupler)

  3. Capacitor Bank (with relay switches)

  4. Current Transformer (CT)

  5. Potential Transformer (PT)

  6. LCD Display (16x2)

  7. Relays (for switching capacitors)

  8. Resistors, Capacitors, Diodes, etc.

  9. Power Supply


Circuit Diagram


Before we delve into the code and working, here's a brief overview of the circuit:

  1. Zero Crossing Detection: A zero-crossing detector circuit is used to detect the points where the voltage and current waveforms cross zero. This information is crucial to measure the phase difference between current and voltage.

  2. Current and Voltage Measurement: A current transformer (CT) is used to measure the current, and a potential transformer (PT) is used to measure the voltage.

  3. PIC Microcontroller: The PIC microcontroller (e.g., PIC16F877A) processes the zero-crossing signals, calculates the phase difference, and accordingly controls the relays connected to the capacitor banks to correct the power factor.

  4. Capacitor Banks: These are switched in or out of the circuit using relays based on the correction needed.

  5. LCD Display: An LCD is used to display the power factor and other related information.


Working Principle


Step 1: Zero Crossing Detection


The zero-crossing detector circuit identifies when the voltage and current waveforms cross zero. The PIC microcontroller uses this information to calculate the phase angle difference between the current and voltage.


Step 2: Power Factor Calculation


The PIC microcontroller calculates the power factor using the phase angle difference. The equation used is:

PF=cos⁡(θ)\text{PF} = \cos(\theta)PF=cos(θ)

where θ is the phase angle difference between the voltage and current waveforms.


Step 3: Power Factor Correction


Depending on the calculated power factor, the microcontroller determines the number of capacitor banks to be switched in or out. If the power factor is low, the microcontroller switches on additional capacitor banks to reduce the phase angle difference.


Step 4: Display and Monitoring


The current power factor is displayed on the LCD screen. The system continuously monitors the power factor and adjusts the capacitor banks accordingly.


PIC Microcontroller Programming


Here's an example code for the PIC microcontroller (using MPLAB X IDE and XC8 compiler):


#include <xc.h>
#include <math.h>
#define _XTAL_FREQ 20000000  // Define oscillator frequency for delay
// Configuration bits
#pragma config FOSC = HS        // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON       // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF        // Low-Voltage (single-supply) In-Circuit Serial Programming Disable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
#pragma config CPD = OFF        // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF        // Flash Program Memory Write Enable bits (Write protection off)
#pragma config CP = OFF         // Flash Program Memory Code Protection bit (Code protection off)
// Function Prototypes
void initialize();
void calculate_power_factor();
void update_capacitors();
void display_on_lcd(float pf);
void main() {
    initialize();
    
    while(1) {
        calculate_power_factor();
        update_capacitors();
    }
}
void initialize() {
    // Initialize Ports, ADC, LCD, etc.
}
void calculate_power_factor() {
    // Logic to calculate power factor from zero crossing
    // Let's assume that power factor (PF) is calculated and stored in variable 'pf'
    float pf = 0.95;  // Example value
    
    display_on_lcd(pf);
}
void update_capacitors() {
    // Logic to switch on/off capacitors based on power factor
    // Use relays to switch capacitors in and out
}
void display_on_lcd(float pf) {
    // Function to display the power factor on LCD
}

Explanation of the Code


  1. Initialization: The initialize() function is where all ports, ADC, and other peripherals are initialized.

  2. Power Factor Calculation: The calculate_power_factor() function handles the logic to calculate the power factor based on the zero-crossing inputs.

  3. Capacitor Control: The update_capacitors() function switches capacitor banks on or off depending on the power factor value.

  4. LCD Display: The display_on_lcd() function displays the calculated power factor on an LCD.


Note


This code is a simplified version and may require additional details such as interrupt handling, ADC configuration, and precise timing calculations depending on the specific requirements and hardware setup.


Conclusion


Automatic Power Factor Correction using a PIC microcontroller is an effective way to improve the power factor in electrical systems, leading to reduced power losses and energy costs. This project not only helps in optimizing energy usage but also extends the lifespan of electrical equipment. With the right setup and programming, the APFC system can significantly enhance the efficiency of industrial and commercial electrical installations.


Further Enhancements


  1. Real-Time Monitoring: Implement real-time monitoring of power factor over a communication protocol like RS-485 or Bluetooth for remote management.

  2. Data Logging: Integrate an SD card module for logging the power factor data for analysis and record-keeping.

  3. Enhanced Control Algorithm: Develop advanced algorithms for more accurate power factor correction and compensation for various types of loads.


Want us to guide you through your project or make the project for you ?






Create Various Projects

Check out our Free Arduino Projects Playlist - Arduino Projects 

Check out our Free Raspberry Pi Projects Playlist - Raspberry Pi Projects 

Check out our Free TinkerCAD Projects Playlist - TinkerCAD Projects 

Check out our Free IoT Projects Playlist - IoT Projects 

Check out our Free Home Automation Projects Playlist - Home Automation Projects 

Check out our Free NodeMCu Projects Playlist - NodeMCu Projects 


0 views0 comments

Related Posts

See All

Comentarios


bottom of page