Kam All Ll Lllll Lllll

download Kam All Ll Lllll Lllll

of 71

Transcript of Kam All Ll Lllll Lllll

  • 7/30/2019 Kam All Ll Lllll Lllll

    1/71

    1.1 INTRODUCTION:

    In three-phase applications, if low voltage is available in any one or two phases, and you

    want your equipment to work on normal voltage, this circuit will solve your problem. However,a proper-rating fuse needs to be used in the input lines (R, Y and B) of each phase. The circuit

    provides correct voltage in the same power supply lines through relays from the other phase

    where correct voltage is available. Using it you can operate all your equipment even when

    correct voltage is available on a single phase in the building.

    The circuit is built around a transformer, comparator, transistor and relay. Three identical

    sets of this circuit, one each for three phases, are used. Let us now consider the working of the

    circuit connecting red cable (call it R phase).

    The mains power supply phase R is stepped down by transformer X1 to deliver 12V, 300

    mA, which is rectified by the full wave bridge. If fault occur in the phase, then the voltage which

    is fed to the microcontroller read zero volts. At this instant microcontroller gives 5 volts to driver

    and driver operates the relay and this relay gets back up from the live phase.

    This system is applicable for Bungalows/ Flats, Hotels / hostels Offices / Banks

    Hospitals / Nursing Homes, Marriage Halls / auditoriums, Computer Centers, Commercial

    Complexes, Laboratories, UPS (single Phase).

    1

  • 7/30/2019 Kam All Ll Lllll Lllll

    2/71

    8051 MICROCONTROLLER

    2.1 INTRODUCTION:

    Microcontroller (MCU) is a computer-on-a-chip used to control electronic devices. It is

    a type of microprocessor emphasizing self-sufficiency and cost-effectiveness, in contrast to a

    general-purpose microprocessor, the kind used in a PC. A typical microcontroller contains all the

    memory, peripherals and input/output interfaces need Microcontrollers are a component in many

    kinds of electronic equipment. They are the vast

    majority of all processor chips sold. Over 50% are "simple" controllers, and another 20% are

    more specialized digital signal processors (DSPs). A typical home in the Western world is likely

    to have only one or two general-purpose microprocessors but somewhere between one and two

    dozen microcontrollers. They can be found in almost any electrical device, washing machines,

    microwave ovens, telephones etc.

    2.2 History of the 8051 family:

    In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051. This

    microcontroller had 128 bytes of RAM,4K bytes of on- chip ROM, two timers, one serial port,and four ports(each 8-bit wide) all on a single chip. At the time it is also referred to as a system

    on chip. This is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a

    time. Data larger than 8 bits has to be broken into 8 bit pieces to be processed by the CPU. The

    8051 has a total of four I/O ports, each 8-bit wide.

    The 8051 became widely popular after Intel allowed other manufactures to make and

    market any flavors of the 8051 they please with the condition that they remain code-compatible

    with the 8051. This led to many versions of the 8051 with different speeds and amounts of on-

    chip ROM marketed by more than half a dozen manufacturers. It is important to note that

    although there are different flavors of the 8051 in terms of speed and amount of on-chip ROM,

    they are all compatible with the original 8051 as far as the instructions are concerned.

    2

  • 7/30/2019 Kam All Ll Lllll Lllll

    3/71

    The 8051 is the original member of the 8051 family. Intel refers to it as MCS-51. The

    Microcontroller AT89c51 is from Atmel Corporation. It has a wide collection of 8051 chips, as

    shown below. The AT89C51 is a popular and inexpensive chip used in many small projects. It

    has 4K bytes of flash ROM. Notice that AT89C51-12PC, where C before the 51 stands for

    CMOS, which has low power consumption, 12 indicates 12MHz, P is for plastic DIP

    package, and another C is for commercial.

    Part number Speed Pins Packaging Use

    AT89C51 -12PC 12MHz 40 DIP plastic Commercial

    AT89C51-16PC 16MHz 40 DIP plastic Commercial

    AT89C51-20PC 20MHz 40 DIP plastic Commercial

    Table 2.1 Various Speeds of 8051 from Atmel

    Part Number ROM RAM I/O pins Timer Interrupt Vcc Packaging

    AT89C51 4K 128 32 2 6 5V 40

    AT89LV51 4K 128 32 2 6 3V 40

    AT89C1051 1K 64 15 1 3 3V 20

    AT89C2051 2K 128 15 2 6 3V 20

    AT89C52 8K 128 32 3 8 5V 40

    AT89LV52 8K 128 32 3 8 3V 40

    Table 2.2 Versions of 8051 From Atmel (all ROM Flas

    2.3 AT89C51:

    3

  • 7/30/2019 Kam All Ll Lllll Lllll

    4/71

    The AT89C51 provides the following standard features: 4K bytes of Flash, 128

    bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level interrupt

    architecture, a full duplex serial port, on-chip oscillator and clock circuitry.

    In addition, the AT89C51 is designed with static logic for operation down to zero

    frequency and supports two software selectable power saving modes. The Idle Mode stops the

    CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue

    Functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling

    all other chip functions until the next hardware reset.

    2.3.1 Features of Microcontroller 89C51:

    1. 8-bit Microcontroller with 4K Bytes Flash

    2. Compatible with MCS-51 Products

    3. 4K Bytes of In-System Reprogrammable Flash Memory Endurance:

    4. Fully Static Operation: 0 Hz to 24 MHz

    5. Three-level Program Memory Lock

    6. 128 x 8-bit Internal RAM

    7. 32 Programmable I/O Lines

    8. Two 16-bit Timer/Counters

    9. Six Interrupt Sources

    10. Programmable Serial Channel

    11. Low-power Idle and Power-down Modes

    2.4 Block Diagram:

    4

  • 7/30/2019 Kam All Ll Lllll Lllll

    5/71

    Fig 2.1: Block Diagram Of 8051 Microcontroller

    2.5 Pin Diagram:

    5

  • 7/30/2019 Kam All Ll Lllll Lllll

    6/71

  • 7/30/2019 Kam All Ll Lllll Lllll

    7/71

    Vcc-supply voltage

    Gnd- ground

    Port 0:

    Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eightTTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs. Port

    0 may also be configured to be the multiplexed low order address/data bus during accesses to

    external program and data memory. In this mode P0 has internal pullups.Port 0 also receives the

    code bytes during Flash programming, and outputs the code bytes during program verification.

    External pull-ups are required during program verification.

    Port 1:

    Port 1 is an 8-bit bi-directional I/O port with internal pullups.The Port 1 output buffers can

    sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal

    pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will

    source current (IIL) because of the internal pullups.Port 1 also receives the low-order address bytes

    during Flash programming and verification.

    Port 2:

    Port 2 is an 8-bit bi-directional I/O port with internal pullups.The Port 2 output buffers can

    sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal

    pull-ups and can be used as inputs. As inputs,Port 2 pins that are externally being pulled low will

    source current (IIL) because of the internal pullups.Port 2 emits the high-order address byte during

    fetchesfrom external program memory and during accesses to external data memory that use 16-bit

    addresses (MOVX @DPTR). In this application, it uses strong internal pull-ups when emitting 1s.

    During accesses to external data memories that use 8-bit addresses (MOVX @ RI).

    PORT 3:

    Port 3 is an 8-bit bi-directional i/o port with internal pullups.the port 3 output buffers can

    sink/source four ttl inputs. When 1s are written to port 3 pins they are pulled high by the internal

    pullups and can be used as inputs. As inputs, port 3 pins that are externally being pulled low will

    source current (iil) because of the pullups. Port 3 also serves the functions of various special features

    of the at89c51 as listed below:

    7

  • 7/30/2019 Kam All Ll Lllll Lllll

    8/71

    Fig 2.1: Interrupt Function

    Port 3 also receives some control signals for Flash programming and verification.

    RST:

    Reset input. A high on this pin for two machine cycles while the oscillator is running resets the

    device.

    XTAL1:

    Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

    ALE/PROG:

    Address latch enable output pulse for latching the low byte of the address during accesses

    to external memory. This pin is also the program pulse input (prog) during flash programing.in

    normal operation ale is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for

    external timing or clocking purposes. Note, however, that one ale pulse is skipped during each

    access to external data memory. If desired, ale operation can be disabled by setting bit 0 of sfr

    location 8eh. With the bit set, ale is active only during a movx or movc instruction. Otherwise, the

    pin is weakly pulled high. Setting the ale-disable bit has no effect if the microcontroller is in external

    execution mode.

    PSEN:

    8

  • 7/30/2019 Kam All Ll Lllll Lllll

    9/71

    Program Store Enable is the read strobe to external program memory. When the AT89C51 is

    executing code from external program memory, PSEN is activated twice each machine cycle, except

    that two PSEN activations are skipped during each access to external data memory.

    EA/VPP:

    External Access Enable. EA must be strapped to GND in order to enable the device to fetch

    code from external program memory locations starting at 0000H up to FFFFH. Note, however, that

    if lock bit 1 is programmed, EA will be internally latched on reset. A should be strapped to VCC for

    internal program executions. This pin also receives the 12-volt programming enable voltage (VPP)

    during Flash programming, for parts that require 12-volt VPP.

    XTAL2:

    Output from the inverting oscillator amplifier.

    2.7 Oscillator Characteristics:

    XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which

    can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or

    ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should

    be left unconnected while XTAL1 is driven as shown in Figure 2.There are no requirements on the

    duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a

    divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must

    be observed.

    In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The

    mode is invoked by software. The content of the on-chip RAM and all the special functions registers

    remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by

    a hardware reset.

    It should be noted that when idle is terminated by a hard ware reset, the device normally

    resumes program execution, from where it left off, up to two machine cycles before the internal reset

    algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access

    to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin

    when Idle is terminated by reset, the instruction following the one that invokes Idle should not be

    one that writes to a port pin or to external memory.

    9

  • 7/30/2019 Kam All Ll Lllll Lllll

    10/71

    Fig 2.3: Oscillator Connection

    Note: C1, C2 = 30 pF 10 pF for Crystals = 40 pF 10 pF for Ceramic resonators

    Fig 2.2: status of external pin

    2.8 Memory Organization:

    10

  • 7/30/2019 Kam All Ll Lllll Lllll

    11/71

    Fig 2.4: memory architecture

    2.8.1 Program Memory:

    The TEMIC C51 Microcontroller Family has separate address spaces for program Memory and

    Data Memory. The program memory can be up to 64 K bytes long. The lower 4 K for the 80C51 (8

    K for the 80C52, 16 K for the 83 C154 and 32 K for the 83C154D) may reside on chip. Figure 1 to 4

    show a map of 80C51, 80C52, 83C154 and 83C154D program memory.

    Fig2.5. The 80C51 Program Memory. Figr2.6: 80c52programmemory

    11

  • 7/30/2019 Kam All Ll Lllll Lllll

    12/71

    Fig2.7:83C154 Program Memory

    Fig2.8: 83c154d Prigram Memory

    2.8.2 Data Memory:

    12

  • 7/30/2019 Kam All Ll Lllll Lllll

    13/71

    The C51 Microcontroller Family can address up to 64 K bytes of Data Memory to the

    chip. The MOVX instruction is used to access the external data memory (refer to the C51

    instruction set, in this chapter, for detailed description of instructions).

    The 80C51 has 128 bytes of on-chip-RAM (256 bytes in the 80C52, 83C154 and

    83C154D) plus a number of Special Function Registers (SFR). The lower 128 bytes of RAM can

    be accessed either by direct addressing (MOVdata addr). or by indirect addressing (MOV @Ri).

    Figure5 and 6 show the 80C51, 80C52, 83C154 and 83C154D Data Memory organization.

    Figure 2.9: The 80C51 Data Memory Organization.

    2.8.3 Indirect Address Area:

    13

  • 7/30/2019 Kam All Ll Lllll Lllll

    14/71

    Note that in Figure 6 - the SFRs and the indirect address RAM have the same addresses

    (80H-OFFH).Nevertheless, they are two separate areas and are accessed in two different ways.

    For example the instruction MOV 80H, #0AAH writes 0AAH to Port 0 which is one of the SFRs

    and the instruction

    MOV R0, # 80H

    MOV @ R0, # 0BBH

    writes 0BBH in location 80H of the data RAM. Thus,after execution of both o the

    above instructions Port 0 will contain 0AAH and location 80 of the RAM will contain 0BBH.Note

    that the stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM

    are available as stack space in those devices which implement 256 bytes of internal RAM.

    2.8.4 Direct and Indirect Address Area:

    The 128 bytes of RAM can be divided into 3segments as listed below and shown.

    1Register Banks 0.3:

    Locations 0 through 1FH (32bytes). ASM-51 and the device after reset default to register

    bank 0. To use the other register banks the user must select them in the software. Each register

    bank contains 8 one-byte registers, 0 through 7.Reset initializes the Stack Pointer to location 07H

    and it is incremented once to start from location 08H which is the first register (R0) of the second

    register bank. Thus, in order to use more than one register bank, the SP should be initialized to a

    different location of the RAM where it is not used for data storage (ie, higher part of the RAM).

    2. Bit Addressable Area:

    16 bytes have been assigned for this segment, 20H-2FH. Each one of the 128 bits of this

    segment can be directly addressed (0-7FH). The bits can be referred to in two ways both of

    which are acceptable by the ASM-51. One way is to refer to their addresses, i.e., 0 to 7FH. The

    other way is with reference to bytes 20H to 2FH. Thus, bits 0-7 can also be referred to as bits

    20.0-20.7 and bits 8-FH are the same as 21.0-21.7 and so on. Each of the 16 bytes in this

    segment can also be addresses as a byte.

    3. Scratch Pad Area:

    14

  • 7/30/2019 Kam All Ll Lllll Lllll

    15/71

    Bytes 30H through 7FH are available to user as data RAM. However, if the stack pointer

    has been initialized to this area, enough number of bytes should be left aside to prevent SP data

    destruction.

    Figure2.10: 128 Bytes of RAM Direct and Indirect Addressable.

    2.9 Serial communication:

    15

  • 7/30/2019 Kam All Ll Lllll Lllll

    16/71

    The serial port is full duplex, which means it can transmit and receive simultaneously. It is also

    receive-buffered, which means it can begin receiving a second byte before a previously received

    byte has been read from the receive register. (However, if the first byte still has not been read when

    reception of the second byte is complete, one of the bytes will be lost.) The serial port receive and

    transmit registers are both accessed at Special Function Register SBUF. Writing to SBUF loads the

    transmit register, and reading SBUF accesses a physically separate receive register.The serial port

    can operate in the following four modes.

    Mode 0:

    Serial data centers and exits through RXD. TXD outputs the shift clock. Eight data bits are

    transmitted/received, with the LSB first. The baud rate is fixed at 1/12 the oscillator frequency.

    Mode 1:

    10 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits

    (LSB first), and a stop bit (1). On receive; the stop bit goes into RB8 in Special Function Register

    SCON. The baud rate is variable.

    Mode 2:

    11 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits

    (LSB first), a programmable ninth data bit, and a stop bit (1). On transmit, the 9th data bit (TB8 in

    SCON) can be assigned the value of 0 or 1. Or, for example, the parity bit (P, in the PSW) can be

    moved into TB8. On receive; the 9th data bit goes into RB8 in Special Function Register SCON,

    while the stop bit is ignored. The baud rate is programmable to either 1/32 or 1/64 the oscillator

    frequency.

    Mode 3:

    11 bits are transmitted (through TXD) or received (through RXD): a start bit (0), 8 data bits

    (LSB first), a programmable ninth data bit, and a stop bit (1). In fact, Mode 3 is the same as Mode 2

    in all respects except the baud rate, which is variable in Mode 3. In all four modes, transmission is

    initiated by any instruction that uses SBUF as a destination register. Reception is initiated in Mode 0

    by the condition RI = 0 and REN = 1. Reception is initiated in the other modes by the incoming start

    bit if REN =1.

    16

  • 7/30/2019 Kam All Ll Lllll Lllll

    17/71

    KEIL SOFTWARE

    3.1 COMPILER:

    Click on the Keil Vision Icon on Desktop, The following figure will appear

    Click on the Project menu from the title bar, Then Click on New Project

    Save the Project by typing suitable project name with no extension in your own folder sited in

    either C:\ or D:\

    17

  • 7/30/2019 Kam All Ll Lllll Lllll

    18/71

    Then Click on Save button above.

    Select the component for u r project. i.e. AtmelClick On Symbol Beside Of Atmel

    Select AT89C51 as shown below

    18

  • 7/30/2019 Kam All Ll Lllll Lllll

    19/71

    Then Click on OK.

    The Following figure will appear

    Then Click either YES or NOmostly NO.

    Now your project is ready to USE.

    Now double click on the Target1, you would get another option Source group 1 as shown in

    next page.

    19

  • 7/30/2019 Kam All Ll Lllll Lllll

    20/71

    Click on the file option from menu bar and select new.

    The next screen will be as shown in next page, and just maximize it by double clicking on its

    blue boarder.

    20

  • 7/30/2019 Kam All Ll Lllll Lllll

    21/71

    Now start writing program in either in EMBEDDED C or ASM.

    For a program written in Assembly, then save it with extension . Asm and for EMBEDDED

    C based program save it with extension .C

    Now right click on Source group 1 and click on Add files to Group Source.

    Now you will get another window, on which by default EMBEDDED C files will appear.

    21

  • 7/30/2019 Kam All Ll Lllll Lllll

    22/71

    Now select as per your file extension given while saving the file Click only one time on optionADD.

    Now Press function key F7 to compile. Any error will appear if so happen.

    If the file contains no error, then press Control+F5 simultaneously.

    The new window is as follows

    22

  • 7/30/2019 Kam All Ll Lllll Lllll

    23/71

    Then Click OK.Now click on the Peripherals from menu bar, and check your required port as shown in fig

    below.

    Drag the port a side and click in the program file.

    23

  • 7/30/2019 Kam All Ll Lllll Lllll

    24/71

    Now keep Pressing function key F11 slowly and observe.

    You are running your program successfully.

    24

  • 7/30/2019 Kam All Ll Lllll Lllll

    25/71

    HARDWARE DESCRIPTION

    4.1. POWER SUPPLY:

    The basic function of power supply is to provide the required voltage levels for different

    modules of the control unit.

    The power supply to the unit is simple as it consists of only a single 5V DC. A step down

    transformer of 12V 1 amp is used which is then rectified to DC by a bridge. This is then

    decoupled by two capacitors. So that the output is free from noise and ripple. This raw DC is

    then fed to a fixed 5V regulator 7805 for a perfect +5V output.

    4.2 Power supply modules:

    . Step down transformer

    . Bridge rectifier with filter

    . Voltage regulators

    4.2.1STEP DOWN TRANSFORMER:

    A transformer is an electrical device that transfers energy from one circuit to another by

    magnetic coupling, without requiring relative motion between its parts. A transformer comprises

    two or more coupled windings and in most cases a magnetic core to concentrate Magnetic flux.

    A changing voltage applied to one winding creates a time-varying magnetic flux in the core,

    which induces a voltage in the other windings.

    Transformer come in a range of sizes from a thumbnail-sized coupling transformer

    hidden inside a stage microphone to huge giga watt units used to interconnect large portions of

    national power grids. All operate with the same basic principles and with many similarities in

    their paths.

    25

  • 7/30/2019 Kam All Ll Lllll Lllll

    26/71

    A. Coupling by mutual induction:

    The principles of the transformers are illustrated by consideration of a hypothetical ideal

    transformer. In this case, the core requires negligible magneto motive force to sustain flux, and

    all flux linking the primary winding also links the secondary windings. The hypothetical ideal

    transformer has no resistance in its coils. A simple transformer consists of two electrical

    conductors called the primary winding and the secondary windings. Energy is coupled

    between the windings by the time variant magnetic flux that posses through (links) both primary

    and secondary windings. Whenever, the amount of current in a coil changes, a voltage is induced

    in the neighboring coil. The effect, called mutual inductance, is an example of electromagnetic

    induction.

    fig4.1: An ideal step-down transformer showing flux in the core

    If a time varying voltage is applied to the primary winding of Np turns, a current will

    flow in it producing a magneto motive force (MMF). Just as an electro motive force (EMF)

    drives current around an electric circuit, so MMF tries to drive magnetic flux through a magnetic

    circuit. The primary MMF produces a varying magnetic flux p in the core, with an open circuit

    secondary winding, induces a back electro motive force (EMF) in opposition to . In

    26

  • 7/30/2019 Kam All Ll Lllll Lllll

    27/71

    accordance with a faradays law of induction, the voltage induced across the primary winding is

    proportional to the rate change of flux:

    And

    Where

    . and are the voltages across the primary winding and secondary winding

    . Np and Ns are the number of turns in the primary winding and secondary

    Windings

    . And are the derivatives of the flux with respective to time of the

    primary and secondary windings.

    In the hypothetical ideal transformer, the primary and secondary windings are perfectly

    coupled, or equivalently, p= . Substituting and solving for the voltages shows that:

    =

    Where

    . And are voltages across primary and secondary

    . Np and Ns are the numbers of turns in the primary and secondary, respectively.

    Hence in an ideal transformer, the ratio of the primary and secondary voltages is equal to

    the ratio of the number of turns in their windings, or alternatively, the voltage per turn is the

    same for both windings. The ratio of the currents in the primary and secondary circuits is

    inversely proportional to the ratio.

    The EMF in the secondary winding will cause current to flow in a secondary circuit. The

    MMF produced by current in the secondary winding opposes the MMF of the primary winding

    and so tends to cancel the flux in the core. Since reduced flux reduces the emf induced in the

    primary winding increased current flows in the primary circuit. The resulting increase in MMF

    due to the primary current offsets the effect the opposing secondary MMF. In this way, the

    27

  • 7/30/2019 Kam All Ll Lllll Lllll

    28/71

    electrical energy fed into the primary winding is delivered to the secondary winding. In addition

    the flux density will always stay the same as long as the primary voltage is steady.

    B. Step-down:

    The secondary has fewer turns than the primary i.e. it converts higher voltage at the input

    side to a lower voltage at the output

    4.2.2 BRIDGE RECTIFIER:

    A diode bridge or bridge rectifier is an arrangement of four diodes connected in a bridge

    circuit as shown in below, that provides the same polarity of output voltage for any polarity of

    the input voltage. When used in its most common application, at conversion of alternating

    current (AC) input into direct current (DC) output, it is known as a bridge rectifier. The bridge

    rectifier provides full wave rectification from a two wire AC input (saving the cost of center

    tapped transformer) but has two diode drops rather than one reducing efficiency over a center tap

    based design for the same output voltage.

    4.2. Schematic of a diode bridge

    The essential feature of this arrangement is that for both polarities of the voltage at the

    bridge input, the polarity of the output is constant.

    A. Basic operation:

    28

  • 7/30/2019 Kam All Ll Lllll Lllll

    29/71

    When the input connected at the left corner of the diamond is positive with respect to the

    one connected at the right hand corner, current flows to the right along the upper colored path to

    the output, and returns to the input supply via the lower one.

    When the right hand corner is positive relative to the left hand corner, current flows along

    the upper colored path and returns to the supply via the lower colored path.

    FIG 4.3 AC, half-wave and full wave rectified signals

    29

  • 7/30/2019 Kam All Ll Lllll Lllll

    30/71

    In each case, the upper right output remains positive with respect to the lower right one.

    Since this is true weather the input is AC or DC, this circuit is not only produces DC power when

    supplied with AC power: it also can provide what is sometimes called reverse polarity

    protection. That is, it permits normal functioning when batteries are installed backwards or DC

    input-power supply wiring has its wires crossed (and protects the circuitry it powers against

    damage that might occur without this circuit in place.

    4.2.3 OUTPUT SMOOTHING:

    For many applications, especially with single phase AC where the full wave

    bridge serves to convert an AC input into a DC output, the addition of capacitors may be

    important because the bridge alone supplies an output voltage of fixed polarity but pulsating

    magnitude.

    Figure 4.4 Bridge Rectifier

    The function of this capacitor, known as a smoothing capacitor is to lessen the

    variation in (or smooth) the raw output voltage waveform from the bridge. One explanation of

    smoothing is that the capacitors provides a low impedance path to the AC component of the

    output, reducing the AC voltage across, and AC current through the resistive load. In less

    technical terms, any drop in the output voltage and current of the bridge tends to the cancelled by

    loss of charge in the capacitor. The charge flows out as additional current through the load. Thus

    the change of load current and voltage is reduced relative to what would occur without the

    capacitor. Increases of voltage correspondingly store excess charge in the capacitor, thus

    moderating the change in the output voltage/current.

    30

    http://en.wikipedia.org/wiki/Image:Diodebridge4.png
  • 7/30/2019 Kam All Ll Lllll Lllll

    31/71

    The capacitor and the load resistance have a typical time constant where

    C and R are the capacitance and load resistance respectively. As long as the load resistor is large

    enough so that this time constant is much longer than the time of one ripple cycle, the above

    configuration will produce a well smoothed DC voltage across the load resistance. In somedesigns, a series resistor at the load side of the capacitor is added. The smoothing can then be

    improved by adding additional stages of capacitors-resistor pairs, often done only for sub-

    supplies to critical high-gain circuits that tend to be sensitive to supply voltage noise

    4.2.4. CHARACTERISTICS OF BRIDGE RECTIFIEREFFICIENCY:

    It is defined as the ratio of output DC power to input AC power.

    Its efficiency is 81.2%, which is same as that of a full wave rectifier.

    4.2.5 RIPPLE FACTOR:

    It is defined as the ratio of RMS voltage of the AC component to the DC component.

    For bridge rectifier it is 0.48, which is same as full wave rectifier.

    In bridge rectifier the bulky center tapped transformer is not used which is a great

    advantage.

    The peak inverse voltage (PIV) of the diodes is half that of the PIV of the diodes in a full

    wave rectifier.

    The transformer utilization factor (T.U.F) is high i.e. 0.812, as the current flowing in the

    transformer secondary is fully utilized.

    31

  • 7/30/2019 Kam All Ll Lllll Lllll

    32/71

    4.3 VOLTAGE REGULATORS:

    figure 4.5 ic-7805 voltage regulator

    Voltage regulators produce fixed DC output voltage from variable DC (a small amount of

    AC on it). Normally we get fixed output by connecting the voltage regulator at the output of the

    filtered DC (see in above diagram). It can also used in circuits to get a low DC voltage from a

    high DC voltage (for example we use 7805 to get 5V from 12V). There are two types of voltage

    regulators 1. Fixed voltage regulators (78xx, 79xx) 2. Variable voltage regulators (LM317)

    In fixed voltage regulators there is another classification

    1. +ve voltage regulators2. -ve voltage regulators.

    4.3.1 POSITIVE VOLTAGE REGULATORS:

    This includes 78xx voltage regulators. The most commonly used ones are 7805 and 7812. 7805

    gives fixed 5V DC voltage if input voltage is in (7.5V, 20V). You may sometimes have

    32

  • 7/30/2019 Kam All Ll Lllll Lllll

    33/71

    questions like, what happens if input voltage is

  • 7/30/2019 Kam All Ll Lllll Lllll

    34/71

    normal case (I never used these capacitors). But if you are using 7805 in analog circuit you

    should use capacitor, otherwise the noise in the output voltage will be high.

    4.4 ADC:

    Fig 4.7:pin diagram

    As shown in the typical circuit, ADC0804 can be interfaced with any microcontroller. You

    need a minimum of 11 pins to interface ADC0804, eight for data pins and 3 for control pins. As

    shown in the typical circuit the chip select pin can be made low if you are not using the

    microcontroller port for any other peripheral (multiplexing).

    There is a universal rule to find out how to use an IC. All you need is the datasheet of the IC

    you are working with and take a look at the timing diagram of the IC which shows how to send

    the data, which signal to assert and at what time the signal should be made high or low etc.

    34

  • 7/30/2019 Kam All Ll Lllll Lllll

    35/71

    Figure 4.8: Start Conversion

    Figure 4.9: Output Enable Intr

    The above timing diagrams are from ADC 804 datasheet. The first diagram (FIGURE 10A)

    shows how to start a conversion. Also you can see which signals are to be asserted and at what

    time to start a conversion. So looking into the timing diagram FIGURE 10A. We note down the

    steps or say the order in which signals are to be asserted to start a conversion of. As we have

    decided to make Chip select pin as low so we need not to bother about the CS signal in the

    timing diagram. Below steps are for starting an ADC conversion. I am also including CS signal

    to give you a clear picture. While programming we will not use this signal.

    35

  • 7/30/2019 Kam All Ll Lllll Lllll

    36/71

    1. Make chip select (CS) signal low.

    2. Make write (WR) signal low.

    3. Make chip select (CS) high.

    4. Wait for INTR pin to go low (means conversion ends).

    4.4.1 INTERFACING WITH MICROCONTROLLER:

    36

  • 7/30/2019 Kam All Ll Lllll Lllll

    37/71

    Figure 4.10: Interfacing 8051 Microcontroller And Adc

    As the peripheral signals usually are substantially different from the ones that micro-

    controller can understand (zero and one), they have to be converted into a pattern which can be

    37

  • 7/30/2019 Kam All Ll Lllll Lllll

    38/71

    comprehended by a micro-controller. This task is performed by a block for analog to digital

    conversion or by an ADC. This block is responsible for converting an information about some

    analog value to a binary number and for follow it through to a CPU block so that CPU block can

    further process it.

    FIGURE 4.11 ANALOG TO DIGITAL FORM

    This analog to digital converter (ADC) converts a continuous analog input signal, into

    an n-bit binary number, which is easily acceptable to a computer.

    As the input increases from zero to full scale, the output code stair steps. The width of

    an ideal step represents the size of the least significant Bit (LSB) of the converter and

    corresponds to an input voltage of VES/2n for an n-bit converter. Obviously for an input voltage

    range of one LSB, the output code is constant. For a given output code, the input voltage can be

    anywhere within a one LSB quantization interval.

    An actual converter has integral linearity and differential linearity errors. Differential

    linearity error is the difference between the actual code-step width and one LSB. Integral

    linearity error is a measure of the deviation of the code transition points from the fitted line.

    The errors of the converter are determined by the fitting of a line through the code

    transition points, using least square fit, the terminal point method, or the zero base technique to

    provide the reference line

    38

  • 7/30/2019 Kam All Ll Lllll Lllll

    39/71

    4.5 LCD

    4.5.1 LCD INTERFACING:

    Fig 4.12: connecting to microcontroller

    Most alphanumeric LCD displays have HD44780 compatible driver chipsets that follow

    the original Hitachi commands to control the LCD.

    The most common connectors for alphanumeric LCDs are either 14-pin single row or

    2X7 pins dual row connectors.

    A typical LCD write operation takes place as shown in the following timing waveform:

    Fig4.12: LCD data write waveforms

    4.5.2PIN DESCRIPTION:

    39

  • 7/30/2019 Kam All Ll Lllll Lllll

    40/71

    1. GND (Ground)

    2. Vcc (Supply Voltage)

    3. Vee (Contrast Voltage)

    4. R/S (Instruction/Register Select)

    5. R/W (Read/Write)

    6. E (Clock)

    7. D0 (Data0)

    8. D1 (Data1)

    9. D2 (Data2)

    10. D3 (Data3)

    11. D4 (Data4)

    12. D5 (Data5)

    13. D6 (Data6)

    14. D7 (Data7)

    The interface is either a 4-bit or 8-bit parallel bus that allows fast reading/writing of data

    to and from the LCD. This waveform will write an ASCII Byte out to the LCD's screen. The

    ASCII code to be displayed is eight bits long and is sent to the LCD either four or eight bits at a

    time. If 4-bit mode is used, two nibbles of data (First high four bits and then low four bits with

    an E Clock pulse with each nibble) are sent to complete a full eight-bit transfer. The E Clock is

    used to initiate the data transfer within the LCD.

    8-bit mode is best used when speed is required in an application and at least ten I/O pins

    are available. 4-bit mode requires a minimum of six bits. In 4-bit mode, only the top 4 data bits

    (DB4-7) are used. The R/S pin is used to select whether data or an instruction is being transferred

    between the microcontroller and the LCD. If the pin is high, then the byte at the current LCD

    Cursor Position can be read or written. If the pin is low, either an instruction is being sent to the

    LCD or the execution status of the last instruction is read back (whether or not it has completed).

    Reading Data back is best used in applications which required data to be moved back and

    forth on the LCD (such as in applications which scroll data between lines).

    The "Busy Flag" can be polled to determine when the last instruction that has been sent

    has completed processing.

    40

  • 7/30/2019 Kam All Ll Lllll Lllll

    41/71

    For most applications, there really is no reason to read from the LCD. The application

    can write to the LCD and wait the maximum amount of time for each instruction (4.1

    milliseconds for clearing the display or moving the cursor/display to the "home position", 160

    microseconds for all other commands). Different LCDs execute instructions at different

    rates and to avoid problems later on (such as if the LCD is changed to a slower unit), the

    recommended maximum delays can be used.

    Before you can send commands or data to the LCD, the LCD must be initialized.

    For 8-bit mode, this is done as follows:

    1. Wait more than 15 msecs after power is applied.

    2. Write 0x030 to LCD and wait 5 msecs for the instruction to complete

    3. Write 0x030 to LCD and wait 160 usecs for instruction to complete

    4. Write 0x030 AGAIN to LCD and wait 160 usecs or Poll the Busy Flag

    5. Set the Operating Characteristics of the LCD

    6. Write "Set Interface Length"

    7. Write 0x010 to turn off the Display

    8. Write 0x001 to Clear the Display

    9. Write "Set Cursor Move Direction" Setting Cursor Behavior Bits

    10. Write "Enable Display/Cursor" & enable Display and Optional Cursor

    4.6 RS 232 AND MAX 232:

    41

  • 7/30/2019 Kam All Ll Lllll Lllll

    42/71

    4.6.1 INTRODUCTION OF RS232:

    The most popular serial communication standard for asynchronous communications is RS-

    232 (Recommended Standard 232. This specifies the rule of how different connected devices

    communicate. The connected devices can either be terminals or communication equipments

    commonly referred as DTE & DCE.

    According to RS232 interface, it requires only 3 lines i.e. Rx, Tx & Ground when

    compared to the bunch of connectors required for parallel communication. Even though parallel

    communication is easier to establish, serial communication is preferred based on the costs for the

    communication lines.

    The EIA (Electronics Industry Association) RS232C Standard specifies & suggests a

    maximum baud rate of 20,000bps, and RS232D is an advanced version of the same, which

    allows 1.5 Mbps. The connectors specified are D-TYPE 25 pin connector and

    D-TYPE 9 pin connector.

    FIGURE 4.13: DB-9 PIN CONNECTOR

    According to RS232 specifications, the logic 1 and logic 0 are called as mark &

    space. The signal voltage levels are specified as mark should be in the range of -3 to -15 volts

    and space should be in the range of 3 to 15 volts. The modern low power consuming CMOS

    devices use different logic levels than the RS232 line specification. The logic levels of CMOS

    devices are in the range of 3.3v-5.5v for 1 and -0.3v to 0.8v for 0. Therefore when

    communicating with such CMOS/TTL devices, the logic levels need to be converted

    42

  • 7/30/2019 Kam All Ll Lllll Lllll

    43/71

    J 2

    1

    2

    3

    4

    5

    6

    7

    8

    9

    P 3 . 0

    5 V

    C 4

    0 . 1 u f

    C 7

    0 . 1 u f

    T X D

    C 6

    0 . 1 u f

    P 3 . 1

    T 1 O U T

    C 1

    1 u f

    T 1 O U T

    U 3

    M A X 3 2 3 2 15

    1

    6

    1 3

    8

    1 0

    1 1

    1

    3

    4

    5

    2

    6

    1 2

    9

    1 4

    7

    G

    N

    D

    V

    C

    C

    R 1 I N

    R 2 I N

    T 2 I N

    T 1 I N

    C 1 +

    C 1 -

    C 2 +

    C 2 -

    V +

    V -

    R 1 O U T

    R 2 O U T

    T 1 O U T

    T 2 O U T

    C 5

    0 . 1 u f

    R X D

    FIGURE 4.15: RS232 INTERFACED TO MAX232

    RS232 is 9 pin db connector, only three pins of this are used ie 2, 3, 5 the transmit pin of RS232

    is connected to rx pin of microcontroller

    Electronic data communications between elements will generally fall into two broad

    categories: single-ended and differential. RS232 (single-ended) was introduced in 1962, and

    despite rumors for its early demise, has remained widely used through the industry.

    RS232 data is bi-polar.... +3 TO +12 volts indicates an "ON or 0-state (SPACE)

    condition" while A -3 to -12 volts indicates an "OFF" 1-state (MARK) condition.... Modern

    computer equipment ignores the negative level and accepts a zero voltage level as the "OFF"

    state. In fact, the "ON" state may be achieved with lesser positive potential. This means circuits

    powered by 5 VDC are capable of driving RS232 circuits directly, however, the overall range

    that the RS232 signal may be transmitted/received may be dramatically reduced.

    The output signal level usually swings between +12V and -12V. The "dead area" between

    +3v and -3v is designed to absorb line noise. In the various RS-232-like definitions this dead

    area may vary. For instance, the definition for V.10 has a dead area from +0.3v to -0.3v. Many

    receivers designed for RS-232 are sensitive to differentials of 1v or less.

    This can cause problems when using pin powered widgets - line drivers, converters,

    modems etc. These types of units need enough voltage & current to power them self's up. TypicalURART (the RS-232 I/O chip) allows up to 50ma per output pin - so if the device needs 70ma to

    run we would need to use at least 2 pins for power.

    In most Asynchronous situations, RTS and CTS are constantly on throughout the

    communication session. However where the DTE is connected to a multipoint line, RTS is used

    to turn carrier on the modem on and off. On a multipoint line, it's imperative that only one station

    43

  • 7/30/2019 Kam All Ll Lllll Lllll

    44/71

    is transmitting at a time (because they share the return phone pair). When a station wants to

    transmit, it raises RTS. The modem turns on carrier, typically waits a few milliseconds for carrier

    to stabilize, and then raises CTS. The DTE transmits when it sees CTS up. When the station has

    finished its transmission, it drops RTS and the modem drops CTS and carrier together. Clock

    signals (pins 15, 17, & 24) are only used for synchronous communications. The modem or DSU

    extracts the clock from the data stream and provides a steady clock signal to the DTE. Note that

    the transmit and receive clock signals do not have to be the same, or even at the same baud rate.

    Note: Transmit and receive leads (2 or 3) can be reversed depending on the use of the equipment

    - DCE Data Communications Equipment or a DTE Data Terminal Equipment.

    Sub-D15 Male Sub-D15 Female

    This is a standard 9 to 25 pin cable layout for async data on a PC AT serial cable

    Figure 4.16: Physical Diagram

    44

  • 7/30/2019 Kam All Ll Lllll Lllll

    45/71

    Description Signal9-pin DTE

    25-pin

    DCESource DTE or DCE

    Carrier Detect CD 1 8 from Modem

    Receive Data RD 2 3 from Modem

    Transmit DataTD 3 2 from

    Terminal/Computer

    Data Terminal

    Ready

    DTR 4 20 from

    Terminal/Computer

    Signal Ground SG 5 7 from Modem

    Data Set Ready DSR 6 6 from Modem

    Request to SendRTS 7 4 from

    Terminal/Computer

    Clear to Send CTS 8 5 from Modem

    Ring Indicator RI 9 22 from Modem

    Table4.1: Standard 9 to25 Pin Cable Layout

    4.6.2 pin description:

    45

  • 7/30/2019 Kam All Ll Lllll Lllll

    46/71

    Figure 4.14: Pin Diagram Of Max 232

    4.6.3 STUCTURE OF MAX 232:

    46

  • 7/30/2019 Kam All Ll Lllll Lllll

    47/71

    Figure 4.15 Structure Of Max 232

    4.6.4 DESCRIPTION:

    The MAX232 device is a dual driver/receiver that includes a capacitive voltage generator

    to supply EIA-232 voltage levels from a single 5-V supply.

    Each receiver converts EIA-232 inputs to 5-V TTL/CMOS levels. These receivers have a

    typical threshold of 1.3 V and a typical hysteresis of 0.5 Viand can accept 30-V inputs. Each

    driver converts TTL/CMOS input levels into EIA-232 levels. The driver, receiver, and voltage-

    generator functions are available as cells in the Texas Instruments Lin ASIC library. The

    MAX232 is characterized for operation from 0C to 70C.The MAX232I is characterized for

    operation from 40C to 85C.

    .

    47

  • 7/30/2019 Kam All Ll Lllll Lllll

    48/71

    FIGURE 4.16: MAX232 INTERFACED TO MICROCONTROLLER

    MAX232 is connected to the microcontroller as shown in the figure above 17, 18 pins are

    connected to the TX and RX pin i.e. transmit and receive pin of microcontroller

    4.6.5 FEATURES:

    Operates With Single 5-V Power Supply

    LinBiCMOS Process Technology

    Two Drivers and Two Receivers

    30-V Input Levels

    Low Supply Current . . . 8 mA Typical

    Meets or Exceeds TIA/EIA-232-F and ITU

    Recommendation V.28

    Designed to be Interchangeable With

    48

  • 7/30/2019 Kam All Ll Lllll Lllll

    49/71

  • 7/30/2019 Kam All Ll Lllll Lllll

    50/71

    4.7 RELAY

    A relay is an electrically operated switch. Current flowing through the coil of the relaycreates 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. 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.

    Circuit symbol for a relay:

    Fig 4.19: Circuit Symbol

    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. For further information

    about switch contacts and the terms used to describe them please see the page on switches.

    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.

    50

  • 7/30/2019 Kam All Ll Lllll Lllll

    51/71

    Fig4.20: Relay

    This relay is electrically operated switch. It has five pins namely common, input, and

    supply, normally connected switch and normally open switch.

    Input:

    This input pin is connected to driver. This driver gives signal whenever fault occur in phase

    which is related to that particular relay which is connected. This is the main key to operate the

    relay.

    Supply: The supply pin is connected to the vcc of the driver. 5volts dc supply is connected to

    driver vcc pin. The supply pin of the relay is always reads same voltage neither in normal

    condition nor in fault operating condition i.e. it is the operating voltage of relay.

    Common:

    The common pin of relay is connected to neutral of load and in contact with normally

    connected pin. This pin is connected to normally open switch whenever fault occurs in the

    system. Common pin is acts as phase in faulted system in order to give backup to load.

    NC:

    51

  • 7/30/2019 Kam All Ll Lllll Lllll

    52/71

    The normally connected switch is connected to common pin. It is open circuit with common

    pin whenever fault occurs in phase which is related to this relay and again in contact with the

    common automatically after cleared that fault

    No:

    Normally open switch is in open circuit with the common pin in normal condition. It is

    connected to common pin till the presence of fault in system.

    4.7.1. 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.

    4.7.2. Disadvantages of relays:

    Relays are bulkier than transistors for switching small currents.

    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.

    52

  • 7/30/2019 Kam All Ll Lllll Lllll

    53/71

    POWER SUPPLY UNIT

    5.1BLOCKS OF WER SUPPLY UNIT:

    Power supply block consists of following units:

    Step-down transformer

    Adopter

    Full wave rectifier circuit

    Input filter

    Voltage regulator

    Output filter

    5.1.1 Adaptor:

    The microcontroller and other devices get power supply from AC to Dc adapter through 7805, 5

    volts regulator. The adapter output voltage will be 12V DC non-regulated. The 7805 voltage regulator is

    used to convert 12 V to 5V DC.

    5.1.2 Rectifier unit:

    The rectifier circuit is used to convert the ac voltage into its corresponding dc voltage. The most

    important and simple device used is bridge rectifier circuit. This rectifier is full wave rectifier circuit

    53

  • 7/30/2019 Kam All Ll Lllll Lllll

    54/71

    which produces dc voltage with ripples. The ripples from the obtained dc voltage are removed using

    filter circuit.

    5.1.3 Input filter:

    Capacitor is used as filter. The ripples from the dc voltages are removed and pure dc voltage is

    obtained. The primary action performed by capacitor is charging and discharging. It charges in positive

    half cycle of the ac voltage and it will discharge in negative half cycle. So it allows only ac voltage and

    does not allow the dc voltage. This filter is fixed before the regulator. Capacitor used here is 470uF

    Fig5.1: 470 micro fared capacitor

    5.1.4 Regulator unit:

    Regulator regulates the output voltage to a specific value. The output voltage is

    maintained irrespective of the fluctuations in the input dc voltage. Whenever there are any ac

    voltage fluctuations, the dc voltage also changes, and to avoid this regulators are used.

    54

  • 7/30/2019 Kam All Ll Lllll Lllll

    55/71

    Fig5.2: Regulator Unit

    Regulators can be classified as:

    i) Positive regulator, which regulates the positive voltage (7805)

    1---> input pin

    2---> ground pin

    3--->output pin

    ii) Negative regulator, which regulates the negative voltage

    1--->ground pin

    2--->input pin

    3--->output pin

    Regulator used in this application is 7805 which provides 5V dc

    5.1.5Output filter:

    This filter is fixed after the Regulator circuit to filter any of the possibly found ripples in the

    output received finally. Capacitor used here are of value 0.1uF

    55

  • 7/30/2019 Kam All Ll Lllll Lllll

    56/71

  • 7/30/2019 Kam All Ll Lllll Lllll

    57/71

    Fig5.4: power circuit diagram

    From above diagram it is clear that the unit consisting of rectifier unit, filter, and

    regulator. The regulator unit is arranged with four diodes, which are arranged in the manner of

    Full wave rectifier circuit. The nodes 1&2 are connected to power supply.

    Here power supply is taken from step-down transformer ( 230v A.C to 12-0-12v A.C).

    3 and 4 nods are connected to capacitor and regulator. This bridge gives 12v D.C as out put and

    it is connected to capacitor as shown in the figure.

    5.3 Block Diagram:

    57

  • 7/30/2019 Kam All Ll Lllll Lllll

    58/71

    A.C power supply 230 volts

    To Microcontroller

    Fig5.5: Power Supply Circuit Block Diagram

    The above block diagram shows the step by step process. Here 230v a.c is connected to a

    step-down transformer, its converts 230v a.c to 12v a.c. this 12v output of transformer is

    connected to a rectifier which is arranged with diodes as full wave bridge.

    58

    Step Down Transformer

    Rectifier

    Filter

    Regulator

  • 7/30/2019 Kam All Ll Lllll Lllll

    59/71

    This bridge converts 12volts A.C into 12volts D.C. but this D.C is not pure DC power, it

    consists disturbances called as pulsating DC. But it is not sufficient to apply to the DC

    consumption equipments like microcontroller. In order to produce pure DC from pulsating dc we

    require filters, here 470 micro F capacitor is used as filter. Rectifier output is given to capacitor.

    This capacitor produces pure 12volts dc as output.

    This output is connected to regulator. This regulator produces 5volts dc output. Here we

    are using 3 pin regulator as input, ground and grounds respectively. Input pin is connected to the

    output of regulator and output pin is connected to micro controller.

    AUTO PHASE CHANGER

    6.1 INTRODUCTION:

    59

  • 7/30/2019 Kam All Ll Lllll Lllll

    60/71

    In three-phase applications, if low voltage is available in any one or two phases, and

    you want your equipment to work on normal voltage, this circuit will solve your problem.

    However, a proper-rating fuse needs to be used in the input lines (R, Y and B) of each phase. The

    circuit provides correct voltage in the same power supply lines through relays from the other

    phase where correct voltage is available. Using it you can operate all your equipment even when

    correct voltage is available on a single phase in the building.

    The circuit is built around a transformer, comparator, transistor and relay. Three

    identical sets of this circuit, one each for three phases, are used. Let us now consider the working

    of the circuit connecting red cable (call it R phase).

    The mains power supply phase R is stepped down by transformer X1 to deliver 12V, 300

    mA, which is rectified by full wave bridge and filtered by capacitor to produce the operating

    voltage for the microcontroller pin. The voltage controlee pin of microcontroller is taken from

    the regulator out-put driver pin is used to set the reference voltage according to the requirement.

    The reference voltage at driver pin is fixed to 5V through circuit.

    6.2 Block diagram:

    60

  • 7/30/2019 Kam All Ll Lllll Lllll

    61/71

    Fig 6.1: auto power changer block diagram

    61

  • 7/30/2019 Kam All Ll Lllll Lllll

    62/71

    Above black diagram shows the clear pattern of phase changer circuit. Each phase consisting

    of its own power circuit as shown above. Each phase have step-down transformer, rectifier, filter,

    voltage regulator. All these arrangement is connected to microcontroller. Microcontroller

    detective the fault and produce the output. This output is fed to the driver and driver operates the

    relays depending upon the signal which is fed from the controller. Relay takes action as the

    signal of driver.

    It is clear that each phase have its own power circuit in order to detect the fault. In normal

    operating condition the voltage regulator produce 5volts output to the microcontroller pin which

    is connected to related regulator. The other side, the pin which is connected to driver and driver

    pin reads zero volts. This is the signal that the phase is in normal condition.

    The regulator voltage becomes zero when fault occur in related phase. Not only the

    regulator voltage, bridge input also become zero because of the input of the step-down

    transformer is connected to the related phase. Then the microcontroller pin which is connected

    from regulator reads zero voltage and the driver reads 5volts because the pin is activated when

    controller receives zero output from regulator. This signal is send to the relay and relay gets trip

    and the load gets backup from the live phase.

    6.3 CIRUIT DIAGRAM:

    62

  • 7/30/2019 Kam All Ll Lllll Lllll

    63/71

    Fig6.2: Auto Phase Changer Circuit Diagram

    6.4 CIRCUIT DESCRIPTION:

    63

  • 7/30/2019 Kam All Ll Lllll Lllll

    64/71

    Auto phase changer circuit contains step-down transformer, rectifier, filter, regulator. Each

    phase i.e. r-phase, b-phase, y-phase, all are have its own arrangement in order to know that the

    phase are in healthy condition or not i.e. the voltage is present in the phase or not.

    6.4.1 Normal condition:

    The current is present in the phase the operation of the power circuit operation is as

    follows:

    The step-down transformer have the available input is 230 volts because of the input

    terminal is connected to that related phase. And it produce the output of 12volts dc.(230V

    To 12v-0-12v, step-down transformer).

    The output of the transformer is fed to the full wave rectifier bridge. It converts the

    12volts A.C into 12v D.C. this is not pure D.C, it is pulsating D.C power.

    This pulsating D.C is fed to the capacitor to produce the pure D.C power. Here capacitor

    acts as filter.

    This pure D.C is connected to regulator. It converts the 12v D.C to 5v D.C because the

    microcontroller requires 5v D.C only.

    The output of regulator i.e. 5v is connected to microcontroller. So the driver pin receives

    Zero volts from microcontroller andThe above action is repeats for all three power circuits and three regulator outputs are

    connected to the microcontroller pin. The driver pin gives 5v to the relays input pin. This means

    the phase is a live and relay is in normal condition i.e. the relay common pin is connected to

    normally connected pin.

    6.4.2 Operation in fault condition:

    The entire operation will be changes for the faulted condition. The transformer reads zero

    input. Then the transformer output, rectifier and regulator outputs are also read zero volts. So the

    microcontroller pin gets zero output and activates the controller pin which is connected to driver.

    Then the driver reads 5v from the controller pin, then the driver pin which is connected to the

    input pin of relay reads zero volts and relay get the signal to activate. Then the relay common pin

    is disconnected from normally connected pin and connected to the normally open pin. This

    64

  • 7/30/2019 Kam All Ll Lllll Lllll

    65/71

    normally connected is connected to another phases relay common terminal, so the load of the

    faulted phase is gets voltage from the other phase.

    OPERATION IF FAULT IN R-PHASE:

    Consider the R-phase from fig. the regulator gives 5volts output to the microcontroller

    PP2.0 pin and controller P0.0 pin gives zero volts to the driver pin. The driver pin which is

    connected to the input pin of the relay read 5volts. That means the relay consider that the phase

    is a live and relay common pin is connected to normally connected pin until the relay input pin

    reads zero volts from the driver. Throughout this operation the relays normally connected pin is

    acts as phase and common pin acts as neutral.

    Let us consider the fault occur in R-phase. The transformer read zero volts input

    from the phase and the regulator output also zero. Then the microcontroller P2.0 pin read zero

    volts from the regulator output. According to our microcontroller programming the controller

    P0.0 pin is activated. Then the driver pin reads 5volts from the microcontroller and driver pin

    which is connected to the relay become zero volts i.e. here existing fault and it is recognized by

    the relay and it will trips. At this instant the relay common pin is connected to the normally open

    pin until the relay reads the relay input pin reads 5 volts. This normally open pin is gets backup

    from the common pin of the relay of Y-phase. Throughout this operation the common pin is acts

    as phase and normally open pin as ground.

    OPERATION IF FAULT IN Y-PHASE:

    Consider the Y-phase from fig. the regulator gives 5volts output to the microcontroller

    P2.1 pin and controller P0.1 pin gives zero volts to the driver pin. The driver pin which is

    connected to the input pin of the relay read 5volts. That means the relay consider that the phase

    is a live and relay common pin is connected to normally connected pin until the relay input pin

    reads zero volts from the driver. Throughout this operation the relays normally connected pin is

    acts as phase and common pin acts as neutral.

    Let us consider the fault occur in Y-phase. The transformer read zero volts input

    from the phase and the regulator output also zero. Then the microcontroller P2.1 pin read zero

    volts from the regulator output. According to our microcontroller programming the controller

    P0.1 pin is activated. Then the driver pin reads 5volts from the microcontroller and driver pin

    65

  • 7/30/2019 Kam All Ll Lllll Lllll

    66/71

    which is connected to the relay become zero volts i.e. here existing fault and it is recognized by

    the relay and it will trips. At this instant the relay common pin is connected to the normally open

    pin until the relay reads the relay input pin reads 5 volts. This normally open pin is gets backup

    from the common pin of the relay of B-phase. Throughout this operation the common pin is acts

    as phase and normally open pin as ground.

    OPERATION IF FAULT IN B-PHASE:

    Consider the B-phase from fig. the regulator gives 5volts output to the microcontroller

    P2.2 pin and controller P0.2 pin gives zero volts to the driver pin. The driver pin which is

    connected to the input pin of the relay read 5volts. That means the relay consider that the phase

    is a live and relay common pin is connected to normally connected pin until the relay input pin

    reads zero volts from the driver. Throughout this operation the relays normally connected pin is

    acts as phase and common pin acts as neutral.

    Let us consider the fault occur in B-phase. The transformer read zero volts input from

    the phase and the regulator output also zero. Then the microcontroller P2.2 pin read zero volts

    from the regulator output. According to our microcontroller programming the controller P0.2 pin

    is activated. Then the driver pin reads 5volts from the microcontroller and driver pin which is

    connected to the relay become zero volts i.e. here existing fault and it is recognized by the relay

    and it will trips. At this instant the relay common pin is connected to the normally open pin until

    the relay reads the relay input pin reads 5 volts. This normally open pin is gets backup from the

    common pin of the relay of R-phase. Throughout this operation the common pin is acts as phase

    and normally open pin as ground.

    OPERATION IF FAULT IN R-PHASE AND Y-PHASE:

    Consider the R-phase and Y-phase from fig. the regulator gives 5volts output to the

    microcontroller P2.0 and P2.1 pins and controller P0.0 and P0.1 pin gives zero volts to the driver

    pins. The driver pins which are connected to the input pins of the relay read 5volts. That means

    the relays consider that the phase is a live and relay common pins is connected to normally

    connected pins until the relay input pins reads zero volts from the driver. Throughout this

    operation the relays normally connected pins is acts as phase and common pins acts as neutral.

    Let us consider the fault occur in R-phase and Y-phase. The transformer read zero

    volts input from the phase and the regulator output also zero. Then the microcontroller P2.0 and

    66

  • 7/30/2019 Kam All Ll Lllll Lllll

    67/71

    P2.1 pins read zero volts from the regulator output. According to our microcontroller

    programming the controller P0.0 and P0.1 pins are activated. Then the driver pins read 5volts

    from the microcontroller and driver pin which is connected to the relay become zero volts i.e.

    here existing faults and it is recognized by the relays and it will trip. At this instant the relay

    common pins is connected to the normally open pins until the relay input pin reads 5 volts. These

    normally open pins are gets backup from the common pins of the relay of B-phase. Throughout

    this operation the common pins are acts as phase and normally open pins as ground.

    OPERATION IF FAULT IN Y-PHASE AND B-PHASE:

    Consider the Y-phase and B-phase from fig. the regulator gives 5volts output to the

    microcontroller P2.2 and P2.1 pins and controller P0.2 and P0.1 pin gives zero volts to the driver

    pins. The driver pins which are connected to the input pins of the relay read 5volts. That means

    the relays consider that the phase is a live and relay common pins is connected to normally

    connected pins until the relay input pins reads zero volts from the driver. Throughout this

    operation the relays normally connected pins is acts as phase and common pins acts as neutral.

    Let us consider the fault occur in Y-phase and B-phase. The transformer read zero volts input

    from the phase and the regulator output also zero. Then the microcontroller P2.2 and P2.1 pins

    read zero volts from the regulator output. According to our microcontroller programming the

    controller P0.2 and P0.1 pins are activated. Then the driver pins read 5volts from the

    microcontroller and driver pin which is connected to the relay become zero volts i.e. here

    existing faults and it is recognized by the relays and it will trip. At this instant the relay common

    pins is connected to the normally open pins until the relay input pin reads 5 volts. These

    normally open pins are gets backup from the common pins of the relay of R-phase. Throughout

    this operation the common pins are acts as phase and normally open pins as ground.

    67

  • 7/30/2019 Kam All Ll Lllll Lllll

    68/71

    OPERATION IF FAULT IN B-PHASE AND R-PHASE:

    Consider the B-phase and R-phase from fig. the regulator gives 5volts output to the

    microcontroller P2.0 and P2.2 pins and controller P0.0 and P0.2 pin gives zero volts to the driver

    pins. The driver pins which are connected to the input pins of the relay read 5volts. That means

    the relays consider that the phase is a live and relay common pins is connected to normally

    connected pins until the relay input pins reads zero volts from the driver. Throughout this

    operation the relays normally connected pins is acts as phase and common pins acts as neutral.

    Let us consider the fault occur in B-phase and R-phase. The transformer read zero

    volts input from the phase and the regulator output also zero. Then the microcontroller P2.0 and

    P2.2 pins read zero volts from the regulator output. According to our microcontroller

    programming the controller P0.0 and P0.2 pins are activated. Then the driver pins read 5volts

    from the microcontroller and driver pin which is connected to the relay become zero volts i.e.

    here existing faults and it is recognized by the relays and it will trip. At this instant the relay

    common pins is connected to the normally open pins until the relay input pin reads 5 volts. These

    normally open pins are gets backup from the common pins of the relay of Y-phase. Throughout

    this operation the common pins are acts as phase and normally open pins as ground.

    From above description it is clear that. The circuit provides correct voltage in the same

    power supply lines through relays from the other phase where correct voltage is available. It is

    also possible to provide the backup for two phases also if a phase in a alive.

    68

  • 7/30/2019 Kam All Ll Lllll Lllll

    69/71

    6.5 ADVANTAGES:

    It is fully automatic and doesnt need human intervention.

    It is available in two models

    auto switch-off and

    Phase changer with distribution mode

    Microcontroller is very simple for further future phase extension operations then the op-

    amp system

    6.5 APPLICATIONS:

    Bungalows/ Flats

    Hotels / hostels

    Offices / Banks

    Hospitals / Nursing Homes

    Marriage Halls / auditoriums

    Computer Centers

    Commercial Complexes

    Laboratories

    UPS ( single Phase )

    69

  • 7/30/2019 Kam All Ll Lllll Lllll

    70/71

    CONCLUSIONS:

    The project named Designing of Auto Phase Changer is a real time project. With the

    advancement of digital electronics the automation has been in increased like hospital, cinema

    theaters and small industries.

    In this project the real time problem of failure of the supply is inadvertently solved.

    Mainly this project focuses changeover the supply when the exiting line is in problematic

    condition. This work is totally done with Microcontroller named 8051 with the help of some

    auxiliary devices like step-down transformer, rectifier, and filters and relays etc.

    When the supply is failed the microcontroller takes the decision to changeover to another

    supply which will be done in fraction of seconds which is very small when compared with

    manual changeover.

    This project is developed in the view of house hold purpose only if we extend this project

    by using high rating devices, this can be also applicable for large industries.

    70

  • 7/30/2019 Kam All Ll Lllll Lllll

    71/71

    REFERENCE

    1. KENNETH J AYAL

    2. MAZIDI

    3. DOUGLAS V HALL