Escolar Documentos
Profissional Documentos
Cultura Documentos
CHAPTER 1
INTRODUCTON
1.1 OVERVIEW:
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,
2
CHAPTER 2
2.1 INTRODUCTION:
1. Buchholz devices:
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:
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 Faraday’s Law):
…(2.1)
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 providing adequate
automatic protection for transformers against possible faults.
7
1. Open circuits
2. Overheating
3. Winding short-circuits
When an internal fault occurs, the transformer must be disconnected quickly from
the system because a prolonged arc in the transformer may cause oil fire. Therefore,
relay protection is absolutely necessary for internal faults.
• Program installation—You will need special tools to get your software into
embedded systems.
• A microprocessor
• 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 small-
scale embedded system may not need an RTOS. An embedded system has
software designed to keep in view three constraints:
iii. The need to limit power dissipation when running the system
continuously in cycles of wait for events, run, stop and wake-
up.
The assembly language produces hex file that is much smaller than C
programming, on the other hand programming 8051 in C is less time consuming
and much easier to write, but size of hex file produced is much larger than if we use
assembly language which may lead to increase in memory size for even a small
application so it decreases the application speed. Although, the following are some
of the major reasons for writing C programs instead of assembly.
processor inside it performs only one task; namely, getting the data and printing it.
CHAPTER 3
PIC MICROCONTROLLER
• Microcontroller has one or two operational codes for moving data from
external to CPU
• Microcontroller has many bit handling instructions
• Microcontroller works faster than microprocessor because of rapid
movement of bits within the chip
• Microcontroller can function as a computer with the addition of no external
parts
Synchronous Serial Port (SSP) with SPI. (Master Mode) and I2C.
(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. ARCHITECTURE OF PIC 16F877A
The complete architecture of PIC 16F877A is shown in the fig 3.1 that
gives details about the specifications of PIC 16F877A. Fig 2.2 shows the
complete pin diagram of the IC PIC 16F877A.
Oscillator crystal
input/external clock
OSC1/CLKIN 13 14 30 I ST/ source input.
CMOS(4)
PORTA is a bi-
directional I/O port.
RA0 can also be analog
RA0/AN0 2 3 19 I/O TTL input0
RA2/AN2/
RA2 can also be analog
VREF- 4 5 21 I/O TTL
input2 or negative analog
reference voltage
23
PORTB is a bi-
directional I/O port.
PORTB can be software
programmed for internal
weak pull-up on all
inputs
PORTC is a bi-
directional I/O port.
RC0 can also be the
RC0/T1OSO/ 15 16 32 I/O ST Timer1 oscillator output
or a Timer1 clock input.
T1CKI
RC1 can also be the
Timer1 oscillator input
RC1/T1OSI/ 16 18 35 I/O ST or Capture2
input/Compare2
CCP2 output/PWM2 output.
RC2 can also be the
Capture1
RC2/CCP1 17 19 36 I/O ST input/Compare1
output/PWM1 output.
PORTD is a bi-
directional I/O port or
parallel slave port when
RD0/PSP0 19 21 38 I/O ST/TTL(3) interfacing to a
microprocessor bus.
RD1/PSP1 20 22 39 I/O ST/TTL(3)
PORTE is a bi-
directional I/O port.
RE0 can also be read
RE0/RD/AN5 8 9 25 I/O ST/TTL(3) control for the parallel
slave port, or analog
input5.
RE1 can also be write
RE1/WR/AN6 9 10 26 I/O ST/TTL (3) control for the parallel
slave port, or analog
input6.
RE2 can also be select
control for the parallel
RE2/CS/AN7 10 11 27 I/O ST/TTL(3) slave port, or analog
input7.
Input/Output 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.
27
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; this value is modified,
and then written to the port data latch. Pin 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 RA port 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.
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.
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.
up
(2)
RB6/PGC bit6 TTL/ST Input/output pin (with interrupt on change)
or In-Circuit Debugger pin. Internal software
programmable weak pull-up. Serial
programming clock.
(2)
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
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.
When enabling peripheral functions, care should be taken in defining TRIS bits for
each PORTC pin. Some peripherals override the TRIS bit to make a pin an output,
31
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.
Asynchronous Receive or
Synchronous Data
Legend: ST = Schmitt Trigger input
This section is not applicable to the 28-pin devices. PORTD is an 8-bit port
with Schmitt Trigger input buffers. Each pin is individually configurable as an input
or output. PORTD can be configured as an 8-bit wide microprocessor Port (parallel
slave port) by setting control bit PSPMODE (TRISE<4>). In this mode, the input
buffers are TTL.
bit6
(1)
RD7/PSP7 bit7 ST/TTL 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
PORTE pins are multiplexed with analog inputs. When selected as an analog
input, these pins will read as ‘0’s. TRISE controls the direction of the RE pins, even
when they are being used as analog inputs. The user must make sure to keep the
pins configured as inputs when using them as analog inputs.
There are three memory blocks in each of the PIC16F877 MUCs. The
program memory and Data Memory have separate buses so that concurrent access
can occur. There are three memory blocks in each of the PIC16F87X MCUs. The
Program Memory and Data Memory have separate buses so that concurrent access
can occur and is detailed in this section. The EEPROM data memory block is
detailed in Section 4.0. Additional information on device memory may be found in
the PIC micro Mid-Range Reference Manual.
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 0
01 1
10 2
11 3
Each bank extends up to 7Fh (1238 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 frequently used special
function registers from one bank may be mirrored in another bank for code
reduction and quicker access.
CHAPTER 4
SOFTWARE USED
comport. The command from fussing kit sends from the c program according to
user wish.
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.
• 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
MP LAB
Mp lab provides the following functions
#include <pic.h>
#include <lcd.h>
void adc_init(void);
void adc0(void);
39
void adc1(void);
void set_mode();
void main()
TRISC=0x0f;
relay=0;
lcd_init();
adc_init();
40
command(0x80);
command(0xc0);
lcd_condis(" V: C: ",16);
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);
41
hex_dec(volt);
temp0=0;
adc1();
command(0xca);
hex_dec_cur(curr);
if(!set) set_mode();
} //While
} //Main
void adc_init()
TRISE=0x00;
void adc0()
for(j=0;j<10;j++)
delay(255);
volt=temp0/10;
43
void adc1()
for(j=0;j<10;j++)
delay(255);
curr=temp0/10;
}
44
h=val/100;
hr=val%100;
t=hr/10;
o=hr%10;
lcd_disp(h+0x30);
lcd_disp(t+0x30);
lcd_disp('.');
lcd_disp(o+0x30);
void set_mode()
command(0x80);
command(0xC0);
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);
j=0;
while(ent)
command(0xca);command(0x0f);
46
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);
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);
}
47
EEPROM_WRITE(14,j);delay(2000);
EEPROM_READ(14);
volt_high=EEDATA;
del();
command(0xC0);
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();
48
command(0x80);
command(0xc0);
lcd_condis(" V: C: ",16);
CHAPTER 5
HARDWARE IMPLEMENTED
A regulator circuit removes the ripples and also remains the same dc value
even if the input dc voltage varies, or the load connected to the output dc
voltage changes. This voltage regulation is usually obtained using one of the
popular voltage regulator IC units.
Transformer:
The potential transformer will step down the power supply voltage (0-230V)
to (0-6V) level. Then the secondary of the potential transformer will be connected
to the precision rectifier, which is constructed with the help of op–amp. The
advantages of using precision rectifier are it will give peak voltage output as DC,
rest of the circuits will give only RMS output.
50
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.
51
IC voltage regulators:
This circuit is designed to monitor the supply voltage. The supply voltage
that has to monitor is step down by the potential transformer. Usually we are using
the 0-6v potential transformer. The step down voltage is rectified by the precision
rectifier. The precision rectifier is a configuration obtained with an operational
amplifier in order to have a circuit behaving like an ideal diode or rectifier.
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.
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.
56
5.5 RELAY
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.
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.
58
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.
This circuit is designed to control the load. The load may be motor or any
other load. The load is turned ON and OFF through relay. The relay ON and OFF
is controlled by the pair of switching transistors (BC 547). The relay is connected in
the Q2 transistor collector terminal. A Relay is nothing but electromagnetic
switching device which consists of three pins. They are Common, Normally close
(NC) and Normally open (NO).
The relay common pin is connected to supply voltage. The normally open
(NO) pin connected to load. When high pulse signal is given to base of the Q1
transistors, the transistor is conducting and shorts the collector and emitter terminal
and zero signals are given to base of the Q2 transistor. So the relay is turned OFF
state.
59
1 ON OFF OFF
0 OFF ON ON
If you are choosing a relay for an existing PCB you will need to ensure that
its dimensions and pin arrangement are suitable. You should find this
information in the supplier's catalogue.
2. Coil voltage:
The relay's coil voltage rating and resistance must suit the circuit powering
the relay coil. Many relays have a coil rated for a 12V supply but 5V and
24V relays are also readily available. Some relays operate perfectly well with
a supply voltage which is a little lower than their rated value.
3. Coil resistance:
The circuit must be able to supply the current required by the relay coil. You
can use Ohm's law to calculate the current:
For example: A 12V supply relay with a coil resistance of 400 passes a
current of 30mA. This is OK for a 555 timer IC (maximum output current
200mA), but it is too much for most ICs and they will require a transistor to
amplify the current.
Most relays are SPDT or DPDT which are often described as "single pole
changeover" (SPCO) or "double pole changeover" (DPCO). For further
information please see the page on switches.
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).
• Relays can switch many contacts at once.
Disadvantages of relays:
• 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.
One each polarizer’s are pasted outside the two glass panels. This
polarizer’s would rotate the light rays passing through them to a definite angle, in a
particular direction. When the LCD is in the off state, light rays are rotated by the
two polarizers and the liquid crystal, such that the light rays come out of the LCD
without any orientation, and hence the LCD appears transparent.
the LCD would be rotated by the polarizer’s, which would result in activating /
highlighting the desired characters. The LCD’s are lightweight with only a few
millimeters thickness. Since the LCD’s consume less power, they are compatible
with low power electronic circuits, and can be powered for long durations. The
LCD does don’t generate light and so light is needed to read the display. By using
backlighting, reading is possible in the dark. The LCD’s have long life and a wide
operating temperature range. Changing the display size or the layout size is
relatively simple which makes the LCD’s more customer friendly.
• 9,920-bit character generator ROM for a total of 240 character fonts. 208
character fonts (5 x 8 dots) 32 character fonts (5 x 10 dots)
• 64 x 8 bit character generator RAM 8 character generator RAM 8 character
fonts (5 x 8 dots) 4 characters fonts (5 x 10 dots)
• Programmable duty cycles
• 1/8 – for one line of 5 x 8 dots with cursor
• 1/11 – for one line of 5 x 10 dots with cursor
• 1/16 – for one line of 5 x 8 dots with cursor
• Wide range of instruction functions display clear, cursor home, display on/off,
cursor on/off, display character blink, cursor shift, display shift.
• Automatic reset circuit, which initializes the controller / driver ICs after
power on.
5.6.2 Applications:
5.7 KEYPAD
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.
REFERENCES
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.