top of page
Writer's pictureSanskruti Ashtikar

Automatic Power Factor Correction Using 8051 Microcontroller

Updated: 3 days ago

Introduction


Power factor is a crucial aspect of electrical systems, reflecting the efficiency with which electrical power is converted into useful work output. A low power factor indicates poor efficiency and results in higher energy costs and increased strain on the electrical infrastructure. Automatic Power Factor Correction (APFC) systems help maintain the power factor close to unity by automatically compensating for reactive power. This article details the design and implementation of an APFC system using the 8051 microcontroller.





Components Required


  1. 8051 Microcontroller

  2. Current Transformer (CT)

  3. Potential Transformer (PT)

  4. Zero-Crossing Detector (ZCD)

  5. Capacitor Bank

  6. Relay Module

  7. LCD Display (16x2)

  8. Power Supply

  9. Connecting Wires

  10. Resistors, Capacitors, and other passive components


System Overview


The APFC system consists of CTs and PTs to measure current and voltage, zero-crossing detectors to determine the phase angle difference, and a relay module to switch capacitor banks in and out of the circuit. The 8051 microcontroller processes the input from the sensors and controls the relay module to adjust the power factor.


Circuit Diagram


APFC System Block Diagram:



Note: Add a detailed circuit diagram as described above.


Working Principle


  1. Measurement:

  2. The current transformer (CT) and potential transformer (PT) measure the current and voltage in the system.

  3. The outputs from the CT and PT are fed into zero-crossing detectors to determine the phase angle difference between the current and voltage waveforms.

  4. Phase Angle Calculation:

  5. The zero-crossing detectors generate pulses corresponding to the zero-crossings of the current and voltage waveforms.

  6. The 8051 microcontroller measures the time difference between these pulses to calculate the phase angle.

  7. Power Factor Calculation:

  8. The microcontroller uses the phase angle to calculate the power factor.

  9. Based on the calculated power factor, the microcontroller determines if correction is needed.

  10. Capacitor Bank Switching:

  11. The microcontroller controls a relay module to switch capacitor banks in and out of the circuit.

  12. Adding or removing capacitors adjusts the reactive power, thereby correcting the power factor.


Circuit Design


1. Zero-Crossing Detector:

  • The ZCD circuit generates a pulse every time the AC waveform crosses zero.

  • Connect the outputs of the CT and PT to the ZCD circuits.

  • The output pulses from the ZCD are fed into the 8051 microcontroller.

2. Relay Module:

  • The relay module switches the capacitor banks based on control signals from the microcontroller.

  • Connect the control pins of the relay module to the digital output pins of the 8051 microcontroller.

3. LCD Display:

  • The LCD displays the power factor and system status.

  • Connect the data and control pins of the LCD to the appropriate ports of the 8051 microcontroller.





Programming the 8051 Microcontroller


The program for the 8051 microcontroller is written in Embedded C. The code involves reading the ZCD pulses, calculating the phase angle and power factor, and controlling the relays to switch capacitor banks.


#include <reg51.h>
// Define connections
sbit ZCD_VOLTAGE = P1^0;
sbit ZCD_CURRENT = P1^1;
sbit RELAY_1 = P2^0;
sbit RELAY_2 = P2^1;
sbit RELAY_3 = P2^2;
sbit RS = P3^0;
sbit RW = P3^1;
sbit EN = P3^2;
sfr LCD_DATA = 0xA0; // LCD data port
void delay(unsigned int ms) {
    unsigned int i, j;
    for(i = 0; i < ms; i++) {
        for(j = 0; j < 1275; j++);
    }
}
void lcd_cmd(unsigned char cmd) {
    LCD_DATA = cmd;
    RS = 0;
    RW = 0;
    EN = 1;
    delay(1);
    EN = 0;
}
void lcd_data(unsigned char data) {
    LCD_DATA = data;
    RS = 1;
    RW = 0;
    EN = 1;
    delay(1);
    EN = 0;
}
void lcd_init() {
    lcd_cmd(0x38); // 2 lines, 5x7 matrix
    lcd_cmd(0x0C); // Display on, cursor off
    lcd_cmd(0x06); // Increment cursor
    lcd_cmd(0x01); // Clear display
}
void lcd_string(unsigned char *str) {
    while(*str) {
        lcd_data(*str++);
    }
}
unsigned int measure_phase_angle() {
    unsigned int time_count = 0;
    while(ZCD_VOLTAGE == 0); // Wait for voltage zero crossing
    while(ZCD_VOLTAGE == 1); // Wait for voltage zero crossing end
    while(ZCD_CURRENT == 0) { // Wait for current zero crossing
        time_count++;
        delay(1);
    }
    return time_count;
}


float calculate_power_factor(unsigned int phase_angle) {
    float power_factor;
    power_factor = cos(phase_angle * 3.14 / 180);
    return power_factor;
}
void switch_relay(unsigned int relay_num, bit state) {
    switch(relay_num) {
        case 1:
            RELAY_1 = state;
            break;
        case 2:
            RELAY_2 = state;
            break;
        case 3:
            RELAY_3 = state;
            break;
    }
}
void main() {
    unsigned int phase_angle;
    float power_factor;
    char pf_str[7];
    
    lcd_init();
    while(1) {
        phase_angle = measure_phase_angle();
        power_factor = calculate_power_factor(phase_angle);
        sprintf(pf_str, "%.2f", power_factor);
        
        lcd_cmd(0x80); // Move to first line
        lcd_string("Power Factor: ");
        lcd_string(pf_str);
        
        if(power_factor < 0.9) {
            switch_relay(1, 1);
            switch_relay(2, 1);
            switch_relay(3, 1);
        }
        else if(power_factor < 0.95) {
            switch_relay(1, 1);
            switch_relay(2, 1);
            switch_relay(3, 0);
        }
        else if(power_factor < 0.98) {
            switch_relay(1, 1);
            switch_relay(2, 0);
            switch_relay(3, 0);
        }
        else {
            switch_relay(1, 0);
            switch_relay(2, 0);
            switch_relay(3, 0);
        }
        
        delay(1000);
    }
}




Conclusion


An Automatic Power Factor Correction system using the 8051 microcontroller is an effective way to maintain a high power factor, ensuring efficient power usage and reducing energy costs. This article outlines the components, circuit design, and programming required to build the system. With further enhancements such as additional sensors and more sophisticated control algorithms, this system can be adapted for more complex and large-scale applications.


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

Comments


bottom of page