Sie sind auf Seite 1von 79

www.final-yearprojects.co.cc | www.troubleshoot4free.

com/fyp/

Transformer Protection From Over Load And Monitoring of Load current in PC ABSTRACT
The aim of the project work is to protect the distribution transformer or any other power transformer, burning due to the overload. Normally most of the transformers are burning because of over load; hence by incorporating monitoring and control circuits, life of the transformer can be.

In this project we designed a system in such a way that it will monitor the load of the transformer continuously and that information is transferred to the control room. In the main station these parameters are displayed on the PC monitor. In the display unit we can view the continuous information of transformer i.e. due to what reason the transformer has been failed, when the power is resumed etc.,. With the help of this kind of system, the maintenance staff of the department can have a continuous vigilance over the transformer.

In this project work, for the demonstration purpose a small step-down transformer of 12V, 1 amps rating at secondary is considered and small bulbs are connected as a load. In this project we are using CT transformer for measuring load current. All these parameters are converted into digital value by using ADC. If the parameters of the transformer (Current) regain the limited range values then Transformer will automatically shutdown. Microcontroller near the transformer section will continuously transmit all the parameters of the transformer to PC of control room.

HARDWARE COMPONENTS: Microcontroller Power supply Relay

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Loads ADC 0804 Current Transformer PC

SOFTWARE TOOLS: Keil micro vision Embedded C Express PCB

Applications: This project is used for protecting Transformers in sub stations, generating stations etc. Used for Industrial protection

BLOCK DIAGRAM:

Power supply Transformer A D C

CT

PC

RELAY Microcontroller LOAD

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

INDEX
CONTENTS Abbreviations 1. Figure Locations 2. Introduction to the project 3. Block Diagram 4. Block Diagram Description 5. Schematic 6. Schematic Description 7. Hardware Components Micro controllers ADC 0804 Relay Power Supply 8. Circuit Description 9. Software components a. About Keil b. Embedded C 10. Conclusion (or) Synopsis 11. Future Aspects Bibliography

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Abbreviations:
ACC B PSW SP DPTR DPL DPH P0 P1 P2 P3 IE IP TMOD TCON T2CON T2MOD TH0 TL0 TH1 TL1 TH2 TL2 RCAP2H RCAP2L - Accumulator - B Register - Program Status Word - Stack Pointer - Data pointer - Low byte - High byte - Port 0 - Port 1 - Port 2 - Port 3 - Interrupt Enable control - Interrupt Priority control - Timer/Counter Mode control - Timer/Counter control - Timer/counter 2 control - Timer/counter mode2 control - Timer/counter 0high byte - Timer/counter 0 low byte - Timer/counter 1 high byte - Timer/counter 1 low byte - Timer/counter 2 high byte - Timer/counter 2 low byte - T/C 2 capture register high byte - T/C 2 capture register low byte

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

SCON SBUF PCON PCB AGC RF HT LCD IR

- Serial control - Serial data buffer - Power control - Printed circuit Board - Automatic Gain Control - Radio Frequency - Holteks Company - Liquid Crystal Display - Infrared Radio Frequency

INTRODUCTION:

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

EMBEDDED SYSTEM:

An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often massproduced, benefiting from economies of scale. Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port both features usually belong to "general purpose computers", the line of nomenclature blurs even more. Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Examples of Embedded Systems: Avionics, such as inertial guidance systems, flight control hardware/software and other integrated systems in aircraft and missiles Cellular telephones and telephone switches Engine controllers and antilock brake controllers for automobiles Home automation products, such as thermostats, air conditioners, sprinklers, and security monitoring systems Handheld calculators Handheld computers Household appliances, including microwave ovens, washing machines, television sets, DVD players and recorders Medical equipment Personal digital assistant Videogame consoles Computer peripherals such as routers and printers. Industrial controllers for remote machine operation.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

BLOCK DIAGRAM:

Power supply Transformer A D C

CT

PC

RELAY Microcontroller LOAD

EXPLANATION:
Power supply:
In this system we are using 5V power supply for microcontroller of Transmitter section as well as receiver section. We use rectifiers for converting the A.C. into D.C and a step down transformer to step down the voltage. The full description of the Power supply section is given in this documentation in the following sections i.e. hardware components.

Microcontroller:
In this project the microcontroller plays a major role, here micro controller scan the output of current transformer through adc and send respective signals to PC and PC displays the status of the transformer under test in monitor..

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

ADC0804:
The output of the current transformer connected to adc0804. Actually current transformer is an analog devise, so the output will be in analog form but the microcontroller not understanding the analog values. So, we need to convert the analog output into digital form. ADC0804 performs the conversion to digital from analog. ADC0804 is a 8 bit converter.

Relay:
It is used as electro mechanical switch.

Current transformer:
It is used to measure the load on transformer. And the output of this transformer is connected to ADC. Because it is analog device and the output is in the form of analog variable. So, we need to convert it to digital.

SCHEMATIC:

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

EXPLANATION:
Aim of our project is continuously monitor of the transformer and if any load on that transformer increases we protect that transformer. In this project we make use of PC, Micro controller, Transformer under test and relay. In this project current transformer acts as input. We are connecting the output of current transformer to 6th pin of ADC0804. The 6th pin of ADC0804 acts as analog input. In this project PC acts as output. And PC is connected to microcontroller through RS232. We use MAX232 IC to interface RS232 to uc. The RX and TX pin means 2nd and 3rd pins of RS232 is connected to 14 and 13th pins of MAX232. 11th and 12th pins of MAX232 is connected to 10th and 11th pins of controller. 10th and 11th pins of controller are P3.0 and P3.1. This entire section acts as output and

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

controller sends the signal through RS232 to PC and it will displayed on PC. We are using serial communication. We use one relay to provide 230 volts for load. Relay is a electro mechanical switch. Power supply is connected to 40th pin of the uc. 20th pin is grounded. Crystal oscillator is connected to 18th and 19th pin of uc. Resets switch is connected to 9th pin of uc.

MICROCONTROLLER (AT89S51)
Features:
Compatible with MCS-51 Products 4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Three-level Program Memory Lock 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode)

Description:
The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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 external interrupt or hardware reset.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Pin Description: VCC - Supply voltage. GND - Ground. Port 0: Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can 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 pull-ups. 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.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. 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 pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers cansink/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 pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. 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 pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch Enable (ALE) is an 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 programming. 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 Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S51 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. EA should be strapped to VCC for internal program executions.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier

Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in Table 1. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the five interrupt sources in the IP register.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Dual Data Pointer Registers: To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H- 83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register.

Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to 1 during power up. It can be set and rest under software control and is not affected by reset.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S51, if EA is connected to VCC, program fetches to addresses 0000H through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory. Data Memory the AT89S51 implements 128 bytes of on-chip RAM. The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 bytes of data RAM are available as stack space. Watchdog Timer (One-time Enabled with Reset-out) The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT overflows, it will drive an output RESET HIGH pulse at the RST pin. Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the DTRST register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches 16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will increment every machine cycle while the oscillator is running. This means the user must reset the WDT at least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The WDT counter cannot be read or written. When WDT overflows, it will generate an output RESET pulse at the RST pin. The RESET pulse duration is 98xTOSC, where TOSC=1/FOSC. To make the best use of the WDT, it should be serviced in those sections of code that will periodically be executed prevent a WDT reset. WDT During Power-down and Idle In Power-down mode the oscillator stops, which means the WDT also stops. While in Powerdown mode, the user does not need to service the WDT. There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt, which is enabled prior to entering Power-down mode. When Power-down is exited with hardware reset, servicing the WDT should occur as it normally does whenever the AT89S51 is reset. Exiting Power-down with an interrupt is significantly different. The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To prevent the WDT from resetting the device while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is suggested that the WDT be reset during the interrupt service for the interrupt used to exit Power-down mode. To ensure that the WDT does not overflow within a few states of exiting Power-down, it is best to reset within the time required to

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

the WDT just before entering Power-down mode. Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determine whether the WDT continues to count if enabled. The WDT keeps counting during IDLE (WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the AT89S51 while in IDLE mode, the user should always set up a timer that will periodically exit IDLE, service the WDT, and reenter IDLE mode. With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and resumes the count upon exit from IDLE. UART The UART in the AT89S51 operates the same way as the UART in the AT89C51. Timer 0 and 1 Timer 0 and Timer 1 in the AT89S51 operate the same way as Timer 0 and Timer 1 in the AT89C51. Interrupts The AT89S51 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), two timer interrupts (Timers 0 and 1), and the serial port interrupt. These interrupts are all shown in Figure 1. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table 4 shows that bit position IE.6 is unimplemented. In the AT89S51, bit position IE.5 is also unimplemented. User software should not write 1s to these bit positions, since they may be used in future AT89 products. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 2. 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 3. There are no requirements on the duty cycle of the external

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

clock signal, since the input to the internal clocking circuitry is through a divide-bytwo flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Idle Mode 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 function registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware 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 mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory. Power-down Mode

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

In the Power-down mode, the oscillator is stopped, and the instruction that invokes Powerdown is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the Power-down mode is terminated. Exit from Power-down mode can be initiated either by a hardware reset or by activation of an enabled external interrupt into INT0 or INT1. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.

Program Memory Lock Bits The AT89S51 has three lock bits that can be left unprogrammed (U) or can be programmed (P) to obtain the additional features listed in the following table.

When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value and holds that value until reset is activated. The latched value of EA must agree with the current logic level at that pin in order for the device to function properly. Programming the Flash Parallel Mode

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

The AT89S51 is shipped with the on-chip Flash memory array ready to be programmed. The programming interface needs a high-voltage (12-volt) program enable signal and is compatible with conventional third-party Flash or EPROM programmers. The AT89S51 code memory array is programmed byte-by-byte. Programming Algorithm: Before programming the AT89S51, the address, data, and control signals should be set up according to the Flash programming mode table and Figures 13 and 14. To program the AT89S51, take the following steps: 1. Input the desired memory location on the address lines. 2. Input the appropriate data byte on the data lines. 3. Activate the correct combination of control signals. 4. Raise EA/VPP to 12V. 5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The bytewrite cycle is self-timed and typically takes no more than 50 s. Repeat steps 1 through 5, changing the address and data for the entire array or until the end of the object file is reached. Data Polling: The AT89S51 features Data Polling to indicate the end of a byte write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written data on P0.7. Once the write cycle has been completed, true data is valid on all outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle has been initiated. Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0 is pulled high again when programming is done to indicate READY. Program Verify: If lock bits LB1 and LB2 have not been programmed, the programmed code data can be read back via the address and data lines for verification. The status of the individual lock bits can be verified directly by reading them back.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Reading the Signature Bytes: The signature bytes are read by the same procedure as a normal verification of locations 000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows. (000H) = 1EH indicates manufactured by Atmel (100H) = 51H indicates 89S51 (200H) = 06H Chip Erase: In the parallel programming mode, a chip erase operation is initiated by using the proper combination of control signals and by pulsing ALE/PROG low for a duration of 200 ns - 500 ns. In the serial programming mode, a chip erase operation is initiated by issuing the Chip Erase instruction. In this mode, chip erase is selftimed and takes about 500 ms. During chip erase, a serial read from any address location will return 00H at the data output. Programming the Flash Serial Mode The Code memory array can be programmed using the serial ISP interface while RST is pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RST is set high, the Programming Enable instruction needs to be executed first before other operations can be executed. Before a reprogramming sequence can occur, a Chip Erase operation is required. The Chip Erase operation turns the content of every memory location in the Code array into FFH. Either an external system clock can be supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should be less than 1/16 of the crystal frequency. With a 33 MHz oscillator clock, the maximum SCK frequency is 2 MHz. Serial Programming Algorithm To program and verify the AT89S51 in the serial programming mode, the following sequence is recommended: 1. Power-up sequence: Apply power between VCC and GND pins.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Set RST pin to H. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 Divided by 16. 3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V. 4. Any memory location can be verified by using the Read instruction that returns the content at the selected address at serial output MISO/P1.6. 5. At the end of a programming session, RST can be set low to commence normal device operation.

Power-off sequence (if needed): Set XTAL1 to L (if a crystal is not used). Set RST to L. Turn VCC power off. Data Polling: The Data Polling feature is also available in the serial mode. In this mode, during a write cycle an attempted read of the last byte written will result in the complement of the MSB of the serial output byte on MISO. Serial Programming Instruction Set The Instruction Set for Serial Programming follows a 4-byte protocol and is shown in Table 8 on page 18. Programming Interface Parallel Mode

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Every code byte in the Flash array can be programmed by using the appropriate combination of control signals. The write operation cycle is self-timed and once initiated, will automatically time itself to Completion. All major programming vendors offer worldwide support for the Atmel

microcontroller series. Please contact your local programming vendor for the appropriate software revision.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

After Reset signal is high, SCK should be low for at least 64 system clocks before it goes high to clock in the enable data bytes. No pulsing of Reset signal is necessary. SCK should be no faster than 1/16 of the system clock at XTAL1. For Page Read/Write, the data always starts from byte 0 to 255. After the command byte and upper address byte are latched, each byte thereafter is treated as data until all 256 bytes are shifted in/out. Then the next instruction will be ready to be decoded.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

*NOTICE: Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or any other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability.

Serial Communication:
Computers can transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet away. Examples of parallel data transfer are printers and hard disks; each uses cables with many wire strips. Although in such cases a lot of data can be transferred in a short amount of time by using many wires in

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

parallel, the distance cannot be great. To transfer to a device located many meters away, the serial method is used. In serial communication, the data is sent one bit at a time, in contrast to parallel communication, in which the data is sent a byte or more at a time. Serial communication of the 8051 is the topic of this chapter. The 8051 has serial communication capability built into it, there by making possible fast data transfer using only a few wires. If data is to be transferred on the telephone line, it must be converted from 0s and 1s to audio tones, which are sinusoidal-shaped signals. A peripheral device called a modem, which stands for modulator/demodulator, performs this conversion. Serial data communication uses two methods, asynchronous and

synchronous. The synchronous method transfers a block of data at a time, while the asynchronous method transfers a single byte at a time. In data transmission if the data can be transmitted and received, it is a duplex transmission. This is in contrast to simplex transmissions such as with printers, in which the computer only sends data. Duplex transmissions can be half or full duplex, depending on whether or not the data transfer can be simultaneous. If data is transmitted one way at a time, it is referred to as half duplex. If the data can go both ways at the same time, it is full duplex. Of course, full duplex requires two wire conductors for the data lines, one for transmission and one for reception, in order to transfer and receive data simultaneously. Asynchronous serial communication and data framing The data coming in at the receiving end of the data line in a serial data transfer is all 0s and 1s; it is difficult to make sense of the data unless the sender and receiver agree on a set of rules, a protocol, on how the data is packed, how many bits constitute a character, and when the data begins and ends. Start and stop bits Asynchronous serial data communication is widely used for characteroriented transmissions, while block-oriented data transfers use the synchronous method. In the asynchronous method, each character is placed between start and

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

stop bits. This is called framing.

In the data framing for asynchronous

communications, the data, such as ASCII characters, are packed between a start bit and a stop bit. The start bit is always one bit, but the stop bit can be one or two bits. The start bit is always a 0 (low) and the stop bit (s) is 1 (high). Data transfer rate The rate of data transfer in serial data communication is stated in bps (bits per second). Another widely used terminology for bps is baud rate. However, the baud and bps rates are not necessarily equal. This is due to the fact that baud rate is the modem terminology and is defined as the number of signal changes per second. In modems a single change of signal, sometimes transfers several bits of data. As far as the conductor wire is concerned, the baud rate and bps are the same, and for this reason we use the bps and baud interchangeably. The data transfer rate of given computer system depends on

communication ports incorporated into that system.

For example, the early In recent years,

IBMPC/XT could transfer data at the rate of 100 to 9600 bps.

however, Pentium based PCS transfer data at rates as high as 56K bps. It must be noted that in asynchronous serial data communication, the baud rate is generally limited to 100,000bps.

Computers can transfer data in two ways: parallel and serial. In parallel data transfers, often 8 or more lines (wire conductors) are used to transfer data to a device that is only a few feet away. Examples of parallel transfers are printers and hard disks; each uses cables with many wire strips. Although in such cases a lot of data can be transferred in a short amount of time by using many wires in parallel, the distance cannot be great. To transfer to a device located many meters away, the serial method is used. In serial communication, the data is sent one bit at a time, in contrast to parallel communication, in which the data is sent a byte or more at a time. The 8051 has serial communication capability built into it, there by making possible fast data transfer using only a few wires. The PC uses RS 232 as a Serial Communication Standard.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

RS232 Standards To allow compatibility among data communication equipment made by various manufacturers, an interfacing standard called RS232 was set by the Electronics Industries Association (EIA) in 1960. In 1963 it was modified and called RS232A. RS232B AND RS232C were issued in 1965 and 1969, respectively. Today, RS232 is the most widely used serial I/O interfacing standard. This standard is used in PCs and numerous types of equipment. However, since the standard was set long before the advert of the TTL logic family, its input and output voltage levels are not TTL compatible. In RS232, a 1 is represented by -3 to -25V, while a 0 bit is +3 to +25V, making -3 to +3 undefined. For this reason, to connect any RS232 to a microcontroller system we must use voltage converters such as MAX232 to convert the TTL logic levels to the RS232 voltage levels, and vice versa. MAX232 IC chips are commonly referred to as line drivers. RS232 pins

RS232 cable connector commonly referred to as the DB-25 connector. In labeling, DB25P refers to the plug connector (male) and DB-25S is for the socket connector (female). Since not all the pins are used in PC cables, IBM introduced the DB-9 Version of the serial I/O standard, which uses 9 pins only, as shown in table. DB-9 pin connector 12345 6789
(Out of computer and exposed end of cable)

Pin Functions:

Pin Description

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

1 Data carrier detect (DCD) 2 Received data (RXD) 3 Transmitted data (TXD) 4 Data terminal ready(DTR) 5 Signal ground (GND) 6 Data set ready (DSR) 7 Request to send (RTS) 8 Clear to send (CTS) 9 Ring indicator (RI) Note: DCD, DSR, RTS and CTS are active low pins. The method used by RS-232 for communication allows for a simple connection of three lines namely Tx, Rx, and Ground. TXD: carries data from DTE to the DCE. RXD: carries data from DCE to the DTE SG: signal ground

8051 connection to RS232

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

The RS232 standard is not TTL compatible; therefore, it requires a Line Driver such as the MAX232 chip to convert RS232 voltage levels to TTL levels, and vice versa.

The 8051 has two pins that are used specifically for transferring and receiving data serially. These two pins are TXD and RXD and are a part of the port 3 (P3.0 and P3.1). Pin 11 of the 8051 is designated as TXD and pin 10 as RXD. These pins are TTL compatible; therefore, they require a line driver to make them RS232 compatible. One such line driver is the MAX232 chip.

MAX232 converts from RS232 voltage levels to TTL voltage levels, and vice versa. One advantage of the MAX232 chip is that it uses a +5V power source which, is the same as the source voltage for the 8051. In the other words, with a single +5V power supply we can power both the 8051 and MAX232, with no need for the power supplies. The MAX232 has two sets of line drivers for transferring and receiving data. The line drivers used for TXD are called T1 and T2, while the line drivers for RXD are designated as R1 and R2. In many applications only one of each is used.

MAX 232 Serial Line Drivers: The pin-out diagram of MAX 232 is shown below.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

MAX 232E Dual Driver/Receiver

MAX 232 Operating Circuit:

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Pin 10, 11 form the dual inputs with TTL logic whereas 14, 7 form the outputs for RS 232 logic. And the 12, 9, 13, 8 form the vice versa inputs and outputs as shown in fig. The inputs and outputs of the drivers and receivers are shown in fig above.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Power supply
The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply

For example a 5V regulated power supply system as shown below:

Transformer:
A transformer is an electrical device which is used to convert electrical power from one

Electrical circuit to another without change in frequency.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

An Electrical Transformer

Turns ratio = Vp/ VS = Np/NS Power Out= Power In VS X IS=VP X IP Vp = primary (input) voltage Np = number of turns on primary coil Ip = primary (input) current

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

RECTIFIER:

A circuit which is used to convert a.c to dc is known as RECTIFIER. The process of conversion a.c to d.c is called rectification

TYPES OF RECTIFIERS:

Half wave Rectifier Full wave rectifier 1. Centre tap full wave rectifier. 2. Bridge type full bridge rectifier.

Comparison of rectifier circuits:

Type of Rectifier Parameter Number of diodes 1 PIV of diodes Vm 2Vm Vm 2 4 Half wave Bridge Full wave

D.C output voltage

Vm/

2Vm/

2Vm/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Vdc,at no-load

0.318Vm

0.636Vm

0.636Vm

Ripple factor Ripple frequency Rectification efficiency Transformer Utilization Factor(TUF) RMS voltage Vrms

1.21

0.482

0.482

2f

2f

0.406

0.812

0.812

0.287

0.693

0.812

Vm/2

Vm/2

Vm/2

Full-wave Rectifier:
From the above comparison we came to know that full wave bridge rectifier as more advantages than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit.

Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.
A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Fig(A)

Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b) with dotted arrows.

Fig(B)
During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c) with dotted arrows.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Fig(C) Filter:

A Filter is a device which removes the a.c component of rectifier output but allows the d.c component to reach the load

Capacitor Filter:
We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Ripples can be removed by one of the following methods of filtering.

(a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due to low impedance. At ripple frequency and leave the d.c.to appears the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c)

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

(c) Various combinations of capacitor and inductor, such as L-section filter section filter, multiple section filter etc. which make use of both the properties mentioned in (a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and another with full wave rectifier.

Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 RMS value). To calculate the value of capacitor(C), C = *3*f*r*Rl Where, f = supply frequency, r = ripple factor, Rl = load resistance Note: In our circuit we are using 1000F. Hence large value of capacitor is placed to reduce ripples and to improve the DC component.

Regulator:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.

Fig 6.1.6 A Three Terminal Voltage Regulator 78XX:


The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX offer several fixed output voltages making them useful in wide range of applications. When used as a zener diode/resistor combination replacement, the LM78XX usually results in an effective output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 & TO-263packages,

Features:
Output Current of 1.5A Output Voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited No External Component Output Voltage 5.0V, 6V, 8V, 9V, 10V,12V, 15V, 18V, 24V

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Offer in plastic TO-252, TO-220 & TO-263

Direct Replacement for LM78XX

ANALOG TO DIGITAL CONVERTER

8-Bit, Microprocessor-Compatible, A/D Converters

The ADC080X family is CMOS 8-Bit, successive approximation A/D converters which use a modified potentiometer ladder and are designed to operate with the 8080A control bus via three-state outputs. These converters appear to the processor as memory locations or I/O ports, and hence no interfacing logic is required. The differential analog voltage input has good common mode-rejection and permits offsetting the analog zero-input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution.

Features

80C48 and 80C80/85 Bus Compatible - No Interfacing Logic Required Conversion Time . . . . . . . . . . . . . . . . . . . . . . . . . . <100us Easy Interface to Most Microprocessors Will Operate in a Stand Alone Mode Differential Analog Voltage Inputs Works with Band gap Voltage References TTL Compatible Inputs and Outputs On-Chip Clock Generator

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Analog Voltage Input Range (Single + 5V Supply) . . . . . . . . . . . . . . . . . . . . . . 0V to 5V No Zero-Adjust Required 80C48 and 80C80/85 Bus Compatible - No Interfacing Logic Required

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

As the peripheral signals usually are substantially different from the ones that microcontroller can understand (zero and one), they have to be converted into a pattern which can be 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.

fig- 4.1 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 any where 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.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

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.

A good converter will have less than 0.5 LSB linearity error and no missing codes over its full temperature range. In the basic conversion scheme of ADC, the un-known input voltage VX is connected to one input of an analog signal comparator, and a time dependant reference voltage VR is connected to the other input of the comparator.

In this project work ADC 080X (8 Bit A/D converter) is used to convert analog voltage variations (according to the condition of the parameters) into digital pulses. This IC is having built in multi-plexer so that channel selection can be done automatically.

FUNCTIONAL DESCRIPTION:

The ADC 0804 shown in figure can be functionally divided into 2 basic sub circuits. These two sub circuits are an analog

multiplexer and an A/D Converter. The multiplexer uses 8 standard CMOS analog switches to provide to up to 4 analog inputs. The

switches are selectively turned on, depending on the data latched in to 3-bit multiplexer address register.

The second functional block, the successive approximation A/D converter, transforms the analog output of the multiplexer to an 8-bit digital word. The output of the multiplexer goes to

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

one of two comparator inputs. The other input is derived from a 256R resistor ladder, which is tapped by a MOSFET transistor switch tree. The converter control logic controls the switch tree, funneling a particular tap voltage to comparator. Based on the result of this comparison, the control logic and the successive approximation register (SAR) will decide whether the next tap to be selected should be higher or lower than the present tap on the resistor ladder. This algorithm is executed 8 times per conversion, once every 8-clock period, yielding a total conversion time of clock periods.

When the conversion cycle is complete the resulting data is loaded into the TRI-STATE output latch. The data in the output latch can be then be read by the host system any time before the end of the next conversion. The TRI-STATE capability of the latch allows easy interfaces to bus oriented systems.

The operation on these converters by a microprocessor or some control logic is very simple. The controlling device first selects the desired input channel. To do this, a 3-bit channel address is placed on the A, B, C in and out pins; and the ALE input is pulsed positively, clocking the address into the multiplexer address register. To begin the conversion, the START pin is pulsed. On the rising edge of this pulse the internal registers are cleared and on the falling edge the start conversion is initiated.

As mentioned earlier, there are 8 clock periods per approximation. Even though there is no conversion in progress the ADC0804 is still internally cycling through these 8 clock periods. A start pulse can occur any time during this cycle but the conversion will not actually begin until the converter internally cycles to the beginning of the next 8 clock period sequence. As long as the start pin is held high no conversion begins, but when the start pin is taken low the conversion will start within 8 clock periods. The EOC output is triggered on the rising edge of the start pulse. It, too, is controlled by the 8 clock period cycle, so it will go low within 8 clock periods of the rising edge of the start pulse. One can see that it is entirely possible for EOC to go low before the conversion starts internally, but this is not important, since the positive transition of EOC, which occurs at the end of a conversion, is what the control logic is looking for.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Once EOC does go high this signals the interface logic that the data resulting from the conversion is ready to be read. The output enable(OE) is then raised high. This enables the TRISTATE outputs, allowing the data to be read. Figure shows the timing diagram.

MUX Addres s

CONTROL LOGIC

SAR 4x1 Analog MUX TRISTATE Output

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

RELAYS
Relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double throw (changeover) switches.

Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. 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

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

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. 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. The supplier's catalogue should show you the relay's connections. The coil will be obvious and it may be connected either way round. Relay coils produce brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage you must connect a protection diode across the relay coil. 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.

The relay's switch connections are usually labeled as COM, NC and NO:

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

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. Connect to COM and NO if you want the switched circuit to be on when the relay coil is on. Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.

Choosing a relay
You need to consider several features when choosing a relay: 1. Physical size and pin arrangement 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: supply Relay current = resistance 4. For example: A 12V supply relay with a coil resistance of 400 passes a coil voltage coil

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. 5. Switch ratings (voltage and current) the relay's switch contacts must be suitable for the circuit they are to control. You will need to check the voltage

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC". 6. Switch contact arrangement (SPDT, DPDT etc). 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

Protection diodes for relays


Transistors and ICs (chips) must be protected from the brief high voltage 'spike' produced when the relay coil is switched off. The diagram shows how a signal diode (eg 1N4148) is connected across the relay coil to provide this protection. Note that the diode is connected 'backwards' so that it will normally not conduct. Conduction only occurs when the relay coil is switched off, at this moment current tries to continue flowing through the coil and it is harmlessly diverted through the diode. Without the diode no current could flow and the coil would produce a damaging high voltage 'spike' in its attempt to keep the current flowing.

Relays and transistors compared


Like relays, transistors can be used as an electrically operated switch. For switching small DC currents (< 1A) at low voltage they are usually a better choice than a relay. However transistors cannot switch AC or high voltages (such as mains electricity) and they are not usually a good choice for switching large currents (> 5A). In these cases a relay will be needed, but note that a low power transistor may still be needed to switch the current for the relay's coil! The main advantages and disadvantages of relays are listed below: Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC. Relays can switch high voltages, transistors cannot.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Relays are a better choice for switching large currents (> 5A). Relays can switch many contacts at once.

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.

Details:
These SPDT relays covers switching capacity of 10A in spite of miniature size for PCB Mount. Contact Rating 12A at 120VAC

10A at 120VAC 10A at 24VDC

Coil Resistance
400ohm 12VDC

Life expectancy
Mechanical 10,000,000 operations at no load Electrical 100,000 at rated resistive load Applications: Domestic Appliances Office Machines Audio Equipment Coffee-Pots

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Control units

CIRCUIT DESCRIPTION:
In this project we designed a system in such a way that it will monitor the load of the transformer continuously and that information is transferred to the control room. In the main station these parameters are displayed on the PC monitor. In the display unit we can view the continuous information of transformer i.e. due to what reason the transformer has been failed, when the power is resumed etc.,. With the help of this kind of system, the maintenance staff of the department can have a continuous vigilance over the transformer.

In this project work, for the demonstration purpose a small step-down transformer of 12V, 1 amps rating at secondary is considered and small bulbs are connected as a load. In this project we are using CT transformer for measuring load current. All these parameters are converted into digital value by using ADC. If the parameters of the transformer (Current) regain the limited range values

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

then Transformer will automatically shutdown. Microcontroller near the transformer section will continuously transmit all the parameters of the transformer to PC of control room.

Software Components:

ABOUT SOFTWARE Softwares used are:


*Keil software for c programming *Express PCB for lay out design *Express SCH for schematic design

What's New in Vision3?


Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2.

What is Vision3?
Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor. A powerful debugger.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided. HELLO is a simple program that prints the string "Hello World" using the Serial Interface. MEASURE is a data acquisition system for analog and digital systems. TRAFFIC is a traffic light controller with the RTX Tiny operating system. SIEVE is the SIEVE Benchmark. DHRY is the Dhrystone Benchmark. WHETS is the Single-Precision Whetstone Benchmark.

Additional example programs not listed here are provided for each device architecture.

Building an Application in Vision2


To build (compile, assemble, and link) an application in Vision2, you must: 1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). 2. Select Project - Rebuild all target files or Build target. Vision2 compiles, assembles, and links the files in your project.

Creating Your Own Application in Vision2


To create a new project in Vision2, you must: 1. Select Project - New Project. 2. Select a directory and enter the name of the project file. 3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target.

Debugging an Application in Vision2


To debug an application created using Vision2, you must: 1. Select Debug - Start/Stop Debug Session. 2. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function. 3. Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on. Starting Vision2 and Creating a Project Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 menu. Project New Project. This opens a standard Windows dialog that asks you for the new project file name. We suggest that you use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project. Window Files. Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the micro controller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration. Building Projects and Creating a HEX Files

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Typical, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging.

After you have tested your application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. You may start your PROM programming utility after the make process when you specify the program under the option Run User Program #1. CPU Simulation Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses. In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device.

Database selection you have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes. Start Debugging

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available.

For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are Available. The additional debug windows are discussed in the following. _ The project structure or tool parameters cannot be modified. All build Commands are disabled. Disassembly Window The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Steps for executing the Keil programs:


1. 2.
Click on the Keil uVision Icon on Desktop The following fig will appear

3. 4.

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

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

5.

Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

6.

Then Click on Save button above.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

7. 8.

Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel

9.

Select AT89C51 as shown below

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

10. 11.

Then Click on OK The Following fig will appear

12. 13. 14.

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.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

15.

Click on the file option from menu bar and select new

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

16.

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

17. 18.

Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

19.

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

20.

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

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

21. 22. 23.

Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.

24. 25.

If the file contains no error, then press Control+F5 simultaneously. The new window is as follows

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

26. 27.

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

28.

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

29. 30.

Now keep Pressing function key F11 slowly and observe. You are running your program successfully

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Conclusion
The project PC BASED TRANSFORMER MONITOR AND PROTECTION has been successfully designed and tested. Integrating features of all the hardware components used have developed it. Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced ICs and with the help of growing technology the project has been successfully implemented.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

Future Enhancement
In this project, we can use the RF technology for transmitting the signals from transformer to the PC at the substation. The RF module covers the minimum range. Whereas in the place of RF module if we use the latest technology called Zig-bee that covers the maximum range than RF. If there is any extension of the bus station the Zig-bee will able to transmit the address to the receiver station.

www.final-yearprojects.co.cc | www.troubleshoot4free.com/fyp/

BIBLIOGRAPHY The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi Janice Gillispie Mazidi The 8051 Micro controller Architecture, Programming & Applications -Kenneth J. Ayala Fundamentals Of Micro processors and Micro computers -B. Ram Micro processor Architecture, Programming & Applications - Ramesh S. Gaonkar Electronic Components -D.V. Prasad

References on the Web:

www.national.com www.atmel.com www.microsoftsearch.com www.geocities.com

Das könnte Ihnen auch gefallen