Вы находитесь на странице: 1из 5

Automatic power factor controller using pic

microcontroller
Automatic power factor controller project is designed to improve power factor automatically
whenever power factor falls below a certain level. As you know demand of electrical energy is
increasing day by day. More and more inductive loads are being used in industry and domestic
applications. Inductive loads are main reason for low power factor in power system. Therefore
we need to develop a method to improve power factor automatically. Automatic power controller
project provides solution to this problem. Low power factor includes unnecessary burden on
power system and transmission lines. By improving power factor of power system automatically,
power system efficiency can be improved. In this project, power factor correction prototype is
developed using pic microcontroller, relays, potential transformer,current transformer and zero
crossing circuit.
Page Contents [hide]

1 How automatic Power factor controller works?


2 Automatic Power factor controller circuit diagram
3 Components of automatic power factor controller
4 Automatic Power factor controller working
5 Coding of automatic power factor controller
6 Advantages of automatic power factor controller

How automatic Power factor controller works?


Power factor is a ratio of real power and apparent power. Ideal power factor is unity. Pure
resistive loads have unity power factor. But there is no such load exist. So we always try to make
power factor close to unity. reactive power is also reason of low power factor. Inductive loads
absorb reactive power and capacitive loads provides reactive power. So capacitor banks are used
to improve power factor in power factor correction circuit. By connecting capacitor banks
parallel to load, power factor is increased. capacitor provides reactive power locally to load
instead of getting from generators or power system which in return induces burden in power
system.

Automatic Power factor controller circuit diagram


Circuit diagram of power factor controller is given below. In this circuit diagram two capacitors
are connected parallel to load to improve power factor. In this project, pic microcontroller is used
to measure power factor and to adjust power factor automatically. Whenever power factor falls
below 0.9, microcontroller switch on relays. By turning on relays, capacitor bank connects
automatically to load and improve power factor close to unity.

automatic power factor controller circuit diagram


In above circuit diagram current transformer is used to get current wave form from of load
current and current transformer also step down ac current. LM358 is used as a comparator in this
circuit. similarly voltage transformer is used to get current wave form and fed this wave to
LM358 comparator. LM358 is used as zero crossing detector in this project. After LM358 both
current and voltage waveforms are fed to PIC16F877A microcontroller. PIC16F877A
microcontroller measures zero crossing detection and power factor by measuring time difference
between current and voltage wave form. Time difference between current and voltage waveform
is used to meausre power factor using pic microcontroller. For more details on how pic
microcontroller measures power factor and done power factor measurement calculation, check
following article. I have explained working on power factor measurement project in this article.
Power factor measurement using PIC16F877A microcontroller
PIC16F877A microcontroller calculate power factor and take necessary actions based on power
factor. relay driver IC UNL2003 is connected with microcontroller and which is used to drive
relays. Microcontroller sends high signal to relay driver IC whenever power factors falls less
than 0.9. ULN2003 turn on relays which in return connects capacitor banks with the load.

Components of automatic power factor controller


Followings are the main components of APFC.

Current transformer used to step down current


voltage transformer used to step down voltage
Zero crossing detector circuit
Relay driver circuit

Capacitor bank
12 volt relays
Liquid crystal display
PIC16F877A microcontroller main heart of APFC project.
LM358 used as zero crossing detector

Automatic Power factor controller working


To check working of automatic power correction circuit, follow these instructions.

First connect resistive load across power supply


Microcontroller will measure power factor and displays power factor on LCD
Now you will notice that relays remains off. Becasue power factor is greater than 0.9
Now connect inductive load across ac power supply
Microcontroller will measure power factor and displays power factor on liquid crystal
display
If power factor is less than 0.9, microcontroller will turn on relays.
After relays turn on and capacitor back connects with load, keep checking power factor
on LCD.
Microcontroller again reads power factor and displays it on LCD
Now you will notice that power factor start increasing and power factor greater than 0.9
will display on LCD.
Remember this is only a prototype of powe factor controller, for practical use in industry
you may need to connect more components with above given circuit diagram.

Coding of automatic power factor controller


Code for automatic power factor correction project is given below. Code for APFC is written
using Mikro C compiler. power factor function calculated power factor of load and displays it on
lcd.
//LCD Module Connections
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
//End LCD Module Connections
int powerFactor()
{
int a=0,b=0,t=0,x=0;
float tm,pf;
TMR1L=0;

TMR1H=0;
do
{
if(PORTA.F0 == 1)
T1CON.F0 = 1;
else if(PORTA.F0 == 0 && T1CON.F0 == 1)
{
T1CON.F0 = 0;
break;
}
}while(1);
a = (TMR1L | (TMR1H<<8)) * 2;
TMR1L=0;
TMR1H=0;
do
{
if(PORTA.F0 == 1)
{
T1CON.F0=1;
if(PORTA.F1==1)
{
T1CON.F0=0;
break;
}
}
}while(1);
b = TMR1L | (TMR1H<<8);
tm = (float)b/a;
pf = cos(tm*2*3.14);
x=abs(ceil(pf*100));
return x;
}
void main()
{
char c[]="0.00";
int a,b,d,x,f,e;
float tm,pf;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
ADCON1 = 0x08; // To configure PORTA pins as digital
TRISA.F0 = 1; // Makes First pin of PORTA as input
TRISA.F1 = 1; //Makes Second pin of PORTA as input
TRISD.F0 = 0; //Makes Fist pin of PORTD as output
TRISD.F1 = 0; //Makes Second pin of PORTD as output
while(1)
{
a = powerFactor();
Delay_us(50);
b = powerFactor();
Delay_us(50);
d = powerFactor();
Delay_us(50);
e = powerFactor();
Delay_us(50);
f = powerFactor();
x = (a+b+d+f+e)/5;
c[3]=x%10 + 0x30;

x=x/10;
c[2]=x%10 + 0x30;
x=x/10;
c[0]=x%10 + 0x30;
Lcd_Out(1,1,"Power Factor");
Lcd_Out(2,1,c);
if(x<90)
{
PORTD.F0 = 1;
PORTD.F0 = 1;
Delay_ms(2000);
}
else
{
PORTD.F0 = 0;
PORTD.F0 = 0;
}
Delay_ms(250);
}
}

Advantages of automatic power factor controller


Followings are the major advantages of APFC:

Less reactive power consumption in power system


Increase in efficiency of power system and load
Decrease in electricity bills for home and industry

Вам также может понравиться