You are on page 1of 67

INTRODUCTION

In search of our project we plan to do something, which is yet to be established and must be useful to day to day life. We analyzed the current situation and realized that if there may be system that informs the user about various faults in the transformer, we will be able to prevent severe damages. So we decided to develop such a system that detects transformer faults. A system which can detect the voltage of a transformer from normal to abnormal and takes initiatives to avoid damage to a transformer is designed and implemented. Power transformers are designed to transmit and distribute electrical power. Depending on the size of a transformer, replacement costs can range from a few hundred dollars to millions of dollars. Performing offline and invasive tests also add to the replacement cost. Hence, there is an increasing need to move from traditional schedule-based maintenance programs to conditionbased maintenance. However, a focused approach is required for diagnostics.

BLOCK DIAGRAM

POWER SUPPLY

2X16 LCD DISPLAY

CURRENT SENSOR MICRO CONTROLLER VOLTAGE SENSOR

MAX232

GSM MODEM

OPTO COUPLER

DC MOTOR

TEMPRATURE SENSOR

BLOCK DIAGRAM DESCRIPTION:


HARDWARE DETAILS Power supply Microcontroller Current Sensor LCD Display Voltage Sensor Transformer GSM Modem DC Motor with Driver Temperature Sensor

SOFTWARE DETAILS Embedded C language AVR OSP Code Vision AVR

TRANSFORMER INTRODUCTION
The protection system of transformer is inevitable due to the voltage fluctuation, frequent insulation failure, earth fault, over current etc. Thus the following automatic protection systems are incorporated.

1. Buchholz devices:
A Buchholz relay, also called a gas relay or a sudden pressure relay, is a safety device mounted on some oil-filled power transformers and reactors, equipped with an external overhead oil reservoir called a conservator. The Buchholz Relay is used as a protective device sensitive to the effects of dielectric failure inside the equipment. It also provides protection against all kind of slowly developed faults such as insulation failure of winding, core heating and fall of oil level.

2. Earth fault relays:


An earth fault usually involves a partial breakdown of winding insulation to earth. The resulting leakage current is considerably less than the short circuit current. The earth fault may continue for a long time and creates damage before it ultimately develops into a short circuit and removed from the system. Usually provides protection against earth fault only.

3. Over current relays:


An over current relay, also called as overload relay have high current setting and are arranged to operate against faults between phases. Usually provides protection against phase -to-phase faults and overloading faults.

4. Differential system:
Differential system, also called as circulating-current system provides protection against short-circuits between turns of a winding and between windings that correspond to phase-to-phase or three phase type short-circuits i.e. protection against earth and phase faults. it provides

The complete protection of transformer usually requires the combination of these systems. Most of the transformers are usually connected to the supply system through series fuses instead of circuit breakers. In existing method the transformer does not have automatic protective relays for protecting the transformer.

TRANSFORMER DEFINITION
A device used to transfer electric energy from one circuit to another, especially a pair of multiple wound, inductively coupled wire coils that affect such a transfer with a change in voltage, current, phase, or other electric characteristic.

Fig 2.1 Basic Transformer

THE UNIVERSAL EMF EQUATION If the flux in the core is sinusoidal, the relationship for either winding between its number of turns, voltage, magnetic flux density and core cross-sectional area is given by the universal emf equation (from Faradays Law):

E is the sinusoidal rms or root mean square voltage of the winding,


f is the frequency in hertz, N is the number of turns of wire on the winding, a is the cross-sectional area of the core in square meters B is the peak magnetic flux density in Tesla P is the power in volt amperes or watts,

NECESSITY FOR PROTECTION


Transformers are static devices, totally enclosed and generally oil immersed. Therefore, chances of faults occurring on them are very rare. However, the consequences of even a rare fault may be very serious unless the transformer is quickly disconnected from the system. This necessitates providing adequate automatic protection for transformers against possible faults.

COMMON TRANSFORMER FAULTS


As compared with generators, in which many abnormal conditions may arise, power transformers may suffer only from: 1. Open circuits 2. Overheating 3. Winding short-circuits

Open circuit Faults:


An open circuit in one phase of a 3-phase transformer may cause undesirable heating. In practice, relay protection is not provided against open circuits because this condition is relatively harmless. On the occurrence of such a fault, the transformer can be disconnected manually from the system.

Overheating Faults:
Overheating of the transformer is usually caused by sustained overloads or short circuits and very occasionally by the failure of the cooling system. The relay protection is also not provided against this contingency and thermal accessories are generally used to sound an alarm or control the banks of fans.

Winding Short-circuit Faults:


Winding short-circuits (also called internal faults) on the transformer arise from deterioration of winding insulation due to overheating or mechanical injury. When an internal fault occurs, the transformer must be disconnected quickly from the system because a prolonged arc in the transformer may cause oil fire. Therefore, relay protection is absolutely necessary for internal faults.

1.2 EMBEDDED SYSTEM Embedded systems are controllers with on chip control which consist of microcontrollers, input and output devices, memories etc. and it can be used for a specific application. A small computer designed in a single chip is called single chip microcomputer. A single chip microcomputer typically includes a microprocessor, RAM, ROM, timer, interrupt and peripheral controller in a single chip. This single chip microcomputer is also called as a microcontroller. These microcontrollers are used for variety of applications where it replaced the computer. The usage of this microcomputer for specific applications, in which the microcontroller a part of application is called, embedded systems. Computing systems are everywhere. Its probably no surprise that millions of computing systems are built every year destined for desktop computers (Personal Computers, or PCs), workstations, mainframes and servers. Thus an embedded system is nearly any computing system other than a desktop, laptop, or mainframe computer. 1.3 CHARACTERISTICS OF AN EMBEDDED SYSTEM 1.3.1 SINGLE-FUNCTIONED An embedded system usually executes only one program, repeatedly. For example, a pager is always a pager. In contrast, a desktop system executes a variety of programs, like spreadsheets, word processors, and video games, with new programs added frequently.

1.3.2 TIGHTLY CONSTRAINED All computing systems have constraints on design metrics, but those on embedded systems can be especially tight. A design metric is a measure of an implementations features, such as cost, size, performance, and power. Embedded systems often must cost just a few dollars, must be sized to fit on a single chip, must perform fast enough to process data in real-time, and must consume minimum power to extend battery life or prevent the necessity of a cooling fan.

13.3 REACTIVE AND REAL-TIME Many embedded systems must continually react to changes in the systems environment, and must compute certain results in real time without delay. For example, a car's cruise controller continually monitors and reacts to speed and brake sensors. It must compute acceleration or decelerations amounts repeatedly within a limited time; a delayed computation result could result in a failure to maintain control of the car.

1.4. EMBEDDED PROCESSOR TECHNOLOGY 1.4.1 STANDARD GENERAL PURPOSE PROCESSORS (SGPP)

Standard general purpose processors (SGPP) are carefully designed and offer a maximum of flexibility to the designer. Programming SGPPs can be done in nearly every highlevel language or assembly language and requires very little knowledge of the system architecture. As SGPPs are manufactured to high numbers, NRE is spread upon many units. Nevertheless SGPPs are more expensive than other solutions like FPGAs or single purpose processors, when used in products with a large number of selling units. These devices are produced to work in a broad range of environments since those are not designed to be energy efficient nor high-performance for specific applications.

Examples for standard general purpose processors are:

Motorola ARM Atmel AVR Microchip PIC Intel Pentium-(I/II/III/IV)-Series

1.4.2. STANDARD SINGLE PURPOSE PROCESSORS (SSPP)

Standard single purpose processors, sometimes called peripherals, are off-the-shelf predesigned processors, optimized for a single task, such as digital signal processing, analog to digital conversion, timing, etc. SSPPs are manufactured in high quantities, so NRE is spread upon many units. The total costs per SSPP unit are lower than for custom single purpose processors.

1.4.3. CUSTOM SINGLE PURPOSE PROCESSORS (CSPP)

Custom single purpose processors are designed for a very specific task. This implies less flexibility, longer time-to-market and high costs. On the other hand CSPP can be designed to be very small, fast and power-efficient. Examples for such CSPP are FPGAs or more general PLDs.

1.4.4. APPLICATION SPECIFIC INSTRUCTION-SET PROCESSORS (ASIP)

ASIPs are basically standard general purpose processors which are extended by domainspecific instructions. This allows domain-relevant tasks to be performed highly optimized, while keeping the flexibility of general purpose processors.

1.4.5. SPECIFIC DESIGN OF EMBEDDED SYSTEM PROCESSOR

When designing an embedded system, usually, the first step is to specify the intended or required functionality. This is mostly done using natural language, after the functionality is

specified it is formalized in some sort of definition language such as VHDL or Verilog. Subsequently the resulting design is converted into hardware or software components which are then implemented.

MICROCONTROLLER

4.1 INTRODUCTION
Microcontroller is a microprocessor designed specifically for control applications, and is equipped with ROM, RAM and facilities I / O on a single chip.AT89S52 is one of the family MCS-51/52 equipped with an internal 8 Kbyte Flash EPROM (Erasable and Programmable Read Only Memory), which allows memory to be reprogrammed. The AT89S52 is a low-power, high-performance CMOS 8-bit microcomputer with 4Kbytes of Flash programmable and erasable read only memory (PEROM).This device is a Single-chip 8-bit Microcontroller and is a derivative of the 8051 microcontroller family. The instruction set is 100% compatible with the 8051 instruction set. 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 Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

FEATURES OF MICROCONTROLLER
A CPU (central processing unit) 8 bits. 256 bytes of RAM (random access memory) internally. Four ports of I/O with each consist of 8 bit. The internal oscillator and timing circuit. Two timers/counters 16 bits. Five interrupt lines (two fruits and three external interrupt internal interruptions). A serial port with full duplex UART (Universal Asynchronous Receiver Transmitter). Able to conduct the process of multiplication, division, and Boolean. The size of 8 Kbytes EPROM for program memory. Maximum speed execution of instructions per cycle is 0.5 s at 24 MHz clock frequency. If the microcontroller clock frequency used is 12 MHz, the speed is 1 s instruction execution. CPU (central processing unit) This section serves to control the entire operation on the microcontroller. This unit is divided into two parts, the control unit, or CU (Control Unit) and the arithmetic and logic unit or ALU (Arithmetic Logic Unit) The main function control unit is to take instructions from memory (fetch) and then translate the composition of these instructions into a simple collection of work processes (decode), and implement instruction sequence in accordance with the steps that have been determined the program (execute). Arithmetic and logic unit is the part that deals with arithmetic operations like addition, subtraction, and logical data manipulation operations such as AND, OR, and comparison. 4.2.2 INPUT/OUTPUT (I/O) This section serves as a communication tool with a single chip device outside the system. Consistent with the name, I / O devices can receive and provide data to / from a single chip.

There are two kinds of devices I / O is used, ie devices for serial connection UART (Universal Asynchronous Receiver Transmitter) and device for so-called parallel relationship with the PIO (Parallel Input Output).Both types of I / O has been available in a single chip AT89S52. SOFTWARE Single flakes MCS-51 family has a special programming language that is not understood by other types of single flakes. This programming language known by the name of the assembler language instruction has 256 devices. However, when this can be done with microcontroller programming using C language. With the C language, microcontroller programming easier, because the C language format will be automatically converted into assembler language with a hex file format. Software on a microcontroller can be divided into five groups as follows:

PIN CONFIGURATION
AT89S52 microcontroller has 40 pins with a single 5 Volt power supply. The pin 40 is illustrated as follows:

4.3.1 THE FUNCTION OF EACH PIN AT89S52


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 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 programmed 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. Port 1: Port 1 is an 8-bit bi-directional 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 bi-directional I/O port with internal pull-ups. 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 pull-ups. Port 2 emits the high-order address byte during fetching from external program memory and during access to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application, Port 2 uses strong internal pullups when emitting 1s. During accesses to external data memory that uses 8-bit address (MOVX @R1), 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 program and verification. Port 3: Port 3 is an 8-bit bi-directional 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 also serves the functions of Port 3 pin alternate Functions: P P P P P P P 3.0 3.1 3.2 3.3 3.4 3.5 3.6 WR T0 T1 (External RXD TXD INT0 INT1 (Timer (Timer Data (Serial (Serial (External (External 0 1 Memory Input Output Interrupt Interrupt External External Write Port) Port) 0) 1) Input) Input) Strobe)

P 3.7 RD (External Data Memory Read Strobe). Port 3 also receives some control signals for Flash programming and programming verification.

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.

ALE/PROG: Address Latch Enable 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

It is the read strobe to external program memory. When the AT89S52 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/ Programming Enable Voltage External Access Enable 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. 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: It is the output from the inverting oscillator amplifier.

TIMER
Timer0: 8-bit timer/counter with 8-bit prescaler Timer1: 16-bit timer/counter with prescaler Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler.

Mode 0: 13-Bit Timer


Lower byte (TL0/TL1) + 5 bits of upper bytes (TH0/TH1). Backward compatible to the 8048 Not generally used Timer operation in Mode 0

Mode 1: 16-bit
All 16 bits of the timer (TH0/TL0, TH1,and TL1) are used. Maximum count is 65,536 At 12 MHz, maximum interval is 65536 microseconds or 65.536 milliseconds TF0 must be reset after each overflow THx/TLx must be manually reloaded after each overflow.

Mode 2: 8-bit Auto Reload


Only the lower byte (TLx) is used for counting. Upper byte (THx) holds the value to reload into TLx after and overflow. TFx must be manually cleared. Maximum count is 256 Maximum interval is 256 Microseconds or .256 milliseconds

INTERRUPT
Hardware interrupts were introduced as a way to avoid wasting the processor's valuable time in polling loops, waiting for external events. They may be implemented in hardware as a distinct system with control lines, or they may be integrated into the memory subsystem. If implemented in hardware, an interrupt controller circuit such as the IBM PC's Programmable Interrupt Controller (PIC) may be connected between the interrupting device and the processors

interrupt pin to multiplex several sources of interrupt onto the one or two CPU lines typically available. If implemented as part of the memory controller, interrupts are mapped into the system's memory address space. Interrupts can be categorized into: maskable interrupt, non-maskable interrupt (NMI), interprocessor interrupt (IPI), software interrupt, and spurious interrupt.

Maskable interrupt (IRQ) is a hardware interrupt that may be ignored by setting a bit in an interrupt mask register's (IMR) bit-mask.

Non-maskable interrupt (NMI) is a hardware interrupt that lacks an associated bit-mask, so that it can never be ignored. NMIs are often used for timers, especially watchdog timers.

Inter-processor interrupt (IPI) is a special case of interrupt that is generated by one processor to interrupt another processor in a multiprocessor system.

Software interrupt is an interrupt generated within a processor by executing an instruction. Software interrupts are often used to implement system calls because they implement a subroutine call with a CPU ring level change.

Spurious interrupt is a hardware interrupt that is unwanted. They are typically generated by system conditions such as electrical interference on an interrupt line or through incorrectly designed hardware.

Processors typically have an internal interrupt mask which allows software to ignore all external hardware interrupts while it is set. This mask may offer faster access than accessing an interrupt mask register (IMR) in a PIC, or disabling interrupts in the device itself. In some cases, such as the x86 architecture, disabling and enabling interrupts on the processor itself act as a memory barrier, however it may actually be slower. An interrupt that leaves the machine in a well-defined state is called a precise interrupt. Such an interrupt has four properties:

The Program Counter (PC) is saved in a known place. All instructions before the one pointed to by the PC have fully executed. No instruction beyond the one pointed to by the PC has been executed (that is no prohibition on instruction beyond that in PC, it is just that any changes they make to registers or memory must be undone before the interrupt happens).

The execution state of the instruction pointed to by the PC is known.

An interrupt that does not meet these requirements is called an imprecise interrupt. The phenomenon where the overall system performance is severely hindered by excessive amounts of processing time spent handling interrupts is called an interrupt storm.

TYPES OF INTERRUPT LEVEL-TRIGGERED EDGE-TRIGGERED HYBRID MESSAGE SIGNALED DOORBELL

USES OF INTERRUPT
Typical uses of interrupts include the following: system timers, disks I/O, power-off signals, and traps. Other interrupts exist to transfer data bytes using UARTs or Ethernet; sense keypresses; control motors; or anything else the equipment must do. A classic system timer generates interrupts periodically from a counter or the power-line. The interrupt handler counts the interrupts to keep time. The timer interrupt may also be used by the OS's task scheduler to reschedule the priorities of running processes. Counters are popular, but some older computers used the power line frequency instead, because power companies in most Western countries control the power-line frequency with a very accurate atomic clock. A disk interrupt signals the completion of a data transfer from or to the disk peripheral. A process waiting to read or write a file starts up again. A power-off interrupt predicts or requests a loss of power. It allows the computer equipment to perform an orderly shut-down. Interrupts are also used in type ahead features for buffering events like keystrokes.

NEED OF MICROCONTROLLER
Microcontroller is a general-purpose device which has in-built CPU memory and peripherals to make it act as a mini-computer Microcontroller has one or two operational codes for moving data from external to CPU Microcontroller has many bit handling instructions Microcontroller works faster than microprocessor because of rapid movement of bits within the chip Microcontroller can function as a computer with the addition of no external parts

POWER SUPPLY INTRODUCTION


A power supply is a device that supplies electrical energy to one or more electric loads. The term is most commonly applied to devices that convert one form of electrical energy to another, though it may also refer to devices that convert another form of energy (e.g., mechanical, chemical, solar) to electrical energy. A regulated power supply is one that controls the output voltage or current to a specific value; the controlled value is held nearly constant despite variations in either load current or the voltage supplied by the power supply's energy source. Every power supply must obtain the energy it supplies to its load, as well as any energy it consumes while performing that task, from an energy source. Depending on its design, a power supply may obtain energy from:

Electrical energy transmission systems. Common examples of this include power supplies that convert AC line voltage to DC voltage.

Energy storage devices such as batteries and fuel cells. Electromechanical systems such as generators and alternators. Solar power.

A power supply may be implemented as a discrete, stand-alone device or as an integral device that is hardwired to its load. Examples of the latter case include the low voltage DC power supplies that are part of desktop computers and consumer electronics devices.

The amount of voltage and current it can supply to its load. How stable its output voltage or current is under varying line and load conditions. How long it can supply energy without refueling or recharging (applies to power supplies that employ portable energy sources)

EXPLAINATION AND BLOCK DIAGRAM


The ac voltage, typically 220V rms, is connected to a transformer, which steps that ac voltage down to the level of the desired dc output. A diode rectifier then provides a fullwave rectified voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation. A regulator circuit removes the ripples and also remains the same dc value even if the input dc voltage varies, or the load connected to the output dc voltage changes. This voltage regulation is usually obtained using one of the popular voltage regulator IC units.

230V AC 50Hz

D.C Output

Step down transformer

Bridge Rectifier

Filter Regulator

POWER SUPPLY

CIRCUIT DIAGRAM OF POWER SUPPLY

WORKING OF POWER SUPLLY

TRANSFORMER:
Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.

RECTIFIER:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification.

FILTER:
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.

VOLTAGE REGULATOR:
As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels.

5.5 POWER SUPPLY APPLICATION 5.5.1 Computer power supply


A modern computer power supply is a switch-mode power supply that converts AC power from the mains supply, to several DC voltages. Switch-mode supplies replaced linear supplies due to cost, weight, and size improvement. The diverse collection of output voltages also has widely varying current draw requirements.

5.5.2 Welding power supply


Arc welding uses electricity to melt the surfaces of the metals in order to join them together through coalescence. The electricity is provided by a welding power supply, and can either be AC or DC. Arc welding typically requires high currents typically between 100 and 350 amps. Some types of welding can use as few as 10 amps, while some applications of spot welding employ currents as high as 60,000 amps for an extremely short time. Older welding power supplies consisted of transformers or engines driving generators. More recent supplies use semiconductors and microprocessors reducing their size and weight.

5.5.3 AC Adapter
A power supply that is built into an AC mains power plug is known as a "plug pack" or "plug-in adapter", or by slang terms such as "wall wart". They are even more diverse than their names; often with either the same kind of DC plug offering different voltage or polarity, or a different plug offering the same voltage. "Universal" adapters attempt to replace missing or damaged ones, using multiple plugs and selectors for different voltages and polarities. Re5lacement power supplies must match the voltage of, and supply at least as much current as, the original power supply.

LIQUID CRYSTAL DISPLAY


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segment and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom so characters (unlike in seven on.

segments), animations and

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

LCDs are used in a wide range of applications, including computer monitors, television, instrument panels, aircraft cockpit displays, signage, etc. They are common in consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. LCDs have replaced cathode ray tube (CRT) displays in most applications. They are available in a wider range of screen sizes than CRT and plasma displays, and since they do not use phosphors, they cannot suffer image burn-in. LCDs are, however, susceptible to image persistence. The LCD is more energy efficient and offers safer disposal than a CRT. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically modulated optical device made up of any number of segments filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. The most flexible ones use an array of small pixels. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888. By 2008, worldwide sales of televisions with LCD screens had surpassed the sale of CRT units.

6.2 FEATURES
5 x 8 dots with cursor Built-in controller (KS 0066 or equivalent) +5V power supply (also available for +3V) 1/16 duty cycle B/L to be driven 1,pin 2 or pin 15,pin 16 N.V. optional for +3V power supply

LCD can display a character successfully by placing the 1. Data in Data Register 2. Command in Command Register of LCD 3. Data corresponds to the ASCII value of the character to be printed. This can be done by placing the ASCII value on the LCD Data lines and selecting the Data Register of the LCD by selecting the RS (Register Select) pin.
4. Each and every display location is accessed and controlled by placing respective command on the data lines and selecting the Command Register of LCD by selecting the (Register Select) RS pin.

TABLE 1: Pin description for LCD

Pin 1 2 3

symbol Vss Vcc VEE

I/O ----

Description Ground +5V power supply Power supply to

control contrast

RS

RS=0

to

select

command register RS=1 to select data register 5 R/W I R/W=0 for write R/W=1 for read 6 7 8 9 10 11 12 13 14 E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 I/O I/O I/O I/O I/O I/O I/O I/O I/O Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus

TYPES OF DISPLAY LCD:


Segment (or alphanumeric) Dot matrix (or character) Graphic LCD.

Advantages and disadvantages of LCDs


In spite of LCDs being a well proven and still viable technology, as display devices LCDs are not perfect for all applications.

6.5.1 Advantages
Very compact and light. Low power consumption. No geometric distortion. Little or no flicker depending on backlight technology. Not affected by screen burn-in. Can be made in almost any size or shape. No theoretical resolution limit.

6.5.2 Disadvantages
Limited viewing angle, causing color, saturation, contrast and brightness to vary, even within the intended viewing angle, by variations in posture. Bleeding and uneven backlighting in some monitors, causing brightness distortion, especially toward the edges. Smearing and ghosting artifacts caused by slow response times (>8 ms) and "sample and hold" operation. Only one native resolution. Displaying resolutions either requires a video scaler, lowering perceptual quality, or display at 1:1 pixel mapping, in which images will be physically too large or won't fill the whole screen. Fixed bit depth, many cheaper LCDs are only able to display 262,000 colors. 8-bit S-IPS panels can display 16 million colors and have significantly better black level, but are expensive and have slower response time. Low bit depth results in images with unnatural or excessive contrast. Input lag Dead or stuck pixels may occur during manufacturing or through use.

In a constant-on situation, thermalization may occur, which is when only part of the screen has overheated and looks discolored compared to the rest of the screen. Not all LCDs are designed to allow easy replacement of the backlight. Cannot be used with light guns/pens. Loss of contrast in high temperature environments.

6.6 MAX 232

max 232 circuit diagram

Since the RS232 (Recommended Standard) is not compatible with todays microprocessor and microcontrollers, we need a line driver to convert the RS232s signal to TTL voltage levels that will be acceptable to the AT89C51 TXD and RXD pins.

One example of such a converter is MAX 232. MAX 232 converts from Rs232 voltage levels to TTL voltage levels, and vice versa. One advantages of the MAX232 chip is that it uses a +5v power source which ,is the same as the source voltages for the 89C52. In other words with a single +5v power supply we can power both the AT89C51 and MAX232, with no need for the dual power supply that are common in many older systems. The MAX232 has 2 sets of line drivers for transferring and receiving data, as shown the line drivers used for TXD are called T1 and T2, while the line drives for RXD are designated as R1 and R2. The MAX232 is an integrated circuit that converts signals from an RS-232 serial port to signals suitable for use in TTL compatible digital logic circuits. The MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single + 5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0 V to + 5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors 0.1 F in place of the 1.0 F capacitors used with the original device. The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5 V.

GSM

7.1 INTRODUCTION
GSM (Global System for Mobile Communications: originally from Groupe Special Mobile) is the world's most popular standard for mobile telephony systems. The GSM Association estimates that 80% of the global mobile market uses the standard. GSM is used by over 1.5 billion people across more than 212 countries and territories. This ubiquity means that subscribers can use their phones throughout the world, enabled by

international roaming arrangements between mobile network operators. GSM differs from its predecessor technologies in that both signalling and speech channels are digital, and thus GSM is considered a second generation (2G) mobile phone system. This also facilitates the wide-spread implementation of data communication applications into the system. The GSM standard has been an advantage to both consumers, who may benefit from the ability to roam and switch carriers without replacing phones, and also to network operators, who can choose equipment from many GSM equipment vendors. GSM also pioneered low-cost implementation of the short message service (SMS), also called text messaging, which has since been supported on other mobile phone standards as well. The standard includes a worldwide emergency telephone number feature. Newer versions of the standard were backward-compatible with the original GSM system. For example, Release '97 of the standard added packet data capabilities by means of General Packet Radio Service (GPRS). Release '99 introduced higher speed data transmission using Enhanced Data Rates for GSM Evolution (EDGE).

7.2 THE CELLULAR NETWORK

GSM REFERENCE MODEL

MS
The MS consist of physical equipment used by the subscriber to access a PLMN for offered telecommunication services. The MS includes a Mobile Terminal and depending on the services it can support various Terminal Equipment(TE).Various type of MS, such as vehicle mounted station, portable station, or handheld station, are used. The MSs come in ve power classes which dene the maximum RF power level that the unit can transmit. Basically, an MS can be divided into two parts. The rst part contains the hardware and software to support radio and human interface functions. The second part contains terminal/user-specic data in the form of a smart card, which can effectively be considered a sort of logical terminal. The SIM card plugs into the rst part of the MS and remains in for the duration of use. Without the SIM card, the MS is not associated with any user and cannot make or receive calls (except possibly an emergency cal l if the network allows). The SIM card is issued by the mobile service provider after subscription, while the rst part of the MS would be

available at retail shops to buy orrent. This type of SIM card mobility is analogous to terminal mobility, but provides a personal-mobility-like service within the GSM mobile network.

IMSI
The IMSI is assigned to an MS at subscription time. It uniquely identies a given MS. The IMSI will be transmitted over the radio interface only if necessary. The IMSI contains 15 digits and includes Mobile Country Code (MCC)3 digits (home country) Mobile Network Code (MNC)2 digits (home GSM PLMN) Mobile Subscriber Identication (MSIN) National Mobile Subscriber Identity (NMSI)

TEMPORARY MOBILE SUBSCRIBER IDENTITY (TMSI )


The TMSI is assigned to an MS by the VLR. The MSI uniquely identies an MS within the area controlled by a given VLR. The maximum number of bits that can be used for the TMSI is 32

. IMEI
The IMEI uniquely identies the MS equipment. It is assigned by the equipment manufacturer. The IMEI contains 15 digits and carries The Type Approval Code (TAC)6 digits The Final Assembly Code (FAC)2 digits The serial number (SN) 6 digits A Spare (SP)1 digit

SIM
The SIM carries the following information IMSI Authentication Key (Ki) Subscriber information Access control class Cipher Key (Kc) TMSI Additional GSM services Location Area Identity (LAI) Forbidden PLMN

BSS
The BSS is the physical equipment that provides radio coverage to prescribed geographical areas, known as the cells. It contains equipment required to communicate with the MS. Functionally, a BSS consists of a control function carried out by the BSC and a transmitting function performed by the BTS. The BTS is the radio transmission equipment and covers each cell. A BSS can serve several cells because it can have multiple BTSs.The BTS contains the Transcoder Rate Adapter Unit (TRAU). In TRAU, the GSM-specic speech encoding and decoding is carried out, as well as the rate adaptation function for data. In certain situations the TRAU is located at the MSC to gain an advantage of more compressed transmission between the BTS and the MSC

NSS

The NSS includes the main switching functions of GSM, databases required for the subscribers, and mobility management. Its main role is to manage the communi cat ions between GSM and other network users.Within the NSS, the switching functions are performed by the MSC. Subscriber information relevant to provisioning of services is kept in the HLR. The other database in the NSS is the VLR. The MSC performs the necessary switching functions required for the MSs located in an associated geographical area, called an MSC area. The MSC monitors the mobility of its subscribers and manages necessary resources required to handle and update the location registration procedures and to carry out the handover functions. The MSC is involved in the interworking functions to communicate with other networks such as PSTN and ISDN. The interworking functions of the MSC depend upon the type of the network to which it is connected and the type of service to be performed. The call routing and control and echo control functions are also performed by the MSC. The HLR is the functional unit used for management of mobile subscribers. The number of HLRs in a PLMN varies with the characteristics of the PLMN. Two types of information are stored in the HLR: subscriber information and part of the mobile information to allow incoming calls to be routed to the MSC for the particular MS. Any administrative action by the service provider on subscriber data is performed in the HLR. The HLR stores IMSI, MS ISDN number, VLR address, and subscriber data (e.g., supplementary services). The VLR is linked to one or more MSCs. The VLR is the functional unit that dynamically stores subscriber information when the subscriber is located in the area covered by the VLR. When a roaming MS enters an MSC area, the MSC informs the associated VLR about the MS the MS goes through a registration procedure. The registration procedure for the MSincludes these activities: The VLR recognizes that the MS is from another PLMN. If roaming is allowed, the VLR nds the MSs HLR in its home PLMN. The VLR constructs a Global Title (GT) from the IMSI to allow signaling from the VLR to the MSs HLR via the PSTN/ISDN networks. The VLR generates a Mobile Subscriber Roaming Number (MSRN) thatis used to route incoming calls to the MS.

The MSRN is sent to the MSs HLR.

DC MOTOR: In any electric motor, operation is based on simple electromagnetism. A currentcarrying conductor generates a magnetic field when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion. The shunt motor is different from the series motor in that the field winding is connected in parallel with the armature instead of in series. You should remember from basic electrical theory that a parallel circuit is often referred to as a shunt. Since the field winding is placed in parallel with the armature, it is called a shunt winding and the motor is called a shunt motor. Figure shows a diagram of a shunt motor. Notice that the field terminals are marked Fl and F2, and the armature terminals are marked Al andA2. You should notice in this diagram that the shunt field is represented with multiple turns using a thin line. Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization).

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors (and all that BEAMers will see), the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor; this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor (together with the axle and attached commutator) rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -with the rotor inside the stator (field) magnets. The geometry of the brushes, commutator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, driving it to continue rotating.

In real life, though, DC motors will always have more than two poles (three is a very common number). In particular, this avoids "dead spots" in the commutator. You can imagine how with our example two-pole motor, if the rotor is exactly at the middle of its rotation (perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes touch both

commutator contacts simultaneously). This would be bad for the power supply, waste energy, and damage motor components as well. Yet another disadvantage of such a simple motor is that it would exhibit a high amount of torque "ripple" (the amount of torque it could produce is cyclic with the position of the rotor).

Diagram of DC shunt motor.

Two factors are important in the selection of a motor for a particular application: the variation of the speed with a change in load, and the variation of the torque with a change in load. A shunt motor is basically a constant speed device. If a load is applied, the motor tends to slow down. The slight loss in speed reduces the counter emf and results in an increase of the armature current. This action continues until the increased current produces enough torque to meet the demands of the increased load. As a result, the shunt motor is in a state of stable equilibrium

because a change of load always produces a reaction that adapts the power input to the change in load. The basic circuit for a shunt motor is shown in figure. Note that only a shunt field winding is shown. Figure shows the addition of a series winding to counteract the effects of armature reaction. From the standpoint of a schematic diagram, figure represents a compound motor. However, this type of motor is not considered to be a com pound motor because the commutating winding is not wound on the same pole as the field winding and the series field has only a few turns of wire in series with the armature circuit. As a result, the operating characteristics are those of a shunt motor. This is so noted on the nameplate of the motor by the terms compensated shunt motor or stabilized shunt motor.

DC MOTOR CONTROL CHARACTERISTICS: A shunt-wound motor is a direct-current motor in which the field windings and the armature may be connected in parallel across a constant-voltage supply. In adjustable speed applications, the field is connected across a constant-voltage supply and the armature is connected across an independent adjustable-voltage supply. Permanent magnet motors have similar control

DC MOTOR CHARACTERISTICS: It will be easier to understand the operation of the DC motor from a basic diagram that shows the magnetic interaction between the rotating armature and the stationary field's coils. Below Figure shows three diagrams that explain the DC motor's operation in terms of the magnetic interaction.

That a bar magnet has been mounted on a shaft so that it can spin. The field winding is one long coil of wire that has been separated into two sections. The top section is connected to the positive pole of the battery and the bottom section is connected to the negative pole of the battery. It is important to understand that the battery represents a source of voltage for this winding. In the actual industrial-type motor this voltage will come from the DC voltage source for the motor. The current flow in this direction makes the top coil the north pole of the magnet and the bottom coil the south pole of the magnet.

The bar magnet represents the armature and the coil of wire represents the field. The arrow shows the direction of the armature's rotation. Notice that the arrow shows the armature starting to rotate in the clockwise direction. The north pole of the field coil is repelling the north pole of the armature, and the south pole of the field coil is repelling the south pole of the armature.

(a) Magnetic diagram that explains the operation of a DC motor. The rotating magnet moves clockwise because like poles repel. (b) The rotating magnet is being attracted because the poles are unlike. (c) The rotating magnet is now shown as the armature coil, and its polarity is determined by the brushes and commutator segments.

This action switches the direction of current flow through the armature, which also switches the polarity of the armature coil's magnetic field at just the right time so that the repelling and attracting continues. The armature continues to switch its magnetic polarity twice during each rotation, which causes it to continually be attracted and repelled with the field poles.

This is a simple two-pole motor that is used primarily for instructional purposes. Since the motor has only two poles, the motor will operate rather roughly and not provide too much torque. Additional field poles and armature poles must be added to the motor for it to become useful for industry. Two factors are important in the selection of a motor for a particular application: (1) the variation of the speed with a change in load. (2) the variation of the torque with a change in load. A shunt motor is basically a constant speed device. If a load is applied, the motor tends to slow down. The slight loss in speed reduces the counter emf and results in an increase of the armature current. This action continues until the increased current produces enough torque to meet the demands of the increased load. As a result, the shunt motor is in a state of stable equilibrium because a change of load always produces a reaction that adapts the power input to the change in load. The basic circuit for a shunt motor is shown in figure . Note that only a shunt field winding is shown. Figure 1-10B shows the addition of a series winding to counteract the effects of armature reaction. From the standpoint of a schematic diagram, figure 1-10B represents a compound motor. However, this type of motor is not considered to be a com pound motor because the commutating winding is not wound on the same pole as the field winding and the series field has only a few turns of wire in series with the armature circuit. As a result, the operating characteristics are those of a shunt motor. This is so noted on the nameplate of the motor by the terms compensated shunt motor or stabilized shunt motor. Speed Control A dc shunt motor has excellent speed control. To operate the motor above its rated speed, a field rheostat is used to reduce the field current and field flux. To operate below rated speed, reduce the voltage applied to the armature circuit.

A more modem method of speed control is the electronic speed control system. The principles of control are the same as the manual controls. Speeds above normal are achieved by reducing the field voltage electronically and speeds below normal reduce the voltage applied to the armature. Rotation The direction of armature rotation may be changed by reversing the direction of cur rent in either the field circuit or the armature circuit. For a motor with a simple shunt field circuit, it may be easier to reverse the field circuit lead. If the motor has a series winding, or an interpole winding to counteract armature reaction, the same relative direction of cur rent must be maintained in the shunt and series windings. For this reason, it is always easier to reverse the direction of the armature current.

Shunt motor connections: (A) Without Commutating Poles; (B) With Commutating Poles Torque A dc shunt motor has high torque at any speed. At startup, a dc shunt motor develops 150 percent of its rated torque if the resistors used in the starting mechanism are capable of withstanding the heating effects of the current. For very short periods of time, the motor can develop 350 percent of full load torque, if necessary. Speed Regulation The speed regulation of a shunt motor drops from 5 percent to 10 percent from the no-load state to full load. As a result, a shunt motor is superior to the series dc motor, but is inferior to a compound-wound dc motor. Figure shows a dc motor with horse power ratings ranging from 1 hp to 5 hp.

the field coil. In this application the armature coil is usually changed, as was the case with the series motor. the electrical diagram of a DC shunt motor connected to a forward and reversing motor starter. You should notice that the Fl and F2 terminals of the shunt field are connected

directly to the power supply, and the Al and A2 terminals of the armature winding are connected to the reversing starter. When the FMS is energized, its contacts connect the Al lead to the positive power supply terminal and the A2 lead to the negative power supply terminal. The Fl motor lead is connected directly to the positive terminal of the power supply and the F2 lead is connected to the negative terminal. When the motor is wired in this configuration, it will begin to run in the forward direction. When the RMS is energized, its contacts reverse the armature wires so that the Al lead is connected to the negative power supply terminal and the A2 lead is connected to the positive power supply terminal. The field leads are connected directly to the power supply, so their polarity is not changed. Since the field's polarity has remained the same and the armature's polarity has reversed, the motor will begin to rotate in the reverse direction. The control part of the diagram shows that when the FMS coil is energized, the RMS coil is locked out. Installing a Shunt Motor shunt motor can be installed easily. The motor is generally used in belt-drive applications. This means that the installation procedure should be broken into two sections, which include the mechanical installation of the motor and its load, and the installation of electrical wiring and controls. When the mechanical part of the installation is completed, the alignment of the motor shaft and the load shaft should be checked. If the alignment is not true, the load will cause an undue stress on the armature bearing and there is the possibility of the load vibrating and causing damage to it and the motor. After the alignment is checked, the tension on the belt should also be tested. As a rule of thumb, you should have about V2 to 1/4 inch of play in the belt when it is properly tensioned. Several tension measurement devices are available to determine when a belt is tensioned properly. The belt tension can also be compared to the amount of current the motor draws. The motor must have its electrical installation completed to use this method. The motor should be started, and if it is drawing too much current, the belt should be loosened slightly but not enough to allow the load to slip. If the belt is slipping, it can be tightened to the point where the motor is able to start successfully and not draw current over its rating The electrical installation can be completed before, A

INTERFACING INTERFACING 16x2 LCD WITH MICROCONTROLLER


A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers.

1. Command/Instruction Register- stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing, clearing the screen, setting the cursor position, controlling display etc. 2. Data Register- stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

Commonly used LCD Command codes:

Hex Code 1 2 4 6 E 80 C0 38

Command to LCD Instruction Register Clear screen display Return home Decrement cursor Increment cursor Display

ON,

Cursor

ON

Force the cursor to the beginning of the 1st line Force cursor to the beginning of the 2nd line Use 2 lines and 5x7 matrix

The pin description of this module is given below:

Pin configuration:
Pin 1 2 3 Symbol VSS VCC VEE Description Ground Main power supply Power supply to control contrast 0V +5 V Contrast adjustment by providing a variable resistor through VCC 4 RS Register Select RS=0 to select Command Register RS=1 to select Data Register 5 R/W Read/write R/W=0 to write to the register R/W=1 to read from the register 6 EN Enable A high to low pulse (minimum 450ns wide) is given when data is sent to data pins 7 8 9 10 11 12 13 14 15 16 DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 Led+ LedBacklight VCC Backlight Ground +5 V 0V To display letters or numbers, their ASCII codes are sent to data pins (with RS=1). Also instruction 8-bit data pins

command codes are sent to these pins.

INTERFACING GSM MODULE WITH MICROCONTROLLER

GSM is widely used mobile communication architecture used in most of the countries. This project demonstrates the interfacing of microcontrollerAT89S52 with HyperTerminal and GSM module. It aims to familiarize with the syntax of AT Commands and their Information Response and Result Codes. The ASCII values of characters in the Information Response, Result Codes and their syntax can be monitored by an LED array. For the basic concepts, working and operation of AT commands and GSM module refer GSM/GPRS Module. A GSM module has an RS232 interface for serial communication with an external peripheral. In this case, the transmit pin (Tx) of the computers Serial port is connected with the receive pin (Rx) of the GSM modules RS-232 interface. The transmit pin (Tx) of the RS-232 of GSM module is connected to receive pin (Rx) of microcontrollers serial transmission pin. And the serial transmit pin of the microcontroller is connected to the receive pin of the computers Serial port.

SOFTWARE USED

INTRODUCTION TO EMBEDDED C:
Embedded is the extension of c language. Embedded C is a compiler which constitutes more build in function. By using c language it is easy to connect the comport easily. The embedded c compiler has the bias function to connect the comport. The command from fussing kit sends from the c program according to user wish.

HI-TEC C
HI-TEC C is a set of software that translates the program written in the C language in to executable machine code versions are available which compile the program for the operation under the host operating system. Some of the Hi-Tec features are A simple batch file will compile, assemble and link entire program The compiler perform strong type checking and issues warning about various constructs which may represent programming errors The generated code is extremely small and fast in execution A full run time library is provided implementing all standard c input/ output and other function The source code for all run time routine is provided A power full general purpose macro-assembler is provided Programs may be generated to execute under the host operating system or customized for installation in ROM.

SOFTWARE DESCRIPTION
INTRODUCTION

Code Vision AVR is a C cross-compiler, Integrated Development Environment and Automatic Program Generator designed for the Atmel AVR family of microcontrollers. The program is designed to run under the Windows 98, Me, NT 4, 2000, XP and Vista 32bit operating systems. The C cross-compiler implements all the elements of the ANSI C language, as allowed by the AVR architecture, with some features added to take advantage of specificity of the AVR architecture and the embedded system needs. The compiled COFF object files can be C source level debugged, with variable watching, using the Atmel AVR Studio debugger. The Integrated Development Environment (IDE) has built-in AVR Chip In-System Programmer software that enables the automatically transfer of the program to the microcontroller chip after successful compilation/assembly. The In-System Programmer software is designed to work in conjunction with the Atmel STK500, AVRISP, AVRISP MkII, AVR Dragon, AVRProg (AVR910 application note), Kanda Systems STK200+, STK300, Dontronics DT006, Vogel Elektronik VTEC-ISP, Futurlec JRAVR and MicroTronics' ATCPU, Mega2000 development boards. For debugging embedded systems, which employ serial communication, the IDE has a built-in Terminal. Besides the standard C libraries, the Code Vision AVR C compiler has dedicated libraries for: Alphanumeric LCD modules Philips I2C bus National Semiconductor LM75 Temperature Sensor

Philips PCF8563, PCF8583, Maxim/Dallas Semiconductor DS1302 and DS1307 Real Time Clocks Maxim/Dallas Semiconductor 1 Wire protocol Maxim/Dallas Semiconductor DS1820, DS18S20 and DS18B20 Temperature Sensors Maxim/Dallas Semiconductor DS1621 Thermometer/Thermostat Maxim/Dallas Semiconductor DS2430 and DS2433 EEPROMs SPI

Power management Delays Gray code conversion.

CodeVisionAVR also contains the CodeWizardAVR Automatic Program Generator that allows you to write, in a matter of minutes, all the code needed for implementing the following functions: External memory access setup Chip reset source identification Input/ Output Port initialization External Interrupts initialization Timers/Counters initialization Watchdog Timer initialization UART (USART) initialization and interrupt driven buffered serial communication Analog Comparator initialization ADC initialization SPI Interface initialization Two Wire Interface initialization CAN Interface initialization I2C Bus, LM75 Temperature Sensor, DS1621 Thermometer/Thermostat and PCF8563,

PCF8583, DS1302, DS1307 Real Time Clocks initialization 1 Wire Bus and DS1820/DS18S20 Temperature Sensors initialization LCD module initialization.

AVR OSP 2 Introduction The Atmel AVR Open Source Programmer (AVROSP) is an AVR programmer application equivalent to the AVR Prog tool included in the AVR Studio. It is a command-line tool, using the same syntax as the other command-line tools in the AVR Studio. The open source code and its modular design make it easy to port the application to other platforms and to add support for other programmer types and communication channels. Currently, AVROSP supports the programmers described in the Atmel AVR109 and AVR910 application notes, through the standard PC serial port. The application note describes how to add more support. AVROSP reads and writes Intel HEX files and can use an existing AVR Studio installation to get required device parameters. This means that AVROSP automatically supports all devices supported by AVR Studio. No update is required for future AVR devices other than keeping your AVR Studio installation up to date.

IMPLEMENTATION This section assumes that the reader has some knowledge of object-oriented programming concepts, and the C++ programming language in particular. The source code is free in all ways, meaning that users can modify and enhance the application and redistribute it as they wish AVROSP Class diagram

Most of the top-level work is encapsulated in the Job Info class. It uses objects of class XML File, HEX File and AVR Device to read and write XML and HEX files and to extract device information from the Part Description Files. The two helper classes Utility and Error Msg are used throughout the application. The part of Job Info that communicates with the programmer does not need to know what kind of communication channel to use. It decodes the command line and creates an instance of the required derived class, e.g. the Serial Port class. The rest of the code just works through the generalized Comm-Channel parent class. Currently, only a class for the PC COM port is implemented, but to use e.g. USB or TCP/IP communication, you could derive a specialized class from the Comm Channel base class, and add a check for this channel type in the command line parser. The same method is used for the programmer type. The code that operates on the programmer does not need to know which type of programmer is attached. The Job Info class retrieves the programmer ID string and creates an appropriate object for the specific programmer. The rest of the code operates through the generalized AVR Programmer interface. Currently, only classes for the Boot loader described in the Atmel AVR910 application note and the In-System Programmer described in the AVR910 application note are implemented. However, you could derive your own specialized programmer from the AVR Programmer base class, and add a

check for it in the ID string decoding part of Job Info. This design makes the application very flexible. Future extension with other communication channels and programmer types is an easy task.

Features Open source C++ code Modular design Reads device information from the Atmel AVR Studio XML files Supports the Boot loader in the Atmel AVR 109 Supports the In-System Programmer in the Atmel AVR910 Command-line equivalent to AVR Studio command-line tools Expandable to other programmer types Expandable to other communication channels, e.g. USB

EMBEDDED C PROGRAM Embedded C is a set of language extensions for the C Programming language by the C Standards committee to address commonality issues that exist between C extensions for different embedded systems. Historically, embedded C programming requires nonstandard extensions to the C language in order to support exotic features such as fixed-point arithmetic, multiple distinct memory banks, and basic I/O operations. In 2008, the C Standards Committee extended the C language to address these issues by providing a common standard for all implementations to adhere to. It includes a number of features not available in normal C, such as, fixed-point arithmetic, named address spaces, and basic I/O hardware addressing. Embedded C use most of the syntax and semantics of standard C, e.g., main () function, variable definition, data type declaration, conditional statements (if, switch. case), loops (while, for), functions, arrays and strings, structures and union, bit operations, macros, unions, etc.

INTRODUCTION TO EMBEDDED C Looking around, we find ourselves to be surrounded by various types of embedded systems. Be it a digital camera or a mobile phone or a washing machine, all of them has some kind of processor functioning inside it. Associated with each processor is the embedded software. If hardware forms the body of an embedded system, embedded processor acts as the brain, and embedded software forms its soul. It is the embedded software which primarily governs the functioning of embedded systems. During infancy years of microprocessor based systems, programs were developed using assemblers and fused into the EPROMs. There used to be no mechanism to find what the program was doing. LEDs, switches, etc. were used to check correct execution of the program. Some very fortunate developers had In-circuit Simulators (ICEs), but they were too costly and were not quite reliable as well.

As time progressed, use of microprocessor-specific assembly-only as the programming language reduced and embedded systems moved onto C as the embedded programming language of choice. C is the most widely used programming language for embedded processors/controllers. Assembly is also used but mainly to implement those portions of the code where very high timing accuracy, code size efficiency, etc. are prime requirements. Initially C was developed by Kernighan and Ritchie to fit into the space of 8K and to write (portable) operating systems. Originally it was implemented on UNIX operating systems. As it was intended for operating systems development, it can manipulate memory addresses. Also, it allowed programmers to write very compact codes. This has given it the reputation as the language of choice for hackers too. As assembly language programs are specific to a processor, assembly language didnt offer portability across systems. To overcome this disadvantage, several high level languages, including C, came up. Some other languages like PLM, Modula-2, Pascal, etc. also came but couldnt find wide acceptance. Amongst those, C got wide acceptance for not only embedded systems, but also for desktop applications. Even though C might have lost its sheen as mainstream language for general purpose applications, it still is having a strong-hold in embedded programming. Due to the wide acceptance of C in the embedded systems, various kinds of support tools like compilers & cross-compilers, ICE, etc. came up and all this facilitated development of embedded systems using C. Subsequent sections will discuss what Embedded C is, features of C language, similarities and difference between C and embedded C, and features of embedded C programming.

EMBEDDED SYSTEMS PROGRAMMING Embedded systems programming is different from developing applications on a desktop computers. Key characteristics of an embedded system, when compared to PCs, are as follows: Embedded devices have resource constraints(limited ROM, limited RAM, limited

stack space, less processing power)

Components used in embedded system and PCs are different; embedded systems Embedded systems are

typically uses smaller, less power consuming components. more tied to the hardware.

Two salient features of Embedded Programming are code speed and code size. Code speed is governed by the processing power, timing constraints, whereas code size is governed by available program memory and use of programming language. Goal of embedded system programming is to get maximum features in minimum space and minimum time.

Embedded systems are programmed using different type of languages: Machine Code Low level language, i.e., assembly High level language like C, C++, Java, Ada, etc. Application level language like Visual Basic, scripts, Access, etc.

Assembly language maps mnemonic words with the binary machine codes that the processor uses to code the instructions. Assembly language seems to be an obvious choice for programming embedded devices. However, use of assembly language is restricted to developing efficient codes in terms of size and speed. Also, assembly codes lead to higher software development costs and code portability is not there. Developing small codes are not much of a problem, but large programs/projects become increasingly difficult to manage in assembly language. Finding good assembly programmers has also become difficult nowadays. Hence high level languages are preferred for embedded systems programming.

Use of C in embedded systems is driven by following advantages It is small and reasonably simpler to learn, understand, program and debug. C Compilers are available for almost all embedded devices in use today, and there is

a large pool of experienced C programmers.

Unlike assembly, C has advantage of processor-independence and is not specific to

any particular microprocessor/ microcontroller or any system. This makes it convenient for a user to develop programs that can run on most of the systems. As C combines functionality of assembly language and features of high level languages, C is treated as a middle-level computer language or high level assembly language It is fairly efficient It supports access to I/O and provides ease of management of large embedded

projects.

Many of these advantages are offered by other languages also, but what sets C apart from others like Pascal, FORTRAN, etc. is the fact that it is a middle level language; it provides direct hardware control without sacrificing benefits of high level languages.

Compared to other high level languages, C offers more flexibility because C is relatively small, structured language; it supports low-level bit-wise data manipulation.

Compared to assembly language, C Code written is more reliable and scalable, more portable between different platforms (with some changes). Moreover, programs developed in C are much easier to understand, maintain and debug. Also, as they can be developed more quickly, codes written in C offers better productivity. C is based on the philosophy programmers know what they are doing; only the intentions are to be stated explicitly. It is easier to write good code in C & convert it to an efficient assembly code (using high quality compilers) rather than writing an efficient code in assembly itself. Benefits of assembly language programming over C are negligible when we compare the ease with which C programs are developed by programmers.

Objected oriented language, C++ is not apt for developing efficient programs in resource constrained environments like embedded devices. Virtual functions & exception handling

of C++ are some specific features that are not efficient in terms of space and speed in embedded systems. Sometimes C++ is used only with very few features, very much as C.

Ada, also an object-oriented language, is different than C++. Originally designed by the U.S. DOD, it didnt gain popularity despite being accepted as an international standard twice (Ada83 and Ada95). However, Ada language has many features that would simplify embedded software development.

Java is another language used for embedded systems programming. It primarily finds usage in high-end mobile phones as it offers portability across systems and is also useful for browsing applications. Java programs require Java Virtual Machine (JVM), which consume lot of resources. Hence it is not used for smaller embedded devices.

Dynamic C and B# are some proprietary languages which are also being used in embedded applications.

Efficient embedded C programs must be kept small and efficient; they must be optimized for code speed and code size. Good understanding of processor architecture embedded C programming and debugging tools facilitate this.

DIFFERENCE BETWEEN C AND EMBEDDED C Though C and embedded C appear different and are used in different contexts, they have more similarities than the differences. Most of the constructs are same; the difference lies in their applications. C is used for desktop computers, while embedded C is for microcontroller based applications. Accordingly, C has the luxury to use resources of a desktop PC like memory, OS, etc. While programming on desktop systems, we need not bother about memory. However, embedded C has to use with the limited resources (RAM, ROM, I/Os) on an embedded processor. Thus, program code must fit into the available program memory. If code exceeds the limit, the system is likely to crash.

Compilers for C (ANSI C) typically generate OS dependant executables. Embedded C requires compilers to create files to be downloaded to the

microcontrollers/microprocessors where it needs to run. Embedded compilers give access to all resources which is not provided in compilers for desktop computer applications. Embedded systems often have the real-time constraints, which is usually not there with desktop computer applications. Embedded systems often do not have a console, which is available in case of desktop applications. So, what basically is different while programming with embedded C is the mindset; for embedded applications, we need to optimally use the resources, make the program code efficient, and satisfy real time constraints, if any. All this is done using the basic constructs, syntaxes, and function libraries of C.

PROGRAMMING

USING

EMBEDDED

Embedded C use most of the syntax and semantics of standard C, e.g., main() function, variable definition, datatype declaration, conditional statements (if, switch. case), loops (while, for), functions, arrays and strings, structures and union, bit operations, macros, etc. In addition, there are some specifics to embedded C which are mentioned below: 1. Low Level Codes

Embedded programming requires access to underlying hardware, i.e., timers, memory, ports, etc. In addition, it is often needed to handle interrupts, manage job queues, etc. As C offers pointers and bit manipulation features, they are extensively used for direct hardware access.

2.

In-line Assembly Code

For a particular embedded device, there may be instructions for which no equivalent C code is available. In such cases, inline assembly code, i.e., assembly code embedded

3.

Features like Heap, recursion

Embedded devices have no or limited heap area (where dynamic memory allocation takes place). Hence, embedded programs do not use standard C functions

like malloc. Structures like linked lists/trees are implemented using static allocation only. Similarly, recursion is not supported by most embedded devices because of its inefficiency in terms of space and time. Such other costly features of standard C which consume space and execution time are either not available or not recommended

4.

I/O Registers

Microcontrollers typically have I/Os, ADCs, serial interfaces and other peripherals inbuilt into the chips. These are accessed as IO Registers, i.e., to perform any operation on these peripherals, bits in these registers are read/written. Special function registers (SFRs) are accessed as shown below: SFR portb = 0x8B; It is used to declare portB at location 0x8B. Some embedded processors have separate IO space for such registers. Since there are no such concepts in C, compilers provide special mechanisms to access them unsigned char portB @portB 0x8B; In this example, @portB <address> declares portB at location 0x8B by the variable portB. Such extensions are not a part of standard C, syntax and semantics differ in various embedded C compilers.

5.

Memory Pointers

Some CPU architectures allow us to access IO registers as memory addresses. This allows treating them just like any other memory pointers.

6.

Bit Access

Embedded controllers frequently need bit operations as individual bits of IO registers corresponds to the output pin of an I/O port. Standard C has quite powerful tools to do bitwise operations. However, care must be taken while using them in structures because C standard doesnt define the bitfield allocation order and C compilers may allocate bit fields either from left to right or from right to left.

7.

Use of Variable data type

In C, datatypes can be simply declared, and compiler takes care of the storage allocation as well as that of code generation. But, datatypes usage should be carefully done to generate optimised code. For most 8-bit C compilers, char is 8-bits, short and int are 16-bits, long is 32-bits. Some embedded processors favour use of unsigned type. Use of long and floating variable should be avoided unless it is very necessary. Using long data types increase code size and execution time. Use of floating point variables is not advised due to intrinsic imprecise nature of floating point operations, alongside speed and code penalty.

8.

Use of Const and Volatile

Volatile is quite useful for embedded programming. It means that the value can change without the program touching it. Consequently, the compiler cannot make any assumptions about its value. The optimizer must reload the variable every time it is used instead of holding a copy in a register. Const is useful where something is not going to change, for e.g., function declarations, etc.

PROBLEMS RESOLVED BY THE SYSTEM:


Early detection of failures in electric power transformers can be succeeded with neural modeling and the Local Statistical Approach to Fault Diagnosis

Neuro-fuzzy networks are proposed for modeling the dynamics of a critical parameter of the power transformer known as Hot Spot Temperature. The output of the neural-fuzzy network is compared to the output of the exact model (Representing the fault-free condition of the transformer) and residuals are generated The residuals undergo statistical signal processing according to a fault detection and isolation algorithm (Local Statistical Approach to FDI) The Local Statistical Approach consists of the global test for fault detection and of the sensitivity and min-max tests for fault isolation If a fault threshold defined by the FDI algorithm is exceeded then deviation from normal operation can be detected at its early stages and an alarm can be launched The proposed FDI approach can be applied to other components of the power grid, e.g power generators, etc.

ADVANTAGES:
Detecting signs of failure conditions Reducing probability of catastrophic failure Reducing unscheduled outages Addressing specific unit or population issues Loading T&D equipment for maximum efficiency Deferring upgrade capital costs Managing & extending the life of equipment Reducing Observation & Measurement costs.

CONCLUSION
Transformers are static devices, totally enclosed and generally oil immersed. Therefore chances of faults occurring on them are very rare. However the consequences of even a rare fault may be

very serious unless the transformer is quickly disconnected from the system. This necessitates to provide adequate automatic protection for transformers against possible faults. The major faults on transformers occur due to short circuits in the transformers or in their connections. The basic system used for protection against these faults is the differential relay Protection of power transformer is a big challenge nowadays. By the help of microcontroller-based relay, protection of transformer is performed very quickly and accurately. This system provides a better and safer protection than the other methods which are currently in use. The advantages of this system over the current methods in use are fast response, better isolation and accurate detection of the fault. This system overcomes the other drawbacks in the existing systems such as maintenance and response time.