You are on page 1of 5

Sabir RUSTEMLI, Muhammet ATES

University of Yuzuncu Yil

Measurement and Simulation of Power Factor using PIC16F877


Abstract: The aim of the study is to develop a prototype of power factor measurement circuit. In the designed circuit, the power factor is measured using PIC16F877. This paper focuses to design the simple circuit and low-cost. The current and voltage signals of the load are measured at the same phase. Those signals are inserted into PIC16F877 by means of analog circuit. The power factor is calculated by the algorithm written on the PIC16F877. The measurement value of the power factor is displayed on the LCD screen. Streszczenie. Zaproponowano ukad pomiarowy do badania wspczynnika mocy. Prd i napicie s mierzone analogowo a nastpnie wspczynnik mocy jest obliczany przy wykorzystaniu procesora typu PIC16F877. (Pomiary i symulacja wspczynnika mocy przy wykorzystaniu ukadu PIC 16F877)

Key Words: Power factor measurement, microcontroller, circuit Sowa kluczowe: pomiar wspoczynnika mocy, mikrokontroler.

Introduction Electrical energy is always in great demand for industrial usage. It is on the increase for the development of industrial applications. One of the most economical methods to meet the electrical energy demand is to improve the system efficiency by correcting the the power factor. The system efficiency is defined as the ratio of the real power to apparent power, called as power factor. The loads in electrical systems are generally fed by alternating current and they are mostly motors or the loads with inductive characteristic. They draw active and reactive power from the lines. Active power is converted different types of energy, such as heat, mechanical energy. But, reactive power is not converted to any type of energy. The size of transformer and transmission lines can be larger than their rated values when the reactive power is not compensated. Reactive power occurs due to rotary field in alternative current machines and magnetic field in transformers. Therefore, the reactive is needed to transmit the active power. In practical applications, reactive power compensations have generally been achieved by employing constant capacitor groups controlled via some relays and contactors. It is necessary to know power factor to achieve the reactive power compensations. The harmonic distortion of present-day power system has become a great concern due to the numbers of electronic equipment and power electronic devices are rapidly increased. A poor power factor can result in such systems. In order to reduce harmonic contamination in power lines and improve transmission line efficiency, power factor correction researches become a hot topic. There are a lot of studies in this subject. Bayindir studied an intelligent power factor correction approach based on artificial neural networks. Four learning algorithms, back propagation, delta-bar-delta, extended delta-bar-delta and directed random search, were used to train the Artificial Neural Networks [1]. Azcondo and et al. presents new design considering and a control strategy for power factor correction and resonant inverter [2]. Sagiroglu et al. presents power factor correction technique based on artificial neural Networks. This paper describes a novel technique based on artificial neural networks to correct the line power factor with variable loads [3]. Demian et al. illustrates an effective microcontrolled battery charger circuit that monitors the charging process avoiding the battery damage by overcharge [4]. Bayindir et al. studies a synchronous motor controlled by a PID based on a PIC 18F452 microcontroller under three different working conditions using varying excitation currents [5]. Bay proposes power factor correction of switching mode power

supply (SMPS) by using Neuro-Fuzzy controller. Average current control technique is used in power factor correction unit of the SMPS and current mode control technique is used in buck converter unit of the SMPS [6]. Lin et al. presents high power factor correction circuits with space vector and hysteresis control methods. This paper presents a new topology of the three-phase ac to dc converter. Only three ac switches are required to perform the power factor correction [7]. Lee et al. proposes a new single-stage power-factor-corrected converter to improve input power factor for an efficient switched reluctance motor drive. The proposed converter uses the winding of switched reluctance motor as an input inductor for power-factor-correction [8]. Basu et al. describes a novel common power factor correction scheme for homes and offices. The design and cost estimation of a common power factor correction scheme and some reliability issues are discussed in this paper [9]. This paper describes the design and measurement of the power factor using PIC16F877 micro-controlling chip. The measurement of the power factor is made by means of the designed analog circuit. The single phase asynchronous motor is used as an inductive load to show the experimental verification of the quality of phase determination assured by the designed circuit. Zero Crossing Detectors A zero crossing detector is used as analog circuit to achieve the converting process of the current and voltage signals. Zero crossing detectors are given in Fig. 1 [10].

Fig.1. Zero crossing detectors

As shown in Fig. 1, the outputs of the current and voltage sensors are connected to numbered pins 2 and 6 of LM358, respectively. When AC signal is applied to LM358, the output of LM358 is 1 as logically (5 Volt) while signal is crossing from the zero point. If the AC signal is different

290

PRZEGLD ELEKTROTECHNICZNY (Electrical Review), ISSN 0033-2097, R. 88 NR 6/2012

from zero, the output is 0 (0 Volt). The input and output signals of LM358 are given in Fig.2.

phase of the operation. When programming is complete, the Status box displays the message "Waiting for user command".

Fig.2. The input and output signals of LM358

There are two inputs and outputs of LM358. One of them is used for the current signal. The other one is used for the voltage signal. The current and voltage signals are taken the same phase for measuring the power factor. The current and voltage signals taken from the motor are adapted into LM358 using current and voltage sensors. Therefore, LA-55P current sensor and LV-25P voltage sensor are used for carrying out this process. The secondary output of the current sensor is 50 mA, conversion rate is 1:1000. LA-55P is shown in Fig.3.

Fig.3. LA-55P current sensor

A resistance 100 ohm is connected to the output of current sensor. Thus, the current signal is adapted into the input of LM358. The voltage signal is adapted to LM358 using LV-25P voltage sensor of which conversion rate is 220/5. LV-25P voltage sensor is demonstrated in Fig.4.
Fig.5. The flowchart of the Cos. Hex programme

Fig.4. LV-25P voltage sensor

PIC 16F877 Microcontroller Microcontrollers are embedded devices having a central processing unit, interrupts, counters, timers, I/O ports, RAM, ROM/EPROM which are used to control other systems [11]. The circuit used in this work operates at 20MHz clock frequency and runs each instruction as fast as 200 ns. Flash program memory is up to 8K14words. Data memory is partitioned into four banks which contain the General Purpose Registers and the Special Function Registers. Bits RP1 and RP0 are the bank select bits. Each bank extends up to 7Fh (128 bytes). It contains 1K EEPROM as a program memory, 15 special hardware registers, 36 general purpose registers and 64 byte EEPROM as a data memory. PICs have been mostly preferred control devices because of their low cost, consuming less energy and having small volume in design [12,13]. The PIC16F877 has 5 digital I/O ports (A-E) each between 3 and 8 bits wide. Each port is mapped into the register space, and may be read/written to like any other register. Programming may take a couple of minutes. During programming, the Status box shows the current

The program for the PIC16F877A microcontroller is written in C and compiled with the development system from Custom Computer Services. Microcontroller is programmed to calculate cos between the current and voltage, to display it on the screen of LCD. Cos. Hex programme is prepared on the computer. Ic-prog Pic programme is used as software. The flow chart of the Cos written in Hex programme is shown in Fig.5. Designed Cosmeter Measurement Circuit In the designed cosmeter circuit, the current and voltage signals taken from the AC motor are adopted into input of PIC16F877 by using current and voltage sensors, and zero crossing detectors. The block diagram of designed cosmeter circuit is given in Fig.6. LA-55P current sensor is used to read the current information. Its conversion rate is 1:1000. Maximum voltage is 5 Volt. LV-25P is used to read voltage information. Its conversion range is 220/5 Volt. The zero crossing detectors produce logical signals from zero crossing point. These signals are inserted into PIC16F877. When the voltage passed from zero crossing point, the detector produces 1 as logically. The obtained logical signals from the detector are used in the input of PIC16F877.

PRZEGLD ELEKTROTECHNICZNY (Electrical Review), ISSN 0033-2097, R. 88 NR 6/2012

291

Fig.6. The block diagram of designed cosmeter circuit

The logical voltage and current signals are inserted pins RE0 and RE1 of PIC16F877. TIMER0 of PIC16F877 is worked when the voltage signal is passing from zero point. TIMER0 is stopped when current signal is passing from zero point. TIMER0 is a special storage at the 01h address of RAM. It is possible to start counting from 00h address or any wanted number and to make zero of its content. Scale rate is given in Table 1.
Table 1. Scale rate of TIMER0 Bit value PS2 PS1 PS0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 TIMER rate 1/2 1/4 1/8 1/16 1/32 1/64 1/128 1/256

Fig.8. The designed cosmeter circuit

Simulation of the designed Cosmeter Proteus programme; in the program, Isis program is one of the best program making animation and simulation. Power factor is measured for the current and voltage wave forms obtained by simulations because there is no induction motor in the program library. The block schema of the simulation circuit is given in Fig.9. The produced signals are inserted into input of PIC16F877. PIC16F877 calculates the time difference as microsecond between current and voltage signals produced by PIC16F84A. Then, it calculates the cosines of the angle corresponding the time difference. It displays the cosines value on the LCD. Cosmeter circuit drawing by Isis program is given in Fig.10.

The counting speed of TIMER0 is changed by numbers located in PS2, PS1 and PS0 bits of OPTION saver. This number 3 bits provides 8 different scale rate selection possibilities. Thus, the commend loop number of TIMER0 to pass the next number is determined. It is passed the next commend if TIMER0 scale rate is 1/2. In this study, the oscillator with 20 MHz is used. This frequency is divided four parts. Commend frequency (fk ) and commend loop (tk) is calculated as below: (1)

Fig.9. The block schema of the simulation circuit

fk
tk

f osc MHz ... MHz 4 4


1 1 0.2s f k 5000000

(2)

The designed cosmeter experimetal setup is given in Fig.7.

As shown in Fig. 10, Cosmeter asm. codes written assemble language are loaded into PIC16F877. The software program making simulation of current and voltage signals taken from output of the zero crossing detectors are loaded into PIC16F84A. The Cosmeter circuit in Isis program is given in Fig.11. PIC16F84A produces current and voltage signals when the command Start is given in the simulation shown on the screen. PIC16F877 calculates the time difference between current and voltage signals. And then it calculates the cosines of the angle corresponding this time difference. It shows the calculated value on the LCD. Results and Discussion Integrated circuit consisting of analog and digital components is designed for measuring power factor of the inductive load connected alternative current network. The current and voltage signals of the load taken from output of the zero crossing detectors are displayed on the oscilloscope. The signals on the oscilloscope and LCD are almost the same signals. The signals taken from output of the zero crossing detector are demonstrated in Fig. 12 when the induction motor run. The output signals are obtained square wave to measure the angle difference between current and voltage because the microcontroller is used.

Fig.7. The designed cosmeter experimental setup

The designed measurement circuit of cosmeter is given in Fig. 8.

292

PRZEGLD ELEKTROTECHNICZNY (Electrical Review), ISSN 0033-2097, R. 88 NR 6/2012

Fig.10. Cosmeter circuit drawing by Isis program

Fig.11. The circuit in Isis proram

exactly. Power factor values measured by PIC16F877 are shown in Fig.13.

Fig.12. The signals taken from output of the zero crossing detector

Fig.13. Power factor values measured by PIC16F877

As shown in Fig. 12, the amplitudes of the current and voltage signals are not 5 Volts. Because sensor, resistance and capacitor used in zero crossing detector is not ideal

Any information is not display on the LCD if there is no any load connected to the designed cosmeter circuit. Screen of LCD without load is shown in Fig.14. In this

PRZEGLD ELEKTROTECHNICZNY (Electrical Review), ISSN 0033-2097, R. 88 NR 6/2012

293

condition, the user can understand that any load is not connected to the network. The signal wave form for the simulation is demonstrated in Fig. 15.

microcontroller based compensation process is also carried out by switching capacitor groups. References
[1] Bayindir R., Sagiroglu S., Colak I., An intelligent power factor corrector for power system using artificial neural Networks, Electric Power Systems Research 79 (2009) 152160. [2] Azcondo F. J., Diaz F. J., Branas C., Casanueva R., Microcontroller Power Mode Stabilized Power Factor Correction Stage for High Intensity Discharge Lamp Electronic Ballast, IEEE Transaction on Power Electronics, Vol. 22, No. 3, 2007, 845-853. [3] Sagiroglu S., Colak I., Bayindir R., Power factor correction technique based on artificial neural Networks, Energy Conversion and Management 47 (2006), 32043215. [4] Demian A. E., Gallo C. A., Tofoli F. L., Vieira J. B., Freitas L. C., Farias V. J., Coelho E. A. A., A Novel Microprocessor-Based Battery Charger Circuit With Power Factor Correction, 0-78038269-2/$17.00 (C) 2004 IEEE,1407-1410. [5] Bayindir R., Colak I., Kabalci E., Gorgun A., PID Controlled Synchronous Motor for Power Factor Correction, Powereng, 2009 ,408-412. [6] Bay . F., Atacak ., Power Factor Correction of a Switching Mode Power Supply By Using Neuro-Fuzzy Controller, Gazi University. Journal of Science, 18(3), 2005, 421-437. [7] Lin B. R., Wu D. P., High power factor correction circuits with space vector and hysteresis control methods, Electric Power Systems Research 43 (1997), 207-214. [8] Lee S. H., Kang F. S., Park S. J., Cho S. E., Lee M. H., Singlestage power-factor-corrected converter for switched reluctance motor drive, Electric Power Systems Research 76 (2006), 534540. [9] Basu S., Bollen M. H. J., A Novel Common Power Factor Correction Scheme for Homes And Offices, IEEE Transactions on Power Delivery, Vol. 20, No. 3, 2005, 2257-2263. [10] Ates M, PIC Kullanarak G Katsays lm Devresi Tasarm ve Simlasyonu (Design and simulation of Power Factor Measurement Circuit by using PIC) , Master Thesis, Yuzuncu Yl niversity, Science Institute, 2009. [11] Microchip 2001, PIC 16F87X Data Sheet, USA. [12] Tang J., Varley M.R., Peak M.S., Hardware Implementations of Multi Layer Feed Forward Neural Networks and Error Back Propagation Using 8-Bit PIC Microcontrollers, Neural and Fuzzy Systems: Design, Hardware and Applications (Digest No.: 1997/133), IEE Colloquium on, 1997, 2/12/5. [13] Moore C., Murray I., An electronic design of a low cost braille typewriter, in: Proceedings of the Intelligent Information Systems Conference, The Seventh Australian and New Zealand 2001, 2001, 153157. ---------------------------Authors: Prof. Dr. Sabir Rustemli, Department of Electrical and Electronics Engineering, Yuzuncu Yil University, 65080, Van/Turkey, E-mail: sabirrustemli@yyu.edu.tr; Muhammet Ates, Department of Baskale Technical Vocational School, Yuzuncu Yil University, 65080, Van/Turkey, E-mail: mts@yyu.edu.tr

Fig.14. Screen of LCD without load

Fig.15. Characteristic of the signal wave form with unit amplitude

The calculations are made the ideal sinusoidal voltage for programming the microcontroller. In Fig.15, T is the period of the sinusoidal signal. One degree is approximately calculated as 55.555556second owing to T=20000 0 0 0 second and T=360 (1 =55.555556s.). 1 is taken as 55.5 s in the used programme for PIC16F877. The measurement limits of the cosmeter are between 00 and 900. This interval corresponds 1/4 of period. That is, the 0 measurement error is 5 s or 0.01 . Conclusions In this study, the cosmeter measurement circuit is designed to display the power factor of the load connected the network. The conversion process of difference between the current and voltage signals of the load to degree and time, and calculation process are achieved by PIC16F877 and designed analog-digital integrated circuit. The designed circuit is further advantageous than the other cosmeter circuit because the designed cosmeter circuit has code protection property, EEPROM and programme development facility. The usage area can be changed by adding some specifications. For example, the measurement of power factor of any plant which has a lot of inductive load is achieved. Dynamic compensation can be made by adding relay and contactor to the designed circuit. The

294

PRZEGLD ELEKTROTECHNICZNY (Electrical Review), ISSN 0033-2097, R. 88 NR 6/2012

You might also like