Introduction
Design an automatic power factor correction system using a switched capacitor bank and microcontroller. This comprehensive guide covers everything from design through implementation, testing, and deployment.
Design an automatic power factor correction system using a switched capacitor bank and microcontroller.
Design an automatic power factor correction system using a switched capacitor bank and microcontroller. This comprehensive guide covers everything from design through implementation, testing, and deployment.
Power factor (PF) = Real Power (kW) / Apparent Power (kVA). Inductive loads like motors draw reactive power (kVAR) from the grid, increasing current without doing useful work. Capacitors supply reactive power locally, reducing reactive current from the supply. The goal is PF > 0.95. Reactive power (Q) needed = P × tan(acos(PF_current)) - P × tan(acos(PF_target)).
10 components required for this project.
| # | Component | Purpose | Qty |
|---|---|---|---|
| 1 | Arduino Mega 2560 | Main controller for APFC logic | x1 |
| 2 | ZMPT101B Voltage Sensor | Mains voltage sensing | x1 |
| 3 | ACS712 Current Sensor (30A) | Load current sensing | x1 |
| 4 | 25µF/440VAC Capacitor (Power) | Capacitor bank stages | x4 |
| 5 | 25A Contactor with 230V Coil | Switching capacitor stages | x4 |
| 6 | LCD 20×4 with I2C | PF display and system status | x1 |
| 7 | Zero-Crossing Detector Circuit | Synchronizing capacitor switching | x1 |
| 8 | 3-Pole MCB (16A) | Capacitor bank protection | x4 |
| 9 | Current Transformer (100:5A) | High-current measurement | x1 |
| 10 | 24V DC Power Supply | Control circuit power | x1 |
Follow these 8 steps carefully.
Power factor (PF) = Real Power (kW) / Apparent Power (kVA). Inductive loads like motors draw reactive power (kVAR) from the grid, increasing current without doing useful work. Capacitors supply reactive power locally, reducing reactive current from the supply. The goal is PF > 0.95. Reactive power (Q) needed = P × tan(acos(PF_current)) - P × tan(acos(PF_target)).
Build a zero-crossing detector using an optocoupler (MOC3041) and a 33kΩ current-limiting resistor across the mains. The output pulses at every zero crossing of the AC waveform (100 pulses/second at 50Hz). Connect this to an Arduino interrupt pin. This is critical — capacitors must be switched at or near zero-crossing to prevent destructive switching transients.
Using the zero-crossing of voltage as reference, measure the time delay until the current zero-crossing. Phase angle φ = (time_delay / 20ms) × 360°. Power factor = cos(φ). Sample both V and I zero-crossings simultaneously for accurate measurement. Filter readings over 10 consecutive cycles to reject noise. Display both leading/lagging indication and PF magnitude.
For a 10kW motor load at 0.7 PF, reactive power needed: Q = 10 × tan(acos(0.7)) = 10.2 kVAR. To correct to 0.95 PF: Q_cap = 10 × (tan(acos(0.7)) - tan(acos(0.95))) = 10.2 - 3.3 = 6.9 kVAR. Design in 4 binary-weighted stages: 1, 2, 4, 4 kVAR (providing 0–11 kVAR in 1 kVAR steps). Capacitor rating: C = Q / (2π × f × V²). For 1 kVAR at 230V 50Hz: C = 60µF.
Map required kVAR correction to binary capacitor bank stage combinations. Implement a hysteresis band (target PF ± 0.03) to prevent hunting. Add minimum switching interval (30 seconds) to prevent contactor wear. Switch capacitors ON only at zero-crossing to minimize transients. Implement anti-hunting logic using a dead band and time delay. Track contactor operation count for maintenance scheduling.
Implement overcurrent protection: if load current exceeds 1.1× rated, shed all capacitors immediately. Over-voltage protection: if supply voltage exceeds 250V, disconnect all capacitors (risk of dielectric failure). Under-voltage: below 190V, disconnect (risk of contactor coil failure). Temperature protection using NTC thermistor in the capacitor cabinet — disconnect above 55°C.
Display real-time: PF, V, I, kW, kVAR, kVA, and active capacitor stages. Show target vs actual PF with trend arrow. Log PF improvement data to EEPROM every hour — track efficiency gains over time. Calculate and display monthly kVAR-hour savings compared to uncorrected baseline. Show reactive power demand charge savings at your utility's penalty rate.
Connect the APFC panel to a motor test load. Record baseline PF (should be 0.65–0.75 for typical induction motors). Start with all capacitors off, then enable APFC. Verify PF rises to 0.95–0.98 within 2–3 switching cycles. Monitor for hunting behavior. Measure supply current before and after — expect 25–35% current reduction at the same load, validating reactive power compensation.
Core code for apfc_controller.ino:
// Automatic Power Factor Correction Controller #define ZC_V_PIN 2 #define ZC_I_PIN 3 #define CAP_STAGE1 8 #define CAP_STAGE2 9 #define CAP_STAGE3 10 #define CAP_STAGE4 11 volatile unsigned long v_zc_time = 0; volatile unsigned long i_zc_time = 0; float phase_angle_deg = 0; float power_factor = 1.0; byte active_stages = 0; void v_interrupt() { v_zc_time = micros(); } void i_interrupt() { i_zc_time = micros(); } void setup() { Serial.begin(9600); attachInterrupt(digitalPinToInterrupt(ZC_V_PIN), v_interrupt, RISING); attachInterrupt(digitalPinToInterrupt(ZC_I_PIN), i_interrupt, RISING); pinMode(CAP_STAGE1, OUTPUT); pinMode(CAP_STAGE2, OUTPUT); pinMode(CAP_STAGE3, OUTPUT); pinMode(CAP_STAGE4, OUTPUT); } void updatePF() { long dt = (long)(i_zc_time - v_zc_time); if (dt < 0 || dt > 10000) return; phase_angle_deg = (dt / 20000.0) * 360.0; power_factor = cos(radians(phase_angle_deg)); } void adjustCapacitors() { static unsigned long lastSwitch = 0; if (millis() - lastSwitch < 30000) return; if (power_factor < 0.92) { if (active_stages < 0x0F) { active_stages++; lastSwitch = millis(); } } else if (power_factor > 0.98) { if (active_stages > 0) { active_stages--; lastSwitch = millis(); } } digitalWrite(CAP_STAGE1, active_stages & 0x01); digitalWrite(CAP_STAGE2, active_stages & 0x02); digitalWrite(CAP_STAGE3, active_stages & 0x04); digitalWrite(CAP_STAGE4, active_stages & 0x08); } void loop() { updatePF(); adjustCapacitors(); Serial.printf("PF: %.3f Angle: %.1f Stages: %d\\n", power_factor, phase_angle_deg, active_stages); delay(1000); }
Test Power Factor Correction System by verifying each subsystem individually before full integration.
Verify power voltages, check ground connections, use serial monitor for debug.
An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.