Professional Documents
Culture Documents
Introducton 1.1 Overview:: USING MICROCONTROLLER-BASED RELAY" Designed With Peripheral
Introducton 1.1 Overview:: USING MICROCONTROLLER-BASED RELAY" Designed With Peripheral
CHAPTER 1
INTRODUCTON
1.1 OVERVIEW:
The Project Entitled POWER TRANSFORMER PROTECTION
USING MICROCONTROLLER-BASED RELAY designed with Peripheral
Interface Controller (PIC 16F877A). Utility companies have enormous amounts of
money invested in transformers of all types, including distribution and power
transformer. Operating, maintaining, and inspecting all power transformers are not
an easy work. In order to reduce burden on maintenance of such transformers a new
idea has been discovered.
This project is mainly used to protect the transformer from getting worn
out due to electrical disturbances. The electrical parameters like current, voltage of
the transformers are fed as base values, using a keypad to the Peripheral Interface
Controller and the output signal is provided to operate a relay by comparing the
base values with the operating electrical parameters. The application consists of a
board of electronic components inclusive of a PIC 16F877A microcontroller with
programmable logic. It has been designed to work with high accuracy. The
electrical parameters of the power transformer such as voltage and current are fed to
the Peripheral Interface Controller as base values. The voltage and current value
during the operation of the power transformer is monitored and fed to the controller.
These values are monitored using a LCD display. By comparing these values the
Peripheral Interface Controller produces a trip signal which operates the relay and
in turn the connectivity between main supply and the power transformer is cut off,
CHAPTER 2
PROTECTION SYSTEM OF TRANSFORMER
2.1 INTRODUCTION:
The protection system of transformer is inevitable due to the voltage
fluctuation, frequent insulation failure, earth fault, over current etc. Thus the
following automatic protection systems are incorporated.
1. Buchholz devices:
A Buchholz relay, also called a gas relay or a sudden pressure relay, is
a safety device mounted on some oil-filled power transformers and
reactors, equipped with an external overhead oil reservoir called a
conservator. The Buchholz Relay is used as a protective device sensitive
to the effects of dielectric failure inside the equipment. It also provides
protection against all kind of slowly developed faults such as insulation
failure of winding, core heating and fall of oil level.
2. Earth fault relays:
An earth fault usually involves a partial breakdown of winding
insulation to earth. The resulting leakage current is considerably less than
the short circuit current. The earth fault may continue for a long time and
creates damage before it ultimately develops into a short circuit and
removed from the system. Usually provides protection against earth fault
only.
3. Over current relays:
An over current relay, also called as overload relay have high current
setting and are arranged to operate against faults between phases. Usually
provides protection against phase -to-phase faults and overloading faults.
4. Differential system:
Differential system, also called as circulating-current system provides
protection against short-circuits between turns of a winding and between
windings that correspond to phase-to-phase or three phase type shortcircuits ie, it provides protection against earth and phase faults.
The complete protection of transformer usually requires the
combination of these systems. Most of the transformers are usually
connected to the supply system through series fuses instead of circuit
breakers. In existing method the transformer does not have automatic
protective relays for protecting the transformer.
If the flux in the core is sinusoidal, the relationship for either winding
between its number of turns, voltage, magnetic flux density and core cross-sectional
area is given by the universal emf equation (from Faradays Law):
(2.1)
10
11
embedded in it as one of its most important component. It is a dedicated computerbased system for an application(s) or product. It may be either an independent
system or a part of a larger system. As its software usually embeds in ROM (Read
Only Memory) it does not need secondary memories as in a computer.
An embedded system has three main components
It has hardware. Figure2.3 shows the units in the hardware of an embedded
system.
It has main application software. The application software may perform
concurrently the series of tasks or multiple tasks.
It has a real time operating system that supervises the application software
and provides a mechanism to let the processor run a process as per
scheduling and do the context-switch between the various processes. RTOS
defines the way the system works. It organizes access to a resource in
sequence of the series of tasks of the system. It schedules their working and
execution by following a plan to control the latencies and to meet the
deadlines. Latency refers to the waiting period between running the codes of
a task and the instance at which the need for the task arises.
It sets the rules during the execution of the application software. A smallscale embedded system may not need an RTOS. An embedded system has
software designed to keep in view three constraints:
i.
Available system memory
12
ii.
iii.
13
A tool chain for developing embedded software typically contains a crosscompiler, a cross-assembler, a linker/locator, and a method for loading the
software into the target machine.
A cross-compiler understands the same C language as a native compiler
(with a few exceptions) but its output uses the instruction set of the target
microprocessor.
A cross-compiler understands as assembly language that is specific to your
target microprocessor and outputs instructions for that microprocessor.
14
15
CHAPTER 3
PIC MICROCONTROLLER
16
17
Watchdog Timer (WDT) with its own on-chip RC Oscillator for reliable
operation
Programmable code-protection
Power saving SLEEP mode
Selectable oscillator options
In-Circuit Serial Programming (ICSP) via two pins
Only single 5V source needed for programming capability
In-Circuit Debugging via two pins
Wide operating voltage range: 2.5V to 5.5V
High Sink/Source Current: 25 Ma
Commercial and Industrial temperature ranges
Low-power consumption:
< 2 Ma typical @ 5V, 4 MHz
20Ma typical @ 3V, 32 kHz
< 1Ma typical standby current
18
(Master/Slave)
USART/SCI with 9-bit address detection.
Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls
3.4.
19
20
DEVICE
PIC
16F877A
PROGRAM FLASH
8K
DATA
DATA
MEMORY
EEPROM
368 Bytes
256 Bytes
21
Pin Name
OSC1/CLKIN
DIP
PLCC
QFP
I/O/P
Buffer
Pin#
Pin#
Pin#
Type
Type
13
14
30
ST/
Description
Oscillator crystal
input/external clock
source input.
CMOS(4)
OSC2/
14
15
31
CLKOUT
MCLR/VPP/
18
I/P
ST
THV
RA0/AN0
19
I/O
TTL
RA1/AN1
20
I/O
TTL
22
RA2/AN2/
VREF-
21
I/O
TTL
RA3/AN3/
VREF+
22
I/O
TTL
RA4/T0CKI
6
RA5/SS/AN4
23
24
I/O
I/O
ST
TTL
33
36
I/O
TTL/ST(1)
RB1
34
37
I/O
TTL
RB2
35
38
10
I/O
TTL
RB3/PGM
36
39
11
I/O
TTL
RB4
37
41
14
I/O
TTL
23
RB5
RB6/PGC
RB7/PGD
38
39
40
42
43
44
15
16
17
I/O
I/O
I/O
TTL
TTL/ST(2)
TTL/ST(2)
15
16
32
I/O
ST
ST
T1CKI
RC1/T1OSI/
16
18
35
I/O
CCP2
RC2/CCP1
17
19
36
I/O
ST
RC3/SCK/SCL
18
20
37
I/O
ST
RC4/SDI/SDA
23
25
42
I/O
ST
24
RC5/SDO
24
26
43
I/O
ST
RC6/TX/CK
25
27
44
I/O
ST
RC7/RX/DT
26
29
I/O
ST
RD0/PSP0
19
21
38
I/O
ST/TTL(3)
RD1/PSP1
20
22
39
I/O
ST/TTL(3)
RD2/PSP2
21
23
40
I/O
ST/TTL(3)
RD3/PSP3
22
24
41
I/O
ST/TTL(3)
RD4/PSP4
27
30
I/O
ST/TTL(3)
RD5/PSP5
28
31
I/O
ST/TTL(3)
RD6/PSP6
29
32
I/O
ST/TTL(3)
RD7/PSP7
30
33
I/O
ST/TTL(3)
interfacing to a
microprocessor bus.
25
RE1/WR/AN6
10
25
26
I/O
ST/TTL(3)
I/O
(3)
ST/TTL
10
11
27
I/O
ST/TTL(3)
VSS
12,31
13,34
6,29
NC
1,17,28,40
12,13
,
RE2/CS/AN7
33,34
26
Bit#
bit0
bit1
bit2
bit3
Buffer
TTL
TTL
TTL
TTL
Function
Input/output or analog input
Input/output or analog input
Input/output or analog input
Input/output or analog input or VREF
Input/output or external clock input for
27
RA5/
/AN4
bit4
bit5
ST
TTL
28
a) Any read or write of PORTB. This will end the mismatch condition.
b) Clear flag bit RBIF. A mismatch condition will continue to set flag bit
RBIF. Reading PORTB will end the mismatch condition, and allow flag bit RBIF to
be cleared. The interrupt on change feature is recommended for wake-up on key
depression operation and operations where PORTB is only used for the interrupt on
change feature. Polling of PORTB is not recommended while using the interrupt on
change feature. This interrupt on mismatch feature, together with software
configurable pull-ups on these four pins, allow easy interface to a keypad and make
it possible for wake-up on key depression.
3.8.2 PORT B FUNCTIONS:
Name
RB0/INT
Bit#
bit0
Buffer
Function
(1)
TTL/ST
Input/output pin or external interrupt input.
Internal software programmable weak pull-
RB1
RB2
bit1
bit2
TTL
up
Input/output pin. Internal software
TTL
RB3/PGM
bit3
TTL
RB4
bit4
TTL
pull-up
Input/output pin (with interrupt on change).
Internal software programmable weak pull-
RB5
bit5
TTL
up
Input/output pin (with interrupt on change).
Internal software programmable weak pull-
29
RB6/PGC
bit6
TTL/ST
(2)
up
Input/output pin (with interrupt on change)
or In-Circuit Debugger pin. Internal software
programmable weak pull-up. Serial
programming clock.
RB7/PGD
bit7 TTL/ST
Input/output pin (with interrupt on change)
or In-Circuit Debugger pin. Internal software
programmable weak pull-up. Serial
programming data.
Legend: TTL = TTL input, ST = Schmitt Trigger input
(2)
Note 1: This buffer is a Schmitt Trigger input when configured as the external
interrupt.
2: This buffer is a Schmitt Trigger input when used in serial programming
mode.
30
while other peripherals override the TRIS bit to make a pin an input. Since the TRIS
bit override is in effect while the peripheral is enabled, read-modify write
instructions (BSF, BCF, XORWF) with TRISC as destination should be avoided.
The user should refer to the corresponding peripheral section for the correct TRIS
bit settings.
3.8.3 PORT C FUNCTIONS:
Name
Bit#
RC0/T1OSO/T1CKI bit0
RC1/T1OSI/CCP2
bit1
Buffer
Function
Type
ST
ST
RC2/CCP1
bit2
ST
output
Input/output port pin or Capture1
input/Compare1 output/PWM1
RC3/SCK/SCL
bit3
ST
output
RC3 can also be the synchronous
serial clock for both SPI and I2C
RC4/SDI/SDA
RC5/SDO
bit4
bit5
ST
modes
RC4 can also be the SPI Data In (SPI
ST
RC6/TX/CK
bit6
ST
RC7/RX/DT
bit7
ST
31
Asynchronous Receive or
Synchronous Data
Legend: ST = Schmitt Trigger input
Bit#
bit0
bit1
bit2
bit3
bit4
bit5
bit6
Buffer Type
ST/TTL(1)
ST/TTL
(1)
ST/TTL
(1)
ST/TTL
(1)
ST/TTL
(1)
ST/TTL
(1)
ST/TTL
(1)
Function
Input/output port pin or parallel slave port
bit0
Input/output port pin or parallel slave port
bit1
Input/output port pin or parallel slave port
bit2
Input/output port pin or parallel slave port
bit3
Input/output port pin or parallel slave port
bit4
Input/output port pin or parallel slave port
bit5
Input/output port pin or parallel slave port
32
RD7/PSP7
bit7
ST/TTL
(1)
bit6
Input/output port pin or parallel slave port
bit7
Legend: ST = Schmitt Trigger input TTL = TTL input
Note 1: Input buffers are Schmitt Triggers when in I/O mode and TTL buffer when
in Parallel Slave Port Mode
/AN5
Bit#
bit0
33
RE1/
RE2/
/AN6 bit1
/AN7
bit2
ST/TTL(1)
ST/TTL(1)
34
physically implemented address will cause a wrap around. The RESET vector is at
0000h and the interrupt vector is at 0004h.
35
The data memory is partitioned into multiple banks which contain the
General Purpose Registers and the special functions Registers. Bits RP1
(STATUS<6) and RP0 (STATYUS<5>) are the bank selected bits.
RP1:RP0 Banks
00
01
10
11
Each bank extends up to 7Fh (1238 bytes). The lower locations of each bank
are reserved for the Special Function Registers.
CHAPTER 4
SOFTWARE USED
36
comport. The command from fussing kit sends from the c program according to
user wish.
4.1.1 HI-TEC C
HI-TEC C is a set of software that translates the program written in the C
language in to executable machine code versions are available which compile the
program for the operation under the host operating system.
Some of the Hi-Tec features are
A simple batch file will compile, assemble and link entire program
The compiler perform strong type checking and issues warning about
various constructs which may represent programming errors
37
MP LAB
Mp lab provides the following functions
Create and edit source file
Group files in to projects
Debug source code
Debug executable logic using the simulator
Tools in Mp Lab are
Mp Lab development tool
Mp Lab project manager
Mp Lab editor
Mp Lab SIM simulator
Mp Lab ICE emulator
#include <pic.h>
#include <lcd.h>
void adc_init(void);
void adc0(void);
38
void adc1(void);
void hex_dec_cur(unsigned char);
void set_mode();
static bit relay @ ((unsigned ) & PORTE*8+1);
static bit set @((unsigned) &PORTC*8+0);
static bit ent @((unsigned) &PORTC*8+1);
static bit inc @((unsigned) &PORTC*8+2);
static bit dec @((unsigned) &PORTC*8+3);
unsigned char volt,curr,j,curr_high,curr_low,volt_low,volt_high;
unsigned int temp0,temp1;
void main()
{
TRISC=0x0f;
relay=0;
lcd_init();
adc_init();
39
command(0x80);
lcd_condis("Volt & Curr Moni",16);
command(0xc0);
lcd_condis(" V:
C:
del();
EEPROM_READ(12);
curr_high=EEDATA;
EEPROM_READ(13);
curr_low=EEDATA;
EEPROM_READ(14);
volt_high=EEDATA;
EEPROM_READ(15);
volt_low=EEDATA;
while(1)
{
temp0=0;
adc0();
command(0xc3);
",16);
40
hex_dec(volt);
temp0=0;
adc1();
command(0xca);
hex_dec_cur(curr);
if(volt>volt_high
||
volt<volt_low
||
curr>curr_high
curr<curr_low)relay=1;
if(!set) set_mode();
//While
} //Main
void adc_init()
{
ADCON1=0x02;
||
41
TRISA=0xff;
TRISE=0x00;
}
void adc0()
{
for(j=0;j<10;j++)
{
ADCON0=0x00;
ADON=1;
delay(255);
ADCON0 =0x05;
42
void adc1()
{
for(j=0;j<10;j++)
{
ADCON0=0x08;
ADON=1;
delay(255);
ADCON0 =0x0d;
43
command(0xC0);
lcd_condis("Hig Curr :
",16);
44
j=0;
while(ent)
{
command(0xca);command(0x0f);
if(!inc){j++; if(j>=255)j=0;hex_dec_cur(j);}
else if(!dec){j--;if(j>=255)j=255;hex_dec_cur(j);}
delay(15000);
}
EEPROM_WRITE(12,j);delay(2000);
EEPROM_READ(12);
curr_high=EEDATA;
del();
command(0xC0);
lcd_condis("Low Curr :
",16);
j=0;
while(ent)
{
command(0xca);command(0x0f);
45
if(!inc){j++; if(j>=255)j=0;hex_dec_cur(j);}
else if(!dec){j--;if(j>=255)j=255;hex_dec_cur(j);}
delay(15000);
}
EEPROM_WRITE(13,j);delay(2000);
EEPROM_READ(13);
curr_low=EEDATA;
del();
command(0xC0);
lcd_condis("Hig Volt :
",16);
j=0;
while(ent)
{
command(0xca);command(0x0f);
if(!inc){j++; if(j>=255)j=0;hex_dec(j);}
else if(!dec){j--;if(j>=255)j=255;hex_dec(j);}
delay(15000);
}
46
EEPROM_WRITE(14,j);delay(2000);
EEPROM_READ(14);
volt_high=EEDATA;
del();
command(0xC0);
lcd_condis("Low Volt :
",16);
j=0;
while(ent)
{
command(0xca);command(0x0f);
if(!inc){j++; if(j>=255)j=0;hex_dec(j);}
else if(!dec){j--;if(j>=255)j=255;hex_dec(j);}
delay(15000);
}
EEPROM_WRITE(15,j);delay(2000);
EEPROM_READ(15);
volt_low=EEDATA;
del();
47
command(0x80);
lcd_condis("Volt & Curr Moni",16);
command(0xc0);
lcd_condis(" V:
C:
",16);
CHAPTER 5
HARDWARE IMPLEMENTED
48
49
Bridge rectifier:
When four diodes are connected as shown in figure, the circuit is called as
bridge rectifier. The input to the circuit is applied to the diagonally opposite corners
of the network, and the output is taken from the remaining two corners.Let us
assume that the transformer is working properly and there is a positive potential, at
point A and a negative potential at point B. the positive potential at point A will
forward bias D3 and reverse bias D4.
The negative potential at point B will forward bias D1 and reverse D2. At
this time D3 and D1 are forward biased and will allow current flow to pass through
them; D4 and D2 are reverse biased and will block current flow. The path for
current flow is from point B through D1, up through RL, through D3, through the
secondary of the transformer back to point B. this path is indicated by the solid
arrows. Waveforms (1) and (2) can be observed across D1 and D3.
One-half cycle later the polarity across the secondary of the transformer
reverse, forward biasing D2 and D4 and reverse biasing D1 and D3. Current flow
will now be from point A through D4, up through RL, through D2, through the
secondary of T1, and back to point A. This path is indicated by the broken arrows.
Waveforms (3) and (4) can be observed across D2 and D4. The current flow through
RL is always in the same direction. In flowing through RL this current develops a
voltage corresponding to that shown waveform (5). Since current flows through the
load (RL) during both half cycles of the applied voltage, this bridge rectifier is a
full-wave rectifier.
50
IC voltage regulators:
Voltage regulators comprise a class of widely used Ics. Regulator IC units
contain the circuitry for reference source, comparator amplifier, control device, and
overload protection all in a single IC. IC units provide regulation of either a fixed
positive voltage, a fixed negative voltage, or an adjustably set voltage. The
regulators can be selected for operation with load currents from hundreds of milli
amperes to tens of amperes, corresponding to power ratings from milli watts to tens
of watts.
51
52
53
54
The full wave rectifier is the combination of half wave precision rectifer and
summing amplifier. When the input voltage is negative, there is a negative voltage
on the diode, too, so it works like an open circuit, there is no current in the load and
the output voltage is zero. When the input is positive, it is amplified by the
operational amplifier and it turns the diode on. There is current in the load and,
because of the feedback, the output voltage is equal to the input.
In this case, when the input is greater than zero, D2 is ON and D1 is OFF, so
the output is zero. When the input is less than zero, D2 is OFF and D1 is ON, and
the output is like the input with an amplification of R2 / R1. The full-wave rectifier
depends on the fact that both the half-wave rectifier and the summing amplifier are
precision circuits. It operates by producing an inverted half-wave-rectified signal
and then adding that signal at double amplitude to the original signal in the
summing amplifier. The result is a reversal of the selected polarity of the input
signal. Then the output of the rectified voltage is adjusted to 0-5v with the help of
variable resistor VR1. Then given to ripples are filtered by the C1 capacitor. After
the filtration the corresponding DC voltage is given to ADC or other related circuit.
55
5.5 RELAY
A relay is an electrically operated switch. Current flowing through the coil of
the relay creates a magnetic field which attracts a lever and changes the switch
contacts. The coil current can be on or off so relays have two switch positions and
they are double throw (changeover) switches. Relays allow one circuit to switch a
second circuit which can be completely separate from the first. For example a low
voltage battery circuit can use a relay to switch a 230V AC mains circuit.
56
There is no electrical connection inside the relay between the two circuits;
the link is magnetic and mechanical. The coil of a relay passes a relatively large
current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays
designed to operate from lower voltages. Most ICs (chips) cannot provide this
current and a transistor is usually used to amplify the small IC current to the larger
value required for the relay coil. The maximum output current for the popular 555
timer IC is 200mA so these devices can supply relay coils directly without
amplification.
Fig
Relay types
Relays are usually SPDT or DPDT but they can have many more sets of
switch contacts, for example relays with 4 sets of changeover contacts are readily
available. Most relays are designed for PCB mounting but you can solder wires
directly to the pins providing you take care to avoid melting the plastic case of the
relay. The animated picture shows a working relay with its coil and switch contacts.
You can see a lever on the left being attracted by magnetism when the coil is
switched on. This lever moves the switch contacts . There is one set of contacts
(SPDT) in the foreground and another behind them, making the relay DPDT.
57
Fig
The relay's switch connections are usually labeled COM, NC and NO:
COM = Common, always connect to this. It is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
58
Transistor
Transistor
Q1
Q2
ON
OFF
OFF
OFF
ON
ON
Relay
59
passes a
60
Advantages of relays:
Relays can switch AC and DC, transistors can only switch DC. Relays can
switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Disadvantages of relays:
61
Relays cannot switch rapidly (except reed relays), transistors can switch
many times per second.
Relays use more power due to the current flowing through their coil.
Relays require more current than many chips can provide, so a low power
transistor may be needed to switch the current for the relay's coil.
62
63
5.6.2 Applications:
Personal computers, word processors, facsimiles, telephones, etc.
5.7 KEYPAD
Keypad is used to enter the predefined values of the power transformer.
Keypad with four keys is employed. The operations of the keys are to increment and
decrement the values to be set.
64
CHAPTER 6
CONCLUSION
Transformers are static devices, totally enclosed and generally oil immersed.
Therefore chances of faults occurring on them are very rare. However the
consequences of even a rare fault may be very serious unless the transformer is
quickly disconnected from the system. This necessitates to provide adequate
automatic protection for transformers against possible faults. The major faults on
transformers occur due to short circuits in the transformers or in their connections.
The basic system used for protection against these faults is the differential relay
scheme.
Protection of power transformer is a big challenge nowadays. By the help of
microcontroller-based relay, protection of transformer is performed very quickly
and accurately. This system provides a better and safer protection than the other
methods which are currently in use. The advantages of this system over the current
methods in use are fast response, better isolation and accurate detection of the fault.
This system overcomes the other drawbacks in the existing systems such as
maintenance and response time.
65
REFERENCES
1. Guzman, A., S. Zocholl and G.Benmouyal, 2000. Performance analysis of
traditional and improved transformer differential protective relays. Hector J.
Altue (Universidad Autonoma de Nuevo Leon) SEL.
2. Guzman, A., S. Zocholl, G.Benmouyal, and H.J.Altuve 2001. A current
based solution for differential protection IEEE Trans., Power Deliv.,
3. Mao, P.L. and R.K. Aggarwal, 2001. A novel approach to the classification of
transient phenomena in power transformers using combined wavelet
transform and neural network. IEEE Trans. Power Deliv., 16:4
4. Sidhu, T.S., M.S. Sachdev and M. Hfuda, 1996 Computer simulation of
protective relay design for evaluation their performance. Power System
Research Group University of Saskatchewan, Canada.
5. Sachdev M.S., T.S. Sidhu and H.C. Wood, 1989. A digital relaying algorithm
for detecting transformer winding faults. IEEE Trans. Power Deliv.,
43:1638-1648.