Programming of Pic Micro Controller For PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 40

PROGRAMMING OF PIC MICRO CONTROLLER FOR

POWER FACTOR CORRECTION


A PROJECT REPORT

Submitted by
S. SENTHIL KUMAR 10504182
S. AMEEN 10504172
A. MOHAMMED ZACKRIYA 10504175

Under the guidance of

Ms. P.U. POORNIMA, M.Tech.,


(Lecturer, Department of Electrical and Electronics Engineering)

in partial fulfillment for the award of the degree


of

BACHELOR OF TECHNOLOGY
in

ELECTRICAL AND ELECTRONICS ENGINEERING


of

FACULTY OF ENGINEERING & TECHNOLOGY

S.R.M. Nagar, Kattankulathur, Kancheepuram District

MAY 2008
BONAFIDE CERTIFICATE

Certified that this project report titled “PROGRAMMING OF PIC MICRO


CONTROLLER FOR POWER FACTOR CORRECTION ” is the bonafide work
of “ S. SENTHIL KUMAR (10504182), S. AMEEN (10504172),
A. MOHAMMED ZACKRIYA (10504175) ”, who carried out the project work
under my supervision. Certified further, that to the best of my knowledge the work
reported herein does not form any other project report or dissertation on the basis of
which a degree or award was conferred on an earlier occasion on this or any other
candidate.

SIGNATURE SIGNATURE

Ms. P.U. POORNIMA, Prof. R. CHIDAMBARAM


GUIDE HEAD OF DEPT.
LECTURER
Dept. of EEE Dept. of EEE

DATE:

Signature of the Internal Examiner Signature of the External Examiner


ACKNOWLEDGEMENT

The successful completion of any task would be incomplete


without mentioning the people who made it possible. We take this
opportunity to express a few words of gratitude to all those who helped us
in completing this project.

We would like to express our sincere gratitude to our Associate


Director Dr.C.Muthamizhchelvan for all the help and infrastructure
provided to complete this project successfully.

We express our sincere thanks to Head of the Department,


School of Electrical and Electronics Engineering,
Prof.R.Chidambaram for being a constant source of motivation.

We take this opportunity to record our sincere thanks to our guide


Ms. P.U. Poornima, M.Tech., (Lecturer/EEE) for his guidance and
encouragement during the project period.
We also thank Mr. S Chandrasekar ( Sr. Lecturer/ EEE ) and
Ms. N. Chellammal (sr. lecturer/ EEE) for their support and
encouragement.

We would like to thank the Laboratory Supervisors and the


Supporting Staff for their valuable support and encouragement during
the Project Period.

Finally, we thank God Almighty for making us capable and giving


us the dedication and determination to complete the project in time.

i
ABSTRACT

In recent years, the power quality of the AC system has become a great concern
due to the rapidly increased numbers of inductive loads, electronic equipment, power
electronics and high voltage power system. In order to reduce line losses and improve
the transmission efficiency, power factor correction research became a hot topic.
Many control methods for the Power Factor Correction (PFC) were proposed. This
paper describes the design and development of a single-phase power factor correction
using PIC (Programmable Interface Circuit) micro-controlling chip. This involves
measuring the power factor value from the load using current transformer, potential
transformer, and zero crossing detector, then using proper algorithm to switching on
and switching off the capacitors in order to compensate excessive reactive power, thus
withdraw PF near to unity as a result acquires higher efficiency and better quality AC
output.

ii
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO

ACKNOWLEDGEMENT i

ABSTRACT ii

LIST OF FIGURE v

1 INTRODUCTION 1

1.1 OBJECTIVE 1

1.2 POWER FACTOR CORRECTION 2

1.3 TYPICAL POWER FACTORS OF END USE

EQUIPMENT 4

1.4 BLOCK DIAGRAM 5

1.5 COMPONENTS OF BLOCK DIAGRAM 6

1.6 DESCRIPTION 6

2 CIRCUIT DIAGRAM 7

2.1 CIRCUIT DESCRIPTION AND PRINCIPLE OF

OPERATION 8

3 HARDWARE IMPLEMENTATION 9

3.1 VOLTAGE & CURRENT MEASUREMENT UNIT 9

3.2 ZERO CROSSING DETECTING UNIT 10

3.3 POWER SUPPLY FOR MICROCONTROLLER 12

3.4 LCD MODULE 13

3.5 RELAY 14

3.6 CAPACITOR 15

3.7 RELATIONSHIP OF CAPACITOR WITH POWER

FACTOR 16

3.8 LOAD 16

iii
4 PIC-MICRO CONTROLLER 19

4.1 PIN DIAGRAM OF PIC16F877 19

4.2 BLOCK DIAGRAM OF PIC16F877 20

4.3 DESCRIPTION 21

4.4 FEATURES 24

5 PROBLEM DUE TO LOW POWER FACTOR 27

5.1 ADVANTAGES OF POWER FACTOR CORRECTION 27

5.2 APPLICATION 28

6 CONCLUSION 28

7 REFERENCES 29

8 APPENDIX 30

iv
LIST OF FIGURE

1.2 BLOCK DIAGRAM 5

2.1 CIRCUIT DIAGRAM 7

3.2 ZERO CROSSING DETECTOR 11

3.4 POWER SUPPLY CIRCUIT 12

3.5 LCD MODULE 13

4.1 PIN DIAGRAM OF PIC 16F877 19

4.2 BLOCK DIAGRAM OF PIC 16F877 20

v
1. INTRODUCTION

Power factor is the ratio between the KW and the KVA drawn by an electrical
load where the KW is the actual load power and the KVA is the apparent load power.
It is a measure of how effectively the current is being converted into useful work
output and more particularly is a good indicator of the effect of the load current on the
efficiency of the supply system. When an electric load has a PF. lower than 1, the
apparent power delivered to the load is greater than the real power that the load
consumes voltage. All currents will cause losses in the supply and distribution system.
A load with a power factor of 1.0 provides most efficient loading of the supply and a
load with a power factor of 0.5 will result in much higher losses in the supply system.
A poor power factor can be the result of a significant phase difference between the
voltage and current at the load terminals. Poor load current phase angle is generally
the result of an inductive load such as an induction motor, power transformer, lighting
ballasts, welder or induction furnace. An improved power factor AC output is the
main target of this paper. This paper focuses on the design and implementation of
power factor correction using PIC Micro-controller chip.

1.1 OBJECTIVE

The main objective of the proposed system is to maintain the power factor of
the induction motor near to unity by switching on and switching off the capacitor
through electromagnetic relay using pic-microcontroller chip.

vi
1.2 POWER FACTOR CORRECTION

The power factor of an AC electric power system is defined as the ratio of the
real power to the apparent power, and is a number between 0 and 1 (frequently
expressed as a percentage, e.g. 0.5 pf = 50% pf). Real power is the capacity of the
circuit for performing work in a particular time. Apparent power is the product of the
current and voltage of the circuit. Due to energy stored in the load and returned to the
source, or due to a non-linear load that distorts the wave shape of the current drawn
from the source, the apparent power can be greater than the real power. Low-power-
factor loads increase losses in a power distribution system and result in increased
energy costs. All Discharge Lamps, such as Fluorescent Lamps, High Pressure
Mercury Vapour Lamps, Sodium Lamps, Metal Halide Lamps, etc., require ballasts
(chokes) or transformers for their operation. These devices are inductive in nature.
When a Discharge Lamp is switched on, it draws Apparent Power from the mains.
This Apparent Power (VA) has two components, one is the Active Power (W)
actually being consumed by the lamp for illuminating it, and the other is the Reactive
Power (VAr) feeding the electromagnetic circuit of the control gear. Power factor is
the ratio of Active Power (W) to the Apparent Power (VA) .

Power factor = Active Power / Apparent Power

Power factor is also denoted by p.f. or cos Ø . As mentioned above, the inductive
components, such as ballasts, draw Reactive Power (VAr) from the mains. It lags
behind the Active Power (W) by 90o. (A capacitor, if connected across the mains, will
also draw Reactive Power [VAr(c)], but it leads the Active Power (W) by 90o. The
direction of the capacitive Reactive Power [VAr(c)] is opposite to the direction of the
inductive Reactive Power (VAr). If a capacitor is connected in parallel with an
inductive load, it will draw capacitive Reactive Power [VAr(c)]. The effective
Reactive Power drawn by the circuit will reduce to the extent of the capacitive
Reactive Power [VAr(c)], Resulting in reduction of Apparent Power from VA to VA1.

vii
Fig: 1.1 Vector Diagram

The phase angle between the Active Power and the new Apparent Power VA1 will
also reduce from Ø to Ø1 . Thus the power factor will increase from cos Ø to cosØ1.
Real power (watts) produces real work; this is the energy transfer component
(example electricity-to-motor rpm). Reactive power is the power required to produce
the magnetic fields (lost power) to enable the real work to be done, where apparent
power is considered the total power that the power company supplies. This total
power is the power supplied through the power mains to produce the required amount
of real power. The previously-stated definition of power factor related to phase angle
is valid when considering ideal sinusoidal waveforms for both current and voltage;
however, most power supplies draw a non-sinusoidal current. When the current is not
sinusoidal and the voltage is sinusoidal, the power factor consists of two factors: 1)
the displacement factor related to phase angle and 2) the distortion factor related to
wave shape Irms is the current’s RMS value. Therefore, the purpose of the power
factor correction circuit is to minimize the input current distortion and make the
current in phase with the voltage when the power factor is not equal to 1, the current
waveform does not follow the voltage waveform. These results not only in power
losses, but may also cause harmonics that travel down the neutral line and disrupt
other devices connected to the line. The closer the power factor is to 1, the closer the
current harmonics will be to zero since all the power is contained in the fundamental
frequency.

viii
1.3 TYPICAL POWER FACTORS OF END USE EQUIPMENT

ix
1.4BLOCK DIAGRAM

Fig: 1.2 Block Diagram

1.5 COMPONENTES OF BLOCK DIAGRAM

The Block Diagram Mainly consists of

a) voltage & current measurement


b) pic-microcontroller chip
c) relay circuit
d) capacitor
e) inductive load

x
1.6 DESCRIPTION

The block diagram mainly consist of a pic-microcontroller (pic16f877) for


power factor calculation, relay circuit, capacitor ,voltage and current measurement
unit, , and inductive load.

• 50 Hz Ac supply is connected to the lamp and capacitor start induction 

motor. 

•  Current  transformer  and  potential  transformer  are  used  to  reduce 

current and voltage levels for zero crossing detector. 

• The zero crossing detector is a device for detecting the point where the 

voltage crosses zero in either direction.  

• The measured voltage and current signal are given to RC0,RC1 pin of 

pic‐microcontroller. 

• Pic‐microcontroller  converts  the  analog  output  of  the  zero  crossing 

detector into digital signal. 

• Pic‐microcontroller  calculate  the  power  factor  of  measured  values, 

depends upon error it will send signal to relay. 

• Lcd  display  is  used  to  display  power  factor  value  of  the  line 

continuously. 

• When  relay  energized  by  pic  –microcontroller  it  connect  capacitor 

parallel with load, when relay de energized it disconnect the capacitor 

from the line. 

xi
CIRCUIT DIAGRAM 

TX1

K1
VDD 5
3 D1 1 VDD
4
1 JP2
2 2 - + 4 1 3
2 VIN VOUT
1 U2
RELAY SPDT
D 7805 R4
9 VAC C5 N C6 C7 220 ohm
G
470 uF 100 uF 0.1 uF
3 D2
V1 TX2 2
0V

1 LED
MG1
MOTOR AC
C1
6MFD/250V Bulb/200W

2 VPP
0.1 uF
SW2 R6 C10
R5
220 ohm
RESET 1k
1 2 2 1 DATA
1 3 1 3 CLK
D D S S
D D S S
V V V V
1 40 RB7
RA0 2 MCLR/Vpp RB7/PGD 39 RB6
RA1 3 RA0/AN0 RB6/PGC 38 RB5
R7 RA1/AN1 RB5
RA2 4 37 RB4
RA3 5 RA2/AN2/Vref - RB4 36 RB3
1 RA3/AN3/Vref + RB3/PGM
RA4 6 35 RB2
2 RA5 7 RA4/T0CKI PIC16F877 RB2 34 RB1
RE0 8 RA5/AN4/SS U3 RB1 33 RB0
D2 R3 RE1 9 RE0/AN5/RD RB0/INT
RE1/AN6/WR RB3
1 2 RE2 10
RE2/AN7/CS RB0
1N4007 10k
D1 3 13
14 OSC1/CLKIN 30 RD7
2 OSC2/CLKOUT RD7/PSP7 29 RD6
Q1 RD6/PSP6
R1 R2 Y1 RC0 15 28 RD5
4 - + 1 RC1 16 RC0/T1OSO/T1CKI RD5/PSP5 27 RD4
10k D3 RC2 17 RC1/T1OSI/CCP2 RD4/PSP4 22 RD3
RC2/CCP1 RD3/PSP3 Q1
10k BC547 4 Mhz RC3 18 21 RD2 R8
C2 5.1VZener RC4 23 RC3/SCK/SCL RD2/PSP2 20 RD1
BR805D C8 C9 RC5 24 RC4/SDI/SDA RD1/PSP1 19
100uF RC5/SDO RD0/PSP0 1k
27 pF 27 pF RC6 25 BC547
3 RC7 26 RC6/TX/CK
RC7/RX/DT

TX RX

D2 R3 J2
1 2
VDD 1
1N4007 10k 2
RE0 3
D1 4
2 RE1
RE2 5
Q1 6
R1 R2 RD0
4 - + 1 RD1 7
10k D3 RD2 8
10k 9
40235 RD3
C2 5.1VZener RD4 10
BR805D RD5 11
100uF RD6 12
3 RD7 13
14
15
16
LCD Module

Fig:2.1 circuit diagram

xii
2.1 CIRCUIT DESCRIPTION AND PRINCIPLE OF OPERATION
The circuit diagram consists of mainly 3 units which constitute for the
perfect operation of the circuit.

1)  Voltage & current measurement unit 

2)     Zero crossing detector unit 

3)  Pic ‐microcontroller unit 

• The Ac supply is connected to the resistive and inductive load


• Current transformer (CT) is connected series with line, and potential
transformer (PT) is connected parallel with supply line.
• CT & PT are used to step down the voltage and current level for zero crossing
detector (ZCD).
• The output of CT & PT are given as input for ZCD
• In ZCD Ac supply is converted in to DC using bridge rectifier
• ZCD detects the point where the voltage and current crosses zero in either
direction.
• By using this two waveform we can find out power factor of the line, hence
power factor is cos Ø , angle between the voltage and current waveform is Ø.
• Analog signal is converted into digital signal in pic-microcontroller then the
input signal is compared with reference signal for power factor correction
• Designed capacitor connected parallel to load through relay, if the relay
energized by microcontroller it will switch on the capacitor parallel with load,
if relay de energized it will remove the capacitor from the load.
• When the resistive load is on the power factor will be near to unity so the pic-
microcontroller doesn’t energize the relay coil.

• When the inductive load is on the power factor decrease now the error will be
more in pic- microcontroller so pic energize the relay coil in order to
compensate the excessive reactive power.
• 16×2 LCD module is connected with port D of the pic-microcontroller
• We can get the output from LCD display.

xiii
3 HARDWARE IMPLEMENTATION

3.1 VOLTAGE & CURRENT MEASUREMENT UNIT 

This unit contains components for measuring the line current and voltage
in order to calculate the power factor,
It consists of

1)  Current transformer 

2)    Potential transformer 

CURRENT TRANSFORMER

A current transformer is a type of "instrument transformer" that is designed to


provide a current in its secondary which is accurately proportional to the current
flowing in its primary. Current transformers are designed to produce either an
alternating current or alternating voltage proportional to the current being measured.

Fig: 3.1

current transformers measure power flow and provide electrical inputs to power
transformers and instruments. Current transformers produce either an alternating
current or alternating voltage that is proportional to the measured current. There are
two basic types of current transformers: wound and toroidal. Wound current

xiv
transformers consist of an integral primary winding that is inserted in series with the
conductor that carries the measured current. Toroidal or donut-shaped current
transformers do not contain a primary winding. Instead, the wire that carries the
current is threaded through a window in the toroidal transformer.

POTENTIAL TRANSFORMER

The standards define a voltage transformer as one in which "the secondary


voltage is substantially proportional to the primary voltage and differs in phase from it
by an angle which is approximately zero for an appropriate direction of the
connections.

This, in essence, means that the voltage transformer has to be as close as


possible to the "ideal" transformer. In an "ideal" transformer, the secondary voltage
vector is exactly opposite and equal to the primary voltage vector, when multiplied by
the turn’s ratio.

In a "practical" transformer, errors are introduced because some current is


drawn for the magnetization of the core and because of drops in the primary and
secondary windings due to leakage reactance and winding resistance. One can thus
talk of a voltage error, which is the amount by which the voltage is less than the
applied primary voltage, and the phase error, which is the phase angle by which the
reversed secondary voltage vector is displaced from the primary voltage.

3.2 ZERO CROSSING DETECTING UNIT 

As the name indicates the zero crossing detector is a device for detecting the
point where the voltage crosses zero in either direction. As shown in the circuit
diagram the first section is a bridge rectifier, which provides full wave rectified
output. This is applied to the base of the transistor through a base resistor, R2. The
capacitor charges to maximum of the bridge rectified output through the diode,D2.
This charge is available to the transistor as VCC. The capacitance value is kept large in
order to minimize ripple and get perfect dc. The transistor remains OFF until the Cut-
in voltage VBE is reached. During the OFF period of the transistor the output will be
high and approximately equal to VCC.

xv
From ct From pt

Fig: 3.2 zero crossing detector

Once the transistor is ON and IB increases according to the input wave, the
transistor moves slowly towards saturation where the output reduces to the saturation
voltage of the transistor which is nearly equal to zero Initially VBE = Cut-in voltage of
diode, the capacitor will charge through the diode Vm where Vm is the maximum
amplitude of the rectified wave. Now the diode is reverse biased and hence does not
provide a discharging path for the capacitor, which in turn has two effects.

Variation in VCC. It will provide base current to the transistor in the region
where both diode and transistor are OFF.Thus an output square wave is produced
whenever the input voltage crosses zero thereby acting as a zero crossing detector.

xvi
Fig: 3.3 output waveform of zcd

A zero crossing detector literally detects the transition of a signal waveform


from positive and negative, ideally providing a narrow pulse that coincides exactly
with the zero voltage condition. At first glance, this would appear to be an easy
enough task, but in fact it is quite complex, especially where high frequencies are
involved. In this instance, even 1kHz starts to present a real challenge if extreme
accuracy is need.

3.3 POWER SUPPLY FOR MICROCONTROLLER

Fig: 3.4 power supply circuit 

The input 230v AC supply is converted into 9v DC supply with the help of a
bridge rectifier and it is filtered through a capacitor to get pure dc supply, and a
voltage regulator u2 7805 is placed in order to give a constant 5v dc, hence the
microcontroller works with 5v dc supply. And a LED is placed in parallel to the
microcontroller in order to know whether the microcontroller is given the input.

xvii
RESISTORS
A resistor is a two-terminal electrical or electronic component that opposes an
electric current by producing a voltage drop between its terminals in proportion to the
current, that is, in accordance with Ohm's law: V = IR. The electrical resistance R is
equal to the voltage drop V across the resistor divided by the current I through the
resistor. Resistors are used as part of electrical networks and electronic circuits.The
power dissipated by a resistor is the voltage across the resistor multiplied by the
current through the resistor

3.4 LCD DISPLAY MODULE

J2
VDD 1
2
RE0 3
RE1 4
RE2 5
RD0 6
RD1 7
RD2 8
RD3 9
RD4 10
RD5 11
RD6 12
RD7 13
14
15
16
LCD Module

Fig:3.5 lcd module

The suggested circuit is quite simple. The display, data and control lines
are connected to the printer port lines. The read/write (RW) line is tied low to fix the
display in the write mode. The Enable (E) and the Register Select (RS) lines are tied
to two of the parallel port control lines. Liquid crystals solidify under low temperature

xviii
(below the storage temperature range) leading to defective orientation or the
generation of air bubbles (black or white). Air bubbles may also be generated if the
module is subject to a low temperature. If the LCD modules have been operating for a
long time showing the same display patterns, the display patterns may remain on the
screen as ghost images and a slight contrast irregularity may also appear. A normal
operating status can be regained by suspending use for some time. It should be noted
that this phenomenon does not adversely affect performance reliability. To minimize
the performance degradation of the LCD modules resulting from destruction caused
by static electricity etc., exercise care to avoid holding the following sections when
handling the modules Exposed area of the printed circuit board, Terminal electrode
sections.

3.5 RELAY

When a current flows through the coil, the resulting magnetic field attracts an
armature that is mechanically linked to a moving contact. The movement either makes
or breaks a connection with a fixed contact. When the current to the coil is switched
off, the armature is returned by a force approximately half as strong as the magnetic
force to its relaxed position. Usually this is a spring, but gravity is also used
commonly in industrial motor starters. Most relays are manufactured to operate
quickly. In a low voltage application, this is to reduce noise. In a high voltage or high
current application, this is to reduce arcing.

Fig: 3.6 electromagnetic relay

xix
If the coil is energized with DC, a diode is frequently installed across the coil,
to dissipate the energy from the collapsing magnetic field at deactivation, which
would otherwise generate a spike of voltage and might cause damage to circuit
components. Some automotive relays already include that diode inside the relay case.
Alternatively a contact protection network, consisting of a capacitor and resistor in
series, may absorb the surge. If the coil is designed to be energized with AC, a small
copper ring can be crimped to the end of the solenoid. This "shading ring" creates a
small out-of-phase current, which increases the minimum pull on the armature during
the AC

3.6 CAPACITOR

Distribution power system usually connects capacitor in parallel (shunt) rather


connecting in series. The function of shunt power capacitor is to provide leading
(capacitive) kVARs to an electrical system when and where needed. Lagging
(inductive) kVARs appear when there are inductors (coils) exist within electrical (e.g.
motor) or electronic (personal computer) equipments, as the amount grows, the
increment of inductive kVARs will increase as well, thus the demand of capacitive
kVARs to compensate is pretty much required in order to reduce unnecessary lost.

Capacitors are common components of electronic circuits, used almost as frequently


as resistors. Basic difference between the two is the fact that capacitor resistance
(called reactance) depends on voltage frequency, not only on capacitors' features.
Common mark for reactance is Xc and it can be calculated using the following

formula:

xx
3.7 RELATIONSHIP OF CAPACITOR WITH POWER FACTOR

Capacitor is the main component that supplies capacitive reactance, which is


negative reactive power. Since, the power factor is the ratio of real power and
apparent power, where apparent power has the relation with reactive power and real
power as shown in the power triangle in figure 1. As majority power system has
inductive loads thus normally only lagging power factor occurs hence capacitors are
used to compensate by producing leading current to the load to reduce the lagging
current, thereby shrink the phase angle distance between the real power and apparent
power. Table 1 list a number of common loads appears in general industrial systems
and their typical power factor. In general, power capacitors shall be Y-connected on
the three-phase distribution feeder. Grounding the neutral is essential for the fuses to
operate in case of any event of capacitor fault. For a small ungrounded Y-connected
capacitor bank, faulty capacitor would not blow the fuse to isolate faulty capacitor.
Any event of this could lead to an explosion to the capacitor bank. However, isolating
the neutral of the Y-connected of a capacitor bank has the advantage of reducing
harmonics. (Quote) The method can only be an alternative when grounding the
neutral would cause operating difficulty for a particular installation. In case of
insulation failure inside the unit, phase-to-ground fault can still occurs to an
ungrounded Y-connected capacitor bank even with its enclosure properly grounded.
The most effective solution is to insert reactors in series with each capacitor group
connected between the phase wire and the neutral of a 3-phase bank. This method is
used to mitigate any resonant circuit, while reduction of induction triple harmonic
frequency current can be made.

3.8 LOAD 

LINEAR LOADS 

Electrical loads consuming alternating current power consume both real power,
which does useful work, and reactive power, which dissipates no energy in the load
and which returns to the source on each alternating current cycle. The vector sum of
real and reactive power is the apparent power. The ratio of real power to apparent

xxi
power is the power factor, a number between 0 and 1 inclusive. The presence of
reactive power causes the real power to be less than the apparent power, and so, the
electric load has a power factor of less than 1.

The reactive power increases the current flowing between the power source and the
load, which increases the power losses through transmission and distribution lines.
This results in additional costs for power companies. Therefore, power companies
require their customers, especially those with large loads, to maintain their power
factors above a specified amount (usually 0.90 or higher) or be subject to additional
charges. Electricity utilities measure reactive power used by high demand customers
and charge higher rates accordingly. Some consumers install power factor correction
schemes at their factories to cut down on these higher costs.

Electrical engineers involved with the generation, transmission, distribution and


consumption of electrical power have an interest in the power factor of loads because
power factors affect efficiencies and costs for both the electrical power industry and
the consumers. In addition to the increased operating costs, reactive power can require
the use of wiring, switches, circuit breakers, transformers and transmission lines with
higher current capacities.

Power factor correction brings the power factor of an AC power circuit closer to 1 by
supplying reactive power of opposite sign, adding capacitors or inductors which act to
cancel the inductive or capacitive effects of the load, respectively. For example, the
inductive effect of motor loads may be offset by locally connected capacitors.
Sometimes, when the power factor is leading due to capacitive loading, inductors
(also known as reactors in this context) are used to correct the power factor. In the
electricity industry, inductors are said to consume reactive power and capacitors are
said to supply it, even though the reactive power is actually just moving back and
forth between each AC cycle.

Instead of using a capacitor, it is possible to use an unloaded synchronous motor. The


reactive power drawn by the synchronous motor is a function of its field excitation.
This is referred to as a synchronous condenser. It is started and connected to the
electrical network. It operates at full leading power factor and puts VARs onto the
network as required to support a system’s voltage or to maintain the system power

xxii
factor at a specified level. The condenser’s installation and operation are identical to
large electric motors. Its principal advantage is the ease with which the amount of
correction can be adjusted it behaves like an electrically variable capacitor.

NON‐LINEAR LOADS 

Non-linear loads create harmonic currents in addition to the original AC


current. Addition of linear components such as capacitors and inductors cannot cancel
these harmonic currents, so other methods such as filters or active power factor
correction are required to smooth out their current demand over each cycle of
alternating current and so reduce the generated harmonic currents.

CAPACITOR START INDUCTION MOTOR

single-phase capacitor start induction motor It is suitable for any places where a
larger starting torque and the starting current to be limited are required, and is used as
driving motor of air compressors, refrigerators, medical apparatus and other small
machines in which full-load starting is demanded. These series motors have three
frame sizes, 09, 1and 2 of totally enclosed fan-cooled. The frames are made of cast
iron or cast aluminium according to the requests. A start capacitor is sometimes
connected in series with this winding. It is important to note, even for the same motor,
that this capacitor can be placed or removed, without disturbing the motor operation.
When C is placed in Position 2 (split-phase capacitor), it always sinks a current, even
when the PTC is hot or when the START triac is OFF. This allows power factor
improvement and power consumption reduction. In fact, the C capacitor will be added
if the refrigerator or freezer does not reach the required efficiency level

xxiii
4 PIC-MICRO CONTROLLER

4.1 PIN DIAGRAM OF PIC16F877

Fig: 4.1 pin diagram of pic16f877

xxiv
4.2 BLOCK DIAGRAM OF PIC16F877

Fig: 4.2 block diagram of pic16f877

xxv
4.3 DEVICE OVERVIEW

There are four devices (PIC16F873, PIC16F874, PIC16F876 and PIC16F877)


. The PIC16F876/873 devices come in 28-pin packages and the PIC16F877/874
devices come in 40- pin packages. The 28-pin devices do not have a Parallel Slave
Port implemented.

MEMORY ORGANIZATION

There are three memory blocks in each of these PICmicro MCUs. The
Program Memory and Data Memory have separate buses so that concurrent access
can occur and is detailed in this section.

PROGRAM MEMORY ORGANIZATION

The PIC16F87X devices have a 13-bit program counter capable of addressing


an 8K x 14 program memory space. The PIC16F877/876 devices have 8K x 14 words
of FLASH program memory and the PIC16F873/ 874 devices have 4K x 14.
Accessing a location above the physically implemented address will cause a
wraparound. The reset vector is at 0000h and the interrupt vector is at 0004h.

DATA MEMORY ORGANIZATION

The data memory is partitioned into multiple banks which contain the General
Purpose Registers and the Special Function Registers. Bits RP1(STATUS<6>) and
RP0 (STATUS<5>) are the bank select bits. Each bank extends up to 7Fh (128 bytes).
The lower locations of each bank are reserved for the Special Function Registers.
Above the Special Function Registers are General Purpose Registers, implemented as
static RAM. All implemented banks contain Special Function Registers. Some “high
use” Special Function Registers from one bank may be mirrored in another bank for
code reduction and quicker access.

xxvi
GENERAL PURPOSE REGISTER FILE

The register file can be accessed either directly or indirectly through the File
Select Register FSR.

SPECIAL FUNCTION REGISTERS

The Special Function Registers are registers used by the CPU and peripheral
modules for controlling the desired operation of the device. These registers are
implemented as static RAM. The Special Function Registers can be classified into
two sets; core (CPU) and peripheral. Those registers associated with the core
functions are described in detail in this section. Those related to the operation of the
peripheral features are described in detail in the peripheral feature section.

I/O PORTS

Some pins for these I/O ports are multiplexed with an alternate function for the
peripheral features on the device. In general, when a peripheral is enabled, that pin
may not be used as a general purpose I/O pin. Additional information on I/O ports
may be found in the PICmicro™ Mid-Range Reference Manual, (DS33023).

PORTA and the TRISA Register

PORTA is a 6-bit wide bi-directional port. The corresponding data direction


register is TRISA. Setting a TRISA bit (=1) will make the corresponding PORTA pin
an input (i.e., put the corresponding output driver in a hi-impedance mode). Clearing a
TRISA bit (=0) will make the corresponding PORTA pin an output (i.e., put the
contents of the output latch on the selected pin). Reading the PORTA register reads
the status of the pins, whereas writing to it will write to the port latch. All write
operations are read-modify-write operations. Therefore, a write to a port implies that
the port pins are read, the value is modified and then written to the port data latch. Pin

xxvii
RA4 is multiplexed with the Timer0 module clock input to become the RA4/T0CKI
pin. The RA4/T0CKI pin is a Schmitt Trigger input and an open drain output. All
other PORTA pins have TTL input levels and full CMOS output drivers. Other
PORTA pins are multiplexed with analog inputs and analog VREF input. The
operation of each pin is selected by clearing/setting the control bits in the ADCON1
register (A/D Control Register1). The TRISA register controls the direction of the RA
pins, even when they are being used as analog inputs. The user must ensure the bits in
the TRISA register are maintained set when using them as analog inputs.

PORTB and the TRISB Register

PORTB is an 8-bit wide, bi-directional port. The corresponding data direction


register is TRISB. Setting a TRISB bit (=1) will make the corresponding PORTB pin
an input (i.e., put the corresponding output driver in a hi-impedance mode). Clearing a
TRISB bit (=0) will make the corresponding PORTB pin an output (i.e., put the
contents of the output latch on the selected pin). Three pins of PORTB are
multiplexed with the Low Voltage Programming function; RB3/PGM, RB6/PGC and
RB7/PGD. The alternate functions of these pins are described in the Special Features
Section. Each of the PORTB pins has a weak internal pull-up. A single control bit can
turn on all the pull-ups. This is performed by clearing bit RBPU (OPTION_REG<7>).
The weak pull-up is automatically turned off when the port pin is configured as an
output. The pull-ups are disabled on a Power-on Reset.

xxviii
4.4 MICROCONTROLLER CORE FEATURES

• High performance RISC CPU

• Only 35 single word instructions to learn

• All single cycle instructions except for program


branches which are two cycle

• Operating speed: DC - 20 MHz clock input


DC - 200 ns instruction cycle

• Up to 8K x 14 words of FLASH Program Memory,


Up to 368 x 8 bytes of Data Memory (RAM)
Up to 256 x 8 bytes of EEPROM Data Memory

• Pinout compatible to the PIC16C73B/74B/76/77

• Interrupt capability (up to 14 sources)

• Eight level deep hardware stack

• Direct, indirect and relative addressing modes

• Power-on Reset (POR)

• Power-up Timer (PWRT) and


Oscillator Start-up Timer (OST)

• Watchdog Timer (WDT) with its own on-chip RC


oscillator for reliable operation

xxix
• Programmable code protection

• Power saving SLEEP mode

• Selectable oscillator options

• Low power, high speed CMOS FLASH/EEPROM


Technology

• Fully static design


• In-Circuit Serial Programming (ICSP) via two
Pins

• Single 5V In-Circuit Serial Programming capability

• In-Circuit Debugging via two pins

• Processor read/write access to program memory

• Wide operating voltage range: 2.0V to 5.5V

• High Sink/Source Current: 25 Ma

• Commercial, Industrial and Extended temperature


Ranges

• Low-power consumption:

- < 0.6 mA typical @ 3V, 4 MHz

- 20 μA typical @ 3V, 32 kHz

- < 1 μA typical standby current

xxx
ANALOG FEATURES

• 10-bit, 8-channel A/D Converter

• Brown-Out Reset

• Analog Comparator module

• 2 analog comparators

• Programmable on-chip voltage reference module

• Programmable input multiplexing from device inputs and internal VREF

• Comparator outputs are externally accessible

PERIPHERAL FEATURES

• Timer0: 8-bit timer/counter with 8-bit prescaler

• Timer1: 16-bit timer/counter with prescaler,


can be incremented during SLEEP via external
crystal/clock

• Timer2: 8-bit timer/counter with 8-bit period


register, prescaler and postscaler

• Two Capture, Compare, PWM modules

• 10-bit multi-channel Analog-to-Digital converter

• Synchronous Serial Port (SSP) with SPI (Master


mode) and I2C (Master/Slave)

xxxi
5 PROBLEM DUE TO LOW POWER FACTOR

• Penalty charge in electric bill.

• Extra losses in feeder cables.

• Significant voltage drop.

• Reduction of effective capacity of cables.

5.1 ADVANTAGES OF POWER FACTOR CORRECTION

The main advantages of the Power Factor Correction are:

• The electrical load on the Utility is reduced, thereby allowing the Utility to
supply the surplus power to other consumers, without increasing its generation
capacity.
• Most of the Utilities impose low power factor penalties. By correcting the
power factor, this penalty can be avoided.
• High power factor reduces the load currents. Therefore, a considerable saving
is made in the hardware cost, such as cables, switchgear, substation
transformers, etc.

5.2 APPLICATION

• The power utility company,


• Power Quality Improvement, Voltage Balancing
• The commercial and residential consumer,
• And manufacturers of applications that generate reactive power.

xxxii
6. CONCLUSION

The system design implementation and testing were The testing process did
not run test on power converter based systems or synchronous motor due to required
huge amount of expense may need to further enhance the system to such feature,
financial is a critical issue upon further enhancement. Besides systems that contain
serious harmonic current or ill non-sinusoidal current would mostly exist in systems
with huge amount of active elements.

xxxiii
7. REFERENCES

• H. Saadat, “Power System Analysis”, Mc Graw Hill.


• TVPPA group, “Distribution Design Guidelines, Chapter 8 – Capacitors”, pp
256-295, Booth & Associates Inc., Alexander Publications. PIC16F873A’
Retrieved July 25th, 2006 from active elements.
• J. M. Bourgeois, ‘Circuit for power factor correction with regards to mains
filtering’, STMicroelectronics, Italy. Retrieved August 23rd, 2006 from

Source: http://www.st.com/stonline/products/literature/an/3727.htm

xxxiv
8. APPENDIX

MICROCONTROLLER PIC16F877 CODING


/*FINDING THE PHASE DIFFERENCE BETWEEN TWO INPUT SIGNALS*/
#include<pic.h>
#include<stdio.h>
#include "delay.c"
__CONFIG(0x3f71);
#define RS RE0
#define RW RE1
#define EN RE2
#define DATA PORTD
unsigned char i;
int data[5],avg=0;
void Capture_init(void);
void lcdinit(void);
void lcdclr(void);
void lcdcomd(unsigned char);
void lcddata(unsigned char);
void main()
{
unsigned int time;
ADCON1 = 7;
TRISE=0x00;
TRISD=0x00;
Capture_init();
lcdinit();
DelayMs(10);
lcdclr();
lcdcomd(0x80);
printf("PF Correction ");
DelayMs(100);
TRISD=0x00;

xxxv
while(1)
{
for(i=0;i<5;i++)
{
CCP2IF=0;
while(CCP2IF==0);
TMR1ON=1;
CCP1IF=0;
while(CCP1IF==0);
TMR1ON=0;
time=CCPR1H;
time=(time<<8)+CCPR1L;
avg=avg+time;
}
avg=avg/5;
if(RB0==0)
{
if(avg<500)
{
RB1=0;
lcdcomd(0xC0);
printf("Power Factr:0.99");
DelayMs(100);
}
else if(avg<1000&&avg>500)
{
RB1=1;
lcdcomd(0xC0);
printf("Power Factr:0.91");
}
else if(avg<1000&&avg>1200)
{
RB1=1;
lcdcomd(0xC0);

xxxvi
printf("Power Factr:0.92");
}
}
else
{
if(avg<500)
{
RB1=0;
lcdcomd(0xC0);
printf("Power Factr:0.99");
DelayMs(100);
}
else if(avg<1000&&avg<800)
{
RB1=0;
lcdcomd(0xC0);
printf("Power Factr:0.67");
}
TMR1H=0;
TMR1L=0;
TMR1IF=0;avg=0;
}
void Capture_init()
{
CCP1CON=0x05;
CCP2CON=0x05;
T1CON=0x34;
TMR1H=0;
TMR1L=0;
}
void lcdinit()
{
int i;
unsigned char command[]={0x38,0x0c,0x06,0x01};

xxxvii
for(i=0;i<4;i++)
{
lcdcomd(command[i]);
DelayMs(2);
}
}
void lcdclr()
{
lcdcomd(0x01);
DelayMs(2);
}
void lcdcomd(unsigned char cmd)
{
RS=0;
RW=0;
EN=1;
DATA=cmd;
DelayMs(3);
EN=0;
}
void putch(unsigned char byte)
{
RS=1;
RW=0;
EN=1;
DATA=byte;
DelayMs(3);
EN=0;
}

xxxviii

You might also like