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.
- 1 How automatic Power factor controller works?
- 2 Automatic Power factor controller circuit diagram
- 3 Automatic power factor controller circuit operation
- 4 CODE EXPLANATION of automatic power factor controller
- 5 overview of Automatic Power factor controller working
- 6 Coding of automatic power factor controller
- 7 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. This is main objective of automatic power factor controller.
Automatic Power factor controller circuit diagram
Circuit diagram of automatic power factor controller is given below. In this circuit diagram of automatic power factor controller 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.
In above circuit diagram of automatic power factor controller, 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 measure 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.
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.First of all the phase difference between voltage and current waveforms are measured and then power factor is calculated. In case of low power factor capacitors are added to improve it.
Automatic power factor controller circuit operation
Step 1 of automatic power factor controller Alternating voltage of 220 volts is applied to the input of a step down voltage transformer. The output of step down transformer is connected to the diode which act as a rectifier and clips negative part of the sinusoidal waveform as microcontroller cannot detect negative cycle of the waveform.
Microcontrollers cannot operate upon voltages which are greater than 5 volts. If microcontroller is made to be operated upon the voltage greater than 5 volts, it will burn out and damage immediately. For microcontroller to be operated upon the circuits of high voltages we have to make use of step down transformers. Alternating voltage has to be step down such that peak value of voltage is less than 5 volts.
Two different methods are usually used to convert 220 volts alternating voltage in to low voltage of 5 volts alternating voltage.
- Potential Transformer.
- Difference amplifier.
The proposed work uses transformer to step down voltage.The process of electromagnetic induction is used by the transformer to transfer electrical energy from one circuit to another circuit or within same circuit. Time varying magnetic fields in a conductor produces force for electromagnetic induction. Transformers can be used to step up a voltage or step down a voltage depending upon its composition for the use in different electrical circuits.
In primary windings of a transformer, varying current produces a magnetic flux which is varying and this travels to the secondary of the transformer’s winding. This produces a varying magnetic field which in turn produces electromotive force in secondary windings because of electromagnetic induction. Faraday’s law can be used to understand the phenomenon.To reduce electrical voltages a special type of transformers is used known as step down transformer. In step down transformer the voltage in primary windings is greater than secondary windings. Such a type of transformer is used for example for converting 220 volts in to 110 volts.
Step down transformer can be used for isolation in electrical circuits, for power distribution to convert electrical voltage from one level to the other and many other control and power applications. Step down transformers use principle of electromagnetic induction between coils for conversion of voltages.Step down transfer are consists of two coils of wire which are insulated. The coils are made to wind upon the core. The core composition is of iron. A transformer has two coils. Primary coil has turns which are greater in number than number of turns in secondary. When a voltage is applied at primary side of the transformer, the core is magnetized as it is made up of iron. This induces voltage in secondary coil of the transformer. The primary side of transformer is called as input side and secondary side of the transformer is known as output of the transformer.
The voltage which is step down in a transformer depends upon the number of turns in primary and secondary side of the transformer.An example can be given as:If there are 100 turns in primary coil of the transformer and 50 turns in secondary side then voltage ratio will be 2:1. Step down transformer can be also known as voltage ratio device.
Step 2 of automatic power factor controller:-
Same input signal is connected to the step down current transformer.A step down current transformer is used to convert high current in to low current for the use of different electrical circuits. The amount of current which is step down depends on the number of turns in primary coil and number of turns in secondary coil and also on the step down ratio.
If current transformer has ratio of 1000:10, then it means that such a step down transformer can convert current of 1000 amperes to 10 amperes. Step down transformers can be used in circuits where circuits are required to be operate on low currents and available currents are high in value. For example if a relay is to be operated or a microcontroller is to be operated in a circuit. One has to use intelligent techniques to step down the current value for the use of circuits and for this purpose step down transformers can be used.In proposed work a microcontroller is used that is why we have to step down the value of current for the microcontroller and step down current transformer or potential transformer can be used for this purpose.
Step 3 of automatic power factor controller:-
Zero crossing detection is used to detect sine wave zero crossing from positive half cycle to negative half cycle or negative half cycle to positive half cycle. Zero crossing of two waves must be detected to measure the phase difference between two waves. Zero crossing detector circuit basically converts the sinusoid wave to square wave.The outputs from step down current and voltage transformers are fed in to zero crossing detector circuit which convert the sinusoid waveform in to square waveform to be used by microcontroller.
Op-amp is used as a comparator for the purpose of zero crossing detector circuit. Two analogue voltage levels are compared with one another using Op-amp circuit and output depends upon the comparison of these voltage levels. The voltage which is higher in magnitude appears at the output.
In zero crossing detector circuit one input (inverting) of Op-amp is set at zero reference and second input (non-inverting) is fed with sinusoidal wave to be converted in to square wave. Whenever the sinusoidal signal has value greater than zero reference, the output of Op-amp has positive value. As soon as the sinusoidal signal falls below zero reference, the output of op-amp falls to zero. In this way zero crossing detector circuit converts a sinusoidal signal to a square waveform.
The LM358 operational amplifier is equivalent to half of the LM324. Such amplifiers are preferable over usual operational amplifiers for several applications. Such type of amplifiers can operate upon low voltages such as only 3.0 volts and also high voltages up to 32 volts. The input which is common mode includes negative power supply, therefore it eliminates the necessity of external biasing components for many applications. Output voltage includes negative part of the supply voltage.
Following are the main features of LM358:-
- Output protected from short circuit.
- Input is truly differential.
- Supply operation ranging from 3.0 volts to 32 volts.
- Input bias currents are low.
- Internal compensation.
- Common mode extends to negative supply.
- Split and single supply operation.
- Clamps connected on inputs are ESD causes increase in ruggedness of the device and its operation is not affected.
- NCV Prefix for Automotive and Other Applications Requiring Unique Site and Control Change Requirements; AEC−Q100 Qualified and PPAP Capable.
- These Devices are Pb−Free, Halogen Free/BFR Free and are RoHS Compliant.
In proposed circuit LM358 is used as zero crossing detector. When AC signal is applied to LM358, the output of LM358 is high that is ‘1’ when sinusoid signal is positive and in case of negative value of sinusoid waveform the output of the LM358 is low that is ‘0’. Finally the zero crossing detector circuits converts both the voltage and current sinusoid waveforms in to square signal or PWM.
Step 4 of automatic power factor controller:-
The paper utilizes and applies PIC microcontroller. The microcontroller is a cheaper solution for computational work in portable devices like this. PIC microcontroller is an advance microcontroller with many advance features low power utilization, high performance, high frequency, multiple special functions and vast memory space.
PIC 18F family has a RISC architecture with standard on chip features like RAM, ROM, ADC, Timers, Interrupts, I/O ports, EEPROM and USART. The PIC 18F devices have diverse interrupt sources and interrupt priority customization as well. It consists timer interrupts, serial interrupts, external interrupts, peripheral interrupts, watch dog timer interrupt. It has a 10- bit ADC with 13 channels. With the use of external interrupt or timer interrupt the high pulse time can be calculated and thus the phase angle can also be calculated. Since the PIC has multiple oscillator and clock frequency options, the controller can be operated faster and slower depending on the application. With such advance features and low cost, PIC is the best option for this project. The data collected from the zero detectors can be logged in the EEPROM as a record as well. External peripherals and POM extension help to diversify the features. The USART allows serial communication to pass on the data to the computer or the wireless systems that work on serial protocol. The microcontroller consists of 4 timers with each having interrupt as well. The calculation for phase angle through such a powerful controller is the ideal choice.
The output from the zero crossing detectors are now fed to the pins of PIC of microcontroller separately which uses its internal timers to measure the time duration of signals in which their value is high or ‘1’.Timer is a register which counts from 0 to 255 and then start from 0 again. 0, 1, 2, 3, 4…255….0,1, 2, 3……etc. Timers are available in all PIC microcontrollers and when timer overflows it generates interrupt. Timer can use external clock or external clock to calculate time and it depends upon programmer how to use it.
PIC microcontroller has following timers.
- Timer 0
- Timer 1
- Timer 2
- Watch Dog Timer
TIMER0 is 8 bit timer and has prescalar of 8 bit. This timer can run 2 to 256 times slower than normal. TIMER1 is 16 bit timer and has two 8 bit registers having 1:1 and 1:8 prescalar and also has some other useful features. TIMER2 is an 8 bit timer having prescalar of 1:1 to 1:16 and postscalar of 1:1 to 1:16. It also has a period register. It can be used to control motors with PWM.
The time difference between two waves can be easily measured using external interrupts. Whenever interrupt is received on the pin of microcontroller, timer starts and as soon as another external interrupt is received time stops counting. One interrupt is generated with the help of current signal and other interrupt will be generated with the help voltage signal zero crossing. Timer value will be stored for further use. This variable value is basically a time difference between two waves. For good results take 20-30 values and then calculate their average.
In proposed work software program works in a similar manner such that as soon as the output of one zero crossing detector becomes high the timer start incrementing from 0 to 255 and then starts from 0 again. Timer continue to measure time period until the output of second zero crossing detector becomes high. By using simple and basic calculations of timer and it’s prescalar, the time difference at which the outputs of zero crossing detectors become high can be calculated easily.
Step 5 of automatic power factor controller:-
Microcontroller then uses its abilities and program to calculate the phase angle and phase difference between two waveforms. Time difference between two waveforms can yield phase difference easily using following formula.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 ( θ )
2 π is multiplied to time difference value to convert it in to radians as phase angle is to be expressed in radians. Phase difference which is expressed as an angle is known as phase angle. Now using information power factor can be calculated easily. These calculations are done by writing software program in microcontroller.
Step 6 of automatic power factor controller:-
The pins of microcontroller are connected to the relay IC and then to relays.When a low voltage circuit is used to derive a load which is connected to high voltage an IC is used which is known as Relay driver IC. A relay coil require more current as compared to other devices. Integrated circuits such as Op-amp circuits cannot supply such larger currents to derive relays. Relays are unique in properties and have taken the place of solid state switches and are stronger than solid state devices. Relays have high current capacities. They are capable to stand ESD and can also drive circuit isolation. There are many ways to drive relays. Some of the Relay Driver ICs are as follows:
- High side toggle switch driver
- Low side toggle switch driver
- Bipolar NPN transistor driver
- N-Channel MOSFETdriver and
- Darlington transistor driver
- ULN2003 driver
ULN2003 IC is a high current and voltage darlington pair IC, 7 common emitter and open collector darlington pairs are connected in it. One darlington pair compromises of two bipolar transistors. This ULN2003 IC is for 5V TTL and CMOS logic devices. This IC is used to drive loads of various loads, line drivers etc. This IC is used to drive motors. The pair of darlington can drive loads of current 500mA to 600mA. Each driver also has a suppression diode to dissipate voltage spikes while driving inductive loads.
An electrically operated switch is known as relay. Relays can be divided in to different categories depending upon the different mechanisms on which is designed. For examples some relays uses electromagnets to mechanically operate switch. There are other mechanisms on which relays works such as solid state relays etc. Relays can be used to control a circuit using low power signals and also provides complete circuit isolations between control signals and circuits. It can also be used in circuits where one signal is used to control many circuits.
First time the relays were used in telegraph circuits in long distances as amplifiers. They repeat the signals which are coming in to the circuits and again transmit it to another circuit. Relays were also used in computers to perform different algebraic and logical operations and also in telephone exchanges.
Electromagnetic relay is simply consists of a coil which is wrapped around an iron core. An iron core is a source of providing low reluctance path to pass magnetic flux. Relay also includes moveable iron armature and one or more contacts. The armature is connected to the yoke and is mechanically connected to the contacts of the relays. A spring is used to place the contacts in place so that whenever relay is de-energized there is an air gap in magnetic circuits.In this work relays are used to connect and disconnect capacitors in the circuits.
Step 7 of automatic power factor controller:-
Microcontroller program calculates the phase difference between two sinusoid waves and then power factor using this information and displays on LCD. Liquid Crystal Display screen is very basic module and is used very commonly in various circuits for display purpose. It finds a wide range of applications. LCD display is preferred over LED display and seven segment display. LCD’s are easily programmable, economical and can easily display characters, animations and so on.16×2 LCD has 2 lines and each line can display 16 characters. In this LCD 5×7 pixel matrix is used to display each character. LCD has two registers which are named as command and data.
A command is an instruction which is fed to LCD, commands are used to execute some tasks which are predefined already such as initialize LCD, clear its screen, controlling display and brightness and setting cursor position etc. Command register stores such predefined instructions.Data register in LCD stores data which is to be displayed on screen. The data is in the ASCII form of the character which is to be displayed.
There are total of 16 pins in LCD display details are given in following table.
|2||Supply voltage; 5V (4.7V – 5.3V)||Vcc|
|3||Contrast adjustment; through a variable resistor||VEE|
|4||Selects command register when low; and data register when high||Register Select|
|5||Low to write to the register; High to read from the register||Read/write|
|6||Sends data to data pins when a high to low pulse is given||Enable|
|7||8-bit data pins||DB0|
|15||Backlight VCC (5V)||Led+|
|16||Backlight Ground (0V)||Led-|
To display values on LCD hex values are converted in to decimal and then each decimal value is converted to respective ASCII code and finally send to LCD display.
Step 8 of automatic power factor controller:-
If the power factor is less than a prescribed value then microcontroller generate command to turn on the relay. Turning on relay will add capacitor in to the circuit which will help to improve power factor. Capacitors add reactive load in the circuit which will help to increase power factor. Number of capacitors which are to be added depends upon the power factor of the circuit. As soon as the power factor drops from a specific value, the relay will act to add capacitor to the circuit. If power factor value drops a little to the prescribed value then one capacitor is added. In case of power factor drops much more than prescribed value then second capacitor is also added and the system goes on this way. The circuit will continue to add capacitor in parallel to the load until a good value of power factor is achieved.
CODE EXPLANATION of automatic power factor controller
The software programs which is used in automatic power factor controller work to improve power factor consists of following steps.
First of all initialize the system and microcontroller.
Configure one port for the LCD display. Assign pins as output and input as required.
Set timer prescale value and initialize it to zero.
As soon as the interrupt is received the timer starts its counting.
When the second interrupt is received the timer stops and its value is stored in a variable.
Use this timer value to calculate the phase difference between two waves.
Perform calculations to get phase angle of the signal and finally calculate the power factor.
Display the power factor of the system on LCD.
Use this power factor value to decide whether the capacitors are to be added in circuit or not. Use relays to add capacitors in the circuits.
Finally set power factor value as desired.
SIMULATION of automatic power factor controller
Power factor is basically the result of reactive loads, especially inductive load because they are frequently found in the form of motors. Such type of loads cause an offset between voltage and current. The inductor cause the current to lag voltage and capacitor cause the opposite.
Power factor below 0.95 is not acceptable. If the load is inductive, a capacitive load is introduced. The voltage and current waveforms are passed through the zero cross detector. The difference between the zero crossing of the current and voltage waveforms is calculated using the timer of the microcontroller. This value then allows the microcontroller to decide how much capacitors/inductors to add in the main circuitry. If the phase angle is positive, a combination of capacitors are added in the circuit until the power factor is above 0.95. If the phase angle is negative and inductor is added to compensate the power factor until it is reached to the desired value.
If the power factor is not above 0.95, the losses will be prominent and this will cause the system to drain more power than required. This project just deals in positive phase angle i.e. the system only adds capacitive loads to the main circuit. Since the microcontroller used has a relatively smaller stack, the inductive addition could not be accomplished, but this can be done by using microcontroller with bigger stack. The system has multiple capacitors that are added to circuitry one after the other until the required power factor is not reached. This technique is frequently used in water pumps and ceiling fans which have pre-calculated and factory installed capacitors with the motors.
Due to low power factor the full load of the true power is not delivered. Such systems are dead investment as they waste a lot of energy finally causing losses to the company. If the power factor decreases, the voltage drop in the transmission lines increase. For such systems power generation companies install boosters. If the power factor is locally improved, such expensive are of no need. When motors are operated in varying speed, variable frequency drives are also a good solution but for this as well you need to detect the phase angle and power factor.
The proposed work has input supply of sinusoidal waveform. The voltage waveform and current waveforms both are passed through the zero crossing detector circuits. These zero crossing detector circuits convert sinusoidal waveforms in to square waveforms using LM358 IC that’s an op-amp IC. LM358 uses a zero voltage signal as reference signal and then compares this signal to the signal to be converted in to square waveform. The microcontroller PIC is programmed such that its timers are made to be operated upon interrupts received. When interrupt form zero crossing detector circuit connected to voltage input wave is received timer starts its function of measuring time. As soon as the interrupt from second zero crossing detector is received the timer stops its function and its value is stored in a variable. The value of this variable is then used to calculate the phase difference between two waves. This phase difference then provides power factor of the system. The power factor of the system is then compared to the desired value of the power factor that’s set to be 0.95 for the current work. If the system’s power factor value come out to be less than 0.95 then the microcontroller sends command to add capacitors in to the system until power factor becomes equal to 0.95. If the power factor increase from a specified value then inductor may be added to decrease it.
This system uses 16×2 LCD. 4 things are displayed on the LCD:
- Power Factor.
- AC Voltage.
- AC Current.
overview of 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 of automatic power factor controller.
Coding of automatic power factor controller
Code for automatic power factor correction project is not free of cost. Code for APFC is written using Mikro C compiler. power factor function calculated power factor of load and displays it on lcd. if you want to purchase code in 50$ contact me at firstname.lastname@example.org
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