You are on page 1of 100

A PROJECT REPORT ON

SPACE VECTOR PULSE WIDTH MODULATION FOR 3-PHASE INDUCTION MOTOR


Submitted by

ZEBA ZAREEN

(04092022)

SARAHATH SALEEM (04092041) SANA SHIREEN (04092057)

In partial fulfillment of the requirements For the award of the degree of

BACHELOR OF ENGINEERING
IN ELECTRICAL &ELECTRONICS ENGINEERING DEPT

Muffakham Jah College of Engineering & Technology (Affiliated to Osmania University)


Hyderabad 500034
MAY 2012

A PROJECT REPORT ON

SPACE VECTOR PULSE WIDTH MODULATION FOR 3-PHASE INDUCTION MOTOR


Submitted by

ZEBA ZAREEN SARAHATH SALEEM SANA SHIREEN

(04092022) (04092041) (04092057)

In partial fulfillment of the requirements For the award of the degree of

BACHELOR OF ENGINEERING
IN ELECTRICAL &ELECTRONICS ENGINEERING DEPT

Muffakham Jah College of Engineering & Technology (Affiliated to Osmania University) Hyderabad 500034

MUFFAKHAM JAH COLLEGE OF ENGINEERING & TECHNOLOGY


(Estd. By the Sultan-Ul-Uloom Education Society in 1980) (Affiliated to Osmania University, Hyderabad) (Approved by the AICTE &Accredited by NBA) _____________________________________________________________

DEPARTMENT OF ELECTRICAL ENGINEERING


BONAFIDE CERTIFICATE
Certified that this project report "SPACE VECTOR PULSE WIDTH

MODULATION FOR 3 PHASE INDUCTION MOTOR" is the bonafide


work of

ZEBA ZAREEN

04-09-2022

SARAHATH SALEEM 04-09-2041 SANA SHIREEN 04-09-2057

who carried out the project work under my supervision.

-----------------------SUPERVISOR
Mrs. Fabia Akbar Associate Professor EEE Department

----------------------------------INCHARGE HEAD
Mrs. Ajaz Fatima M.Tech (I.T.P.E) Associate Professor EEE Department

-----------------------------INTERNAL EXAMINER

-----------------------------------EXTERNAL EXAMINER

8-2-249 to 267, Mount Pleasant Road No.3, Banjara Hills, Post Box No.14, Hyderabad -500155 Phone: 040-23350523, 23352084, Fax: 040-2335 3428
Website: www.mjcollege.ac.in e-mail : principal@mjcollege.ac.in

ACKNOWLEDGEMENT

The satisfaction and euphoria that accompany the successful completion of any task would be incomplete without mentioning the people whose constant guidance and encouragement made it possible. We take pleasure in presenting before you, our project, which is result of studied blend of both research and knowledge.

We express our earnest gratitude to our internal guide, Mrs. Fabia Akbar, Associate Professor, Department of Electrical Engineering, our project guide, for her constant support, encouragement and guidance. We are grateful for her cooperation and her valuable suggestions.

We have furthermore to thank Mr. K.R.M Rao and Mr. J.E Muralidhar from our department who supported us in our research work. Their help, guidance and interest has been extremely vital to us.

Especially we are obliged to Mr.U.C.Patnaik, Technical Director, Edge fx Technologies, for all his support. This project would not be possible without his guidance.

Finally, we express our gratitude to all other members who are involved either directly or indirectly for the completion of this project.

SANA SHIREEN ZEBA ZAREEN SARAHATH SALEEM

ABSTRACT
Sinusoidal PWM has been a very popular technique used in AC motor control. This relatively unsophisticated method employs a triangular carrier wave modulated by a sine wave and the points of intersection determine the switching points of the power devices in the inverter. However, this method is unable to make full use of the inverters supply voltage and the asymmetrical nature of the PWM switching characteristics produces relatively high harmonic distortion in the supply. Space Vector PWM (SVPWM) is a more sophisticated technique for generating a fundamental sine wave that provides a higher voltage to the motor and lower total harmonic distortion (THD). It is also compatible for use in vector control (Field orientation) of AC motors. This abstract describes the theory of SVPWM and the project is made using a programmed microcontroller of 8051 family duly interfaced to 3 phase inverter with 6 nos MOSFET or IGBTs from DC derived from a single phase or 3

phase, 50 Hz supply. The load is a star connected three phase 50 Hz, 440volt, 0.5 to 1 HP motor. Alternatively a star lamp load can be used to view the waveform only.

CONTENTS
1. INTRODUCTION 1.1 PWM 1.2 SINUSOIDAL PWM 1.3 COMPARISON OF SINE PWM AND SPACE VECTOR PWM 2. SPACE VECTOR PULSE WIDTH MODULATION 2.1 SPACE VECTOR PWM FOR 3-LEVEL INVERTER 2.2 CONCEPT OF A SPACE VECTOR 3. INTRODUCTION TO EMBEDDED SYSTEMS 4. BLOCK DIAGRAM 5. HARDWARE REQUIREMENTS 5.1 TRANSFORMERS 5.2 VOLTAGE REGULATOR (LM7805) 5.3 RECTIFIER 5.4 FILTER 5.5 MICROCONTROLLER (AT89S52/C51) 5.6 PUSH BUTTONS 5.7 MCT2E OPTO-ISOLATOR 5.8 GATE DRIVER IR2101 5.9 IRF730 MOSFET 5.10 IN4745 ZENER DIODE 5.11 DIODES 5.12 LED

PAGE NO.

1 2 3

4 5 9 19 22

24 26 28 29 30 37 38 40 41 42 43 44

5.13 RESISTOR 5.14 CAPCITORS 6. SOFTWARE REQUIREMENTS 7. SCHEMATIC DIAGRAM 7.1 DESCRIPTION 8. LAYOUT DIAGRAM 9. BILL OF MATERIALS 10. CODING 10.1 COMPILER 10.2 SOURCE CODE 11. SIMULATED RESULT 12.CONCLUSION 13. REFERENCES

45 46

66 67 71 72 75

93 94

LIST OF FIGURES
1.1 PWM WAVE 1.2 SINUSOIDAL PWM 1.3 LOCUS COMPARISION OF SVM AND SVPWM 2.1 OUTPUT VOLTAGES OF 3 PHASE INVERTER 2.2 SPACE VECTOR PWM SWITCHING PATTERNS AT EACH SECTOR 2.3 DETERMINE THE SWITCHING TIME OF EACH SWITCH 2.4 SPACE VECTOR DIAGRAM-LINE TO NEUTRAL VOLTAGES 3.1 EMBEDDED DESIGN CALLS 3.2 V DIAGRAM 4. BLOCK DIAGRAM OF THE PROJECT 5.1 TRANSFORMER 5.2 VOLTAGE REGULATOR 7805 5.3 RECTIFIER 5.4 FILTER 5.5 BLOCK DIAGRAM OF AT89S52 5.6 PIN DIAGRAM OF AT89S52 5.7 OSCILLATOR CONNECTIONS 5.8 EXTERNAL CLOCK DRIVE CONFIG. 5.9 PUSH ON BUTTONS 5.10 OPTOISOLATOR 6.1 MOSFET

PAGE NO.
1 2 3 6 7

17 18

19 20 22 24 26 28 29 31 32 35 35 37 38 41 43 44

6.2 DIODE 6.3 LED

1. INTRODUCTION
1.1 PULSE WIDTH MODULATION

Pulse-width modulation (PWM), is a commonly used technique for controlling power to inertial electrical devices, made practical by modern electronic power switches. The average value of voltage (and current) fed to the Electrical load is controlled by turning the switch between supply and load on and off at a fast pace. The term duty cycle describes the proportion of 'on' time to the regular interval or 'period' of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on. By using an inverter, it is possible to control the output voltage as well as optimize the harmonics by performing multiple switching within the inverter with the constant dc input voltage V. The main advantage of PWM is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on, there is almost no voltage drop across the switch. Power loss, being the product of voltage and current, is thus in both cases close to zero. PWM also works well with digital controls, which, because of their on/off nature, can easily set the needed duty cycle.

FIG 1.1: PWM WAVE


1

TYPES OF PWM TECHNIQUES: SINUSOIDAL PWM(SPWM) SELECTED HARMONIC ELIMINATION(SHE)PWM MINIMUM RIPPLE CURRENT PWM SPACE VECTOR PWM HYSTERISIS BAND CURRENT CONTROL PWM DELTA MODULATION SIGMA DELTA MODULATION

1.2 SINUSOIDAL PWM:


Sinusoidal PWM has been a very popular technique used in AC motor control. This relatively unsophisticated method employs a triangular carrier wave modulated by a sine wave and the points of intersection determine the switching points of the power devices in the inverter. However, this method is unable to make full use of the inverters supply voltage and the asymmetrical nature of the PWM switching characteristics produces relatively high harmonic.

Fig.1.2 Sinusoidal PWM


2

1.3 Comparison of Sine PWM and Space Vector PWM

Fig.1.3 Locus comparison of maximum linear control voltage in Sine PWM and SVPWM.

Space Vector PWM generates less harmonic distortion in the output voltage or currents in comparison with sine PWM Space Vector PWM provides more efficient use of supply voltage in comparison with sine PWM Sine PWM: Locus of the reference vector is the inside of a circle with radius of 1/2 Vdc Space Vector PWM: Locus of the reference vector is the inside of a circle with radius.
Voltage Utilization: Space Vector PWM = 2/3 times of Sine PWMof 1/3 Vd 3

2. SPACE VECTOR PWM


Space vector modulation is a PWM control algorithm for multi-phase AC generation, in which the reference signal is sampled regularly; after each sample, non-zero active switching vectors adjacent to the reference vector and one or more of the zero switching vectors are selected for the appropriate fraction of the sampling period in order to synthesize the reference signal as the average of the used vectors. Space Vector PWM (SVPWM) is a sophisticated technique for generating a fundamental sine wave that provides a higher voltage to the motor and lower total harmonic distortion (THD). It is also compatible for use in vector control (Field orientation) of AC motors. It is an advanced, computation- intensive method and is possibly the best among all the PWM techniques for variable frequency drive applications. Because of its superior performance characteristics it has been finding widespread application in the recent years. It is an algorithm for the control of pulse width modulation. It is used for creation of alternating currents (AC) waveforms, most commonly to drive 3 phase AC powered motors at varying speeds from DC using multiple amplifiers. There are variations of SVPWM that result in different quality and computational requirements. One active area of development is in the reduction of total harmonic distortion (THD) created by the rapid switching inherent to these algorithms. It aims to generate a voltage vector that is close to the reference circle through the various switching modes of inverter. In this method a voltage reference is provided by using a revolving reference vector. In this case the magnitude and frequency in the line side are controlled by the magnitude and frequency respectively of the reference voltage vector. By using this technique, there is a 15% increment in the maximum voltage compared to the PWM, hence the space vector enable the efficient use of DC voltage.

2.1 SPACE VECTOR PWM FOR 3-LEVEL INVERTER

The implementation of the space vector modulation technique is possible only by the use of a three-phase inverter. Our project uses a three level inverter in 180 degree operation mode. The inverter is considered as a single unit and the modulation is achieved by switching the states of the inverter. Except SVPWM, the other PWM methods on consider the implementation on a half bridge of a three-phase inverter bridge inverter. If the load neutral is connected to the centre tap of the DC supply, all three half bridges operate independently, giving satisfactory performance. With a machine load, the load neutral is normally isolated, which causes interaction among the phases. This interaction is not considered in any other techniques. SVPWM considers this interaction of the phases and optimizes the harmonic content of the three-phase isolated neutral load. The inverter is required to generate load line voltages which are, in average, equal to the reference load line voltages. The average voltages follow the load line voltages without any distortion. The direction of rotation of the motor will ultimately depend on the phase sequence of the voltages. The PWM is achieved by properly selecting the switching states of the inverter in each sampling period . A three level inverter consists of six switches. The types of switches which can be used are MOSFETs, IGBTs, transistors etc. These switches receive input as a DC supply. For the operation in 180 degree mode, three switches are turned on at a time. Each switch operates for 60 degrees. The inverter is controlled in such a way that at no time are both switches on the same leg turned on or else the Dc supple would be shorted. Thus the switches should exhibit complementary operation within a leg.

One complete cycle of input voltage for a 50 Hz AC supply is given by 360 degrees. Thus the total time period, T = 20 ms i. e; for a duration of 60 degrees , the time period is given by 3.33 ms. Thus the total ON time for each of the switches is 3.33 ms. It means that the switching frequency will be 300.3 Hz. Since the ON time and the OFF time of the switches are same , the duty cycle obtained is 50%.

Where, Upper transistors: S1, S3, S5 Lower transistors: S4, S6, S2 Switching variable vector: a, b, c

Fig 2.1 Output Voltages Of Three-Phase Inverter

The six transistor combination of the inverter has eight permissible switching states. S1 through S6 are the six power transistors that shape the output voltage When an upper switch is turned on (i.e., a, b or c is 1), the corresponding lower switch is turned off (i.e., a', b' or c' is 0) When all the upper transistors or all the lower transistors are turned on at the same time, the circuit is shorted and a zero state is obtained.
6

Fig.2.2 SPACE VECTOR PWM SWITCHING PATTERNS AT EACH SECTOR

The eight combinations, phase voltages and output line to line voltages

2.2 CONCEPT OF A SPACE VECTOR

To understand the SVPWM theory, the concept of a rotating space vector is very necessary. A Space Vector is a virtual mathematical entity which represents all the three phases of the AC supply in a single unit. It is given by the equation --

Where

are unit vectors.

The realization of a space vector is incomplete without the transformation of the axes from 3 phase coordinate system to a two phase coordinate system. This transformation is achieved in two steps. (a) Clarkes Transformation: Here, the stationary 3 phase system is converted to stationary 2 phase system i.e, coordinate system. (b) Parks Transformation: Here, the stationary two phase system is converted to rotating two phase system i.e , d-q coordinate system.

The voltage matrices are given by

The nextstep of the transformation into the rotating refernce frame is given as

10

The voltage equations are given by

Principle of Space Vector PWM Treats the sinusoidal voltage as a constant amplitude vector rotating at constant frequency This PWM technique approximates the reference voltage Vref by a combination of the eight switching patterns (V0 to V7) Co-ordinate Transformation (abc reference frame to the stationary d-q frame): A three-phase voltage vector is transformed into a vector in the stationary d-q coordinate frame which represents the spatial vector sum of the three-phase voltage The vectors (V1 to V6) divide the plane into six sectors (each sector: 60 degrees) Vref is generated by two adjacent non-zero vectors and two zero vectors

Line to neutral (phase) voltage vector [VanVbnVcn]t

11

REALISATION OF SPACE VECTOR PWM


Step 1. Determine Vd, Vq, Vref, and angle () Step 2. Determine time duration T1, T2, T0 Step 3. Determine the switching time of each transistor (S1 to S6)

(1) Step 1. Determine Vd, Vq, Vref, and angle ()


Coordinate transformation: abc to dq

Fig: Voltage Space Vector and its components in(d, q)

12

(2) Step 2. Determine time duration T1, T2, T0

Fig: Reference vector as a combination of adjacent vectors at sector 1.

Switching time duration at Sector 1

13

Switching time duration at any Sector

14

TABLE: SWITCHING TIME TABLE AT EACH SECTOR

15

(3) Step 3. Determine the switching time of each switch (S1 to S6)

16

The entire implementation of the space vector can be summarized as

FIG 2.4
17

3. INTRODUCTION TO EMBEDDED SYSTEMS


What is embedded system?
An Embedded System is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. An embedded system is a microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market. An embedded system is not a computer system that is used primarily for processing, not a software system on PC or UNIX, not a traditional business or scientific application. High-end embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems and hardware layout designed for the specific purpose.

SYSTEM DESIGN CALLS:

Fig 3.1: Embedded system design calls


18

EMBEDDED SYSTEM DESIGN CYCLE

Fig 3.2 V Diagram

Characteristics of Embedded System


An embedded system is any computer system hidden inside a product other than a computer. They will encounter a number of difficulties when writing embedded system software in addition to those we encounter when we write applications Throughput Our system may need to handle a lot of data in a short period of time. ResponseOur system may need to react to events quickly TestabilitySetting up equipment to test embedded software can be difficult DebugabilityWithout a screen or a keyboard, finding out what the software is doing wrong (other than not working) is a troublesome problem Reliability embedded systems must be able to handle any situation without human intervention
19

Embedded systems have a microprocessor/ microcontroller and a memory. Some have a serial port or a network connection. They usually do not have keyboards, screens or disk drives.

APPLICATIONS
1) Military and aerospace embedded software applications 2) C om m u ni c at i o n Ap p l i c at i on s 3) In d us t ri al aut om at i o n and p ro c es s co nt r ol s o ft w a r e 4) Mastering the complexity of applications. 5) Reduction of product design time. 6) Real time processing of ever increasing amounts of data. 7) Intelligent, autonomous sensors.

CLASSIFICATION
Real Time Systems. RTS is one which has to respond to events within a specified deadline. A right answer after the dead line is a wrong answer.

RTS CLASSIFICATION
Hard Real Time Systems Soft Real Time System

HARD REAL TIME SYSTEM


"Hard" real-time systems have very narrow response time. Example: Nuclear power system, Cardiac pacemaker.

SOFT REAL TIME SYSTEM


"Soft" real-time systems have reduced constrains on "lateness" but still must operate very quickly and repeatable. Example: Railway reservation system takes a few extra seconds the data remains valid.
20

4. PROJECT BLOCK DIAGRAM

FIG 4: PROJECT BLOCK DIAGRAM

21

5.HARDWARE REQUIREMENTS

HARDWARE COMPONENTS: 1. TRANSFORMER (230 12 V AC) 2. VOLTAGE REGULATOR 3. RECTIFIER 4. FILTER 5. MICROCONTROLLER (AT89S52/AT89C51) 6. PUSH BUTTONS 7. MCT2E OPTO-ISOLATOR 8. IR2101 GATE DRIVER IC 9. IRF730 MOSFET 10. 1N4745 ZENER DIODE 11. 1N4007 / BA159 12. LED 13. RESISTOR 14. CAPACITOR

22

5.1 TRANSFORMER
Transformers convert AC electricity from one voltage to another with a little loss of power. Step-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high voltage to a safer low voltage.

FIG 5.1: A TYPICAL TRANSFORMER

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 and 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. TURNS RATIO = (Vp / Vs) = ( Np / Ns ) Where, Vp = primary (input) voltage. Vs = secondary (output) voltage Np = number of turns on primary coil Ns = number of turns on secondary coil
23

Ip = primary (input) current Is = secondary (output) current.

Ideal power equation

The ideal transformer as a circuit element If the secondary coil is attached to a load that allows current to flow, electrical power is transmitted from the primary circuit to the secondary circuit. Ideally, the transformer is perfectly efficient; all the incoming energy is transformed from the primary circuit to the magnetic field and into the secondary circuit. If this condition is met, the incoming electric power must equal the outgoing power:

giving the ideal transformer equation

Transformers normally have high efficiency, so this formula is a reasonable approximation

24

5.2 VOLTAGE REGULATOR 7805

Features Output Current up to 1A. Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V. Thermal Overload Protection. Short Circuit Protection. Output Transistor Safe Operating Area Protection.

FIG 5.2 VOLTAGE REGULATOR 7805 Description The LM78XX/LM78XXA series of three-terminal positive regulators are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide range of applications. Each type employs internal current limiting, thermal shutdown and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

25

Internal Block Diagram

BLOCK DIAGRAM OF VOLTAGE REGULATOR

Absolute Maximum Ratings

26

5.3 RECTIFIER
A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), current that flows in only one direction, a process known as rectification. Rectifiers have many uses including as components of power supplies and as detectors of radio signals. Rectifiers may be made of solid statediodes, vacuum tube diodes, mercury arc valves, and other components. 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. In positive half cycleonly two diodes (1 set of parallel diodes) will conduct, in negative half cycle remaining two diodes will conduct and they will conduct only in forward bias only.

FIG 5.3 RECTIFIER

27

5.4 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. The simple capacitor filter is the most basic type of power supply filter. The use of this filter is very limited. It is sometimes used on extremely high-voltage, low-current power supplies for cathode-ray and similar electron tubes that require very little load current from the supply. This filter is also used in circuits where the power-supply ripple frequency is not critical and can be relatively high. Below figure can show how the capacitor charges and discharges.

FIG 5.4 FILTER

28

5.5 MICROCONTROLLER AT89S52


The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density non volatile memory technology and is compatible with the industry standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 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 interrupt or hardware reset.

Features:
Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 10,000 Write/Erase Cycles 4.0V to 5.5V Operating Range Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources
29

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) Green (Pb/Halide-free) Packaging Option Block Diagram of AT89S52:

FIG 5.5: BLOCK DIAGRAM OF AT89S52


30

Pin Configurations of AT89S52:

FIG 5.6: PIN DIAGRAM OF AT89S52

Pin Description: VCC:


Supply voltage.

GND:
Ground.

31

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.

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. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX).

Port 2:Port 2 is an 8-bit bidirectional 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 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 pullups 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 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.

32

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.

PSEN: Program Store Enable (PSEN) 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. 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. 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.

33

Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

FIG 5.7: Oscillator Connections

FIG 5.8: External Clock Drive Configuration


34

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 functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset.

Power down Mode


In the power down mode the oscillator is stopped, and the instruction that invokes power down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power down mode is terminated. The only exit from power down is a hardware reset. 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

35

5.6 PUSH BUTTONS

A push-button (also spelled pushbutton) or simply button is a simple switch mechanism for controlling some aspect of a machine or a process. Buttons are typically made out of hard material, usually plastic or metal. The surface is usually flat or shaped to accommodate the human finger or hand, so as to be easily depressed or pushed. Buttons are most often biased switches, though even many un-biased buttons (due to their physical nature) require a spring to return to their un-pushed state. Different people use different terms for the "pushing" of the button, such as press, depress, mash, and punch.

Uses:
In industrial and commercial applications push buttons can be linked together by a mechanical linkage so that the act of pushing one button causes the other button to be released. In this way, a stop button can "force" a start button to be released. This method of linkage is used in simple manual operations in which the machine or process have no electrical circuits for control.

Push to ON button:

Fig 5.9: Push on button Initially the two contacts of the button are open. When the button is pressed they become connected. This makes the switching operation using the push button.
36

5.7 MCT2E OPTO-ISOLATOR

Opto-isolators, or Opto-couplers, are made up of a light emitting device, and a light sensitive device, all wrapped up in one package, but with no electrical connection between the two, just a beam of light. The light emitter is nearly always an LED. The light sensitive device may be a photodiode, phototransistor, or more esoteric devices such as thyristors, triacs e.t.c.

A lot of electronic equipment nowadays is using optocoupler in the circuit. An optocoupler or sometimes refer to as optoisolator allows two circuits to exchange signals yet remain electrically isolated. This is usually accomplished by using light to relay the signal. The standard optocoupler circuits design uses a LED shining on a phototransistor-usually it is a npn transistor and not PNP. The signal is applied to the LED, which then shines on the transistor in the IC.

The light is proportional to the signal, so the signal is thus transferred to the phototransistor. Optocouplers may also comes in few module such as the SCR, photodiodes, TRIAC of other semiconductor switch as an output, and incandescent lamps, neon bulbs or other light source.

The optocoupler usually found in switch mode power supply circuit in many electronic equipment. It is connected in between the primary and secondary section of power supplies. The optocoupler application or function in the circuit is to:

1. Monitor high voltage 2. Output voltage sampling for regulation 3. System control micro for power ON/OFF 4. Ground isolation

37

If the optocoupler IC breakdown, it will cause the equipment to have low power, blink, no power, erratic power and even power shut down once switch on the equipment. Many technicians and engineers do not know that they can actually test the optocoupler with their analog multimeter. Most of them thought that there is no way of testing an IC with an analog meter. This is the principle used in OptoTriacs and optoSCRs, which are readily available in Integrated circuit (I.C.) form, and do not need very complex circuitry to make them work. Simply provide a small pulse at the right time to the Light Emitting Diode in the package. The light produced by the LED activates the light sensitive properties of the Triac or Thyristor gate and the power is switched on. The isolation between the low power and high power circuits in these optically connected devices is typically several thousand volts.

FIG 5.10 OPTOISOLATOR

38

5.8 IR2101
FEATURES Floating channel designed for bootstrap operation Fully operational to +600V Tolerant to negative transient voltage dV/dt immune Gate drive supply range from 10 to 20V Under voltage lockout 3.3V, 5V, and 15V logic input compatible Matched propagation delay for both channels Outputs in phase with inputs (IR2101) or out of phase with inputs (IR2102)

DESCRIPTION

The IR2101(S)/IR2102(S) are high voltage, highspeed power MOSFET and IGBT drivers with independent high and low side referenced output channels. Proprietary HVIC and latch immune CMOS technologies enable ruggedized monolithic construction. The logic input is compatible with standard CMOS or LSTTL output, down to 3.3V logic. The output drivers feature a high pulse current buffer stage designed for minimum driver cross-conduction. The floating channel can be used to drive an N-channel power MOSFET or IGBT in the high side configuration which operates up to 600 volts.

39

5.9 IRF730 MOSFET


FEARURES: typical Rds(on) = 0.75 w extremely high dv/dt capability 100% avalanche tested very low intrinsic capacitances gate charge minimized

DESCRIPTION This power MOSFET is designed using thecompanys consolidated strip layout-based MESHOVERLAY] process. This technology matchesand improves the performances compared withstandard parts from various sources.

APPLICATIONS high current switching uninterruptible power supply (ups) DC/DC converters for telecom, Industrial and lighting equipment. FIG.6.1 MOSFET

40

5.10 1N4745 ZENER DIODE


Description The popular 1N4728AG thru 1N4764AG glass body series of 1.0 watt Zeners provides voltage regulation in a selection from 3.3 to 100 volts in5% tolerances with other tighter tolerances also available as identified by different suffix letters on the part number. These glass encapsulated Zeners with a G suffix provide hermetic-sealed qualities and higher rated temperature when required beyond that optionally provided in the same size DO-41 plastic-body (P suffix) for these JEDEC part numbers. Both of these package options are available by Microsemi. A variety of other Zener product offerings and packages are available by Microsemi to meet higher and lower power or test current applications.

FEATURES: fJEDEC registered 1N4728A to 1N4764A Options for screening in accordance with MILPRF-19500 for JAN, JANTX, JANTXV, and JANS are available by adding MQ, MX, MV, or MSP prefixes respectively to part numbers. Surface mount equivalents available asSMAJ4728A to SMAJ4764A and MLL4728A toMLL4764A (consult factory for others) Plastic body axial-leaded Zener equivalents are also available as 1N4728AP to 1N4764AP

41

5.11 DIODES
Diodes are used to convert AC into DC these are used as half wave rectifier or full wave rectifier. Three points must he kept in mind while using any type of diode. 1. Maximum forward current capacity 2. Maximum reverse voltage capacity 3. Maximum forward voltage capacity FIG 6.2 DIODE

The number and voltage capacity of some of the important diodes available in the market are as follows:

Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007 have maximum reverse bias voltage capacity of 50V and maximum forward current capacity of 1 Amp.

Diode of same capacities can be used in place of one another. Besides this diode of more capacity can be used in place of diode of low capacity but diode of low capacity cannot be used in place of diode of high capacity. For example, in place of IN4002; IN4001 or IN4007 can be used but IN4001 or IN4002 cannot be used in place of IN4007.The diode BY125made by company BEL is equivalent of diode from IN4001 to IN4003. BY 126 is equivalent to diodes IN4004 to 4006 and BY 127 is equivalent to diode IN4007.

42

5.12LED
LEDs are semiconductor devices. Like transistors, and other diodes, LEDs are made out of silicon. What makes an LED give off light are the small amounts of chemical impurities that are added to the silicon, such as gallium, arsenide, indium, and nitride. When current passes through the LED, it emits photons as a byproduct. Normal light bulbs produce light by heating a metal filament until it is white hot. LEDs produce photons directly and not via heat, they are far more efficient than incandescent bulbs.

Fig 6.3 Typical LED

circuit symbol

Not long ago LEDs were only bright enough to be used as indicators on dashboards or electronic equipment. But recent advances have made LEDs bright enough to rival traditional lighting technologies. Modern LEDs can replace incandescent bulbs in almost any application.

Types of LEDS : LEDs are produced in an array of shapes and sizes. The 5 mm cylindrical
package is the most common, estimated at 80% of world production. The color of the plastic lens is often the same as the actual color of light emitted, but not always. For instance, purple plastic is often used for infrared LEDs, and most blue devices have clear housings. There are also LEDs in extremely tiny packages, such as those found on blinkers and on cell phone keypads. The main types of LEDs are miniature, high power devices and custom designs such as alphanumeric or multi-color.

43

5.13 RESISTORS
A resistor is a two-terminal electronic component designed to oppose an electric current by producing a voltage drop between its terminals in proportion to the current, that is, in accordance with Ohm's law: V = IR Resistors are used as part of electrical networks and electronic circuits. They are extremely commonplace in most electronic equipment. Practical resistors can be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome). The primary characteristics of resistors are their resistance and the power they can dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less wellknown is critical resistance, the value below which power dissipation limits the maximum permitted current flow, and above which the limit is applied voltage. Critical resistance depends upon the materials constituting the resistor as well as its physical dimensions; it's determined by design.

. FIG 6.4: RESISTOR A resistor is a two-terminal passive electronic component which implements electrical resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the constant of proportionality is known as the resistance R, since, with a given voltage V, a larger value of R further "resists" the flow of current I as given by Ohm's law:

44

5.14 CAPACITORS
A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors. An ideal capacitor is characterized by a single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. In practice, the dielectric between the plates passes a small amount of leakage current. The conductors and leads introduce an equivalent series resistance and the dielectric has an electric field strength limit resulting in a breakdown voltage. The properties of capacitors in a circuit may determine the resonant frequency and quality factor of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy capacity in a high-power system, and many other important aspects. FIG 6.5: CAPACITOR

45

A capacitor (formerly known as condenser) is a device for storing electric charge. The forms of practical capacitors vary widely, but all contain at least two conductors separated by a non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils separated by a layer of insulating film. Capacitors are widely used in electronic circuits for blocking direct current while allowing alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant circuits that tune radios to particular frequencies and for many other purposes. A capacitor is a passive electronic component consisting of a pair of conductors separated by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a static electric field develops in the dielectric that stores energy and produces a mechanical force between the conductors. An ideal capacitor is characterized by a single constant value, capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential difference between them. The capacitance is greatest when there is a narrow separation between large areas of conductor, hence capacitor conductors are often called "plates", referring to an early means of construction. In practice the dielectric between the plates passes a small amount of leakage current and also has an electric field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance and resistance.

46

6. SOFTWARE REQUIREMENTS

6.1 INTRODUCTION TO KEIL MICRO VISION (IDE)


Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers, simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/CortexM3, XC16x/C16x/ST10, 251, and 8051 MCU families. Keil development tools for the 8051 Microcontroller Architecture support every level of software developer from the professional applications engineer to the student just learning about embedded software development. When starting a new project, simply select the microcontroller you use from the Device Database and the Vision IDE sets all compiler, assembler, linker, and memory options for you. Keil is a cross compiler. So first we have to understand the concept of compilers and cross compilers. After then we shall learn how to work with keil.

6.2 CONCEPT OF COMPILER


Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. I.E the programs written in one of the HLL like C will compile the code to run on the system for a particular processor like x86 (underlying microprocessor in the computer). For example compilers for Dos platform is different from the Compilers for Unix platform So if one wants to define a compiler then compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instruction. See there is a bit little difference between compiler and an interpreter. Interpreter just interprets whole program at a time while compiler analyses and execute each line of source code in succession, without looking at the entire program.

47

The advantage of interpreters is that they can execute a program immediately. Secondly programs produced by compilers run much faster than the same programs executed by an interpreter. However compilers require some time before an executable program emerges. Now as compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language.

6.3 CONCEPT OF CROSS COMPILER


A cross compiler is similar to the compilers but we write a program for the target processor (like 8051 and its derivatives) on the host processors (like computer of x86). It means being in one environment you are writing a code for another environment is called cross development. And the compiler used for cross development is called cross compiler. So the definition of cross compiler is a compiler that runs on one computer but produces object code for a different type of computer.

6.4 KEILC CROSS COMPILER


Keil is a German based Software development company. It provides several tools like IDE (Integrated Development environment) Project Manager Simulator Debugger C Cross Compiler, Cross Assembler, Locator/Linker development

The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An assembler is used to assemble the ARM assembly program. A compiler is used to compile the C source code into an object file. A linker is used to create an absolute object module suitable for our in-circuit emulator.

6.5 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).
48

2. Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles, and links the files in your project.

6.6 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 target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target.

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

6.8 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.
49

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.

6.9 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 data base. Just select the microcontroller 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.

6.10 Building Projects and Creating a HEX Files


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.

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

6.12 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
50

components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.

6.13 Start Debugging


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.

6.14 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. Numerous example programs are included to help you get started with the most popular embedded 8051 devices.

51

The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART, SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device. Simulation helps you understand hardware configurations and avoids time wasted on setup problems. Additionally, with simulation, you can write and test applications before target hardware is available.

6.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment, aerospace systems and defense systems is widespread, and even everyday domestic appliances such as dish washers, televisions, washing machines and video recorders now include at least one such device. Because most embedded projects have severe cost constraints, they tend to use low-cost processors like the 8051 family of devices considered in this book. These popular chips have very limited resources available most such devices have around 256 bytes (not megabytes!) of RAM, and the available processor power is around 1000 times less than that of a desktop processor. As a result, developing embedded software presents significant new challenges, even for experienced desktop programmers. If you have some programming experience - in C, C++ or Java - then this book and its accompanying CD will help make your move to the embedded world as quick and painless as possible.

52

7.SCHEMATIC DIAGRAM

53

54

Fig 7: SCHEMATIC DIAGRAM

55

7.1 DESCRIPTION
POWER SUPPLY The circuit uses standard power supply comprising of a step-down transformer from 230Vto 12V and 4 diodes forming a Bridge Rectifier that delivers pulsating dc which is then filtered by an electrolytic capacitor of about 470F to 1000F. The filtered dc being unregulated, IC LM7805 is used to get 5V DC constant at its pin no 3 irrespective of input DC varying from 9V to 14V. The input dc shall be varying in the event of input ac at 230volts section varies in the ratio of V1/V2=N1/N2. The regulated 5V DC is further filtered by a small electrolytic capacitor of 10F for any noise so generated by the circuit. One LED is connected of this 5V point in series with a resistor of 330 to the ground i.e., negative voltage to indicate 5V power supply availability. The 12V point is used for other applications as on when required.

STANDARD CONNECTIONS TO MICRO CONTROLLER

ATMEL series of 8051 family of micro controllers need certain standard connections. The actual number of the Micro controller could be 89C51 , 89C52, 89S51, 89S52, as regards to 20 pin configuration a number of 89C2051. The 4 set of I/O ports are used based on the project requirement. Every micro controller requires a timing reference for its internal program execution therefore an oscillator needs to be functional with a desired frequency to obtain the timing reference as t =1/f. A crystal ranging from 2 to 20 MHz is required to be used at its pin number 18 and 19 for the oscillator. Typically 11.0592 MHz crystal is used in general for most of the circuits. Crystal provides the reference frequency only and it is not a crystal oscillator as miss understood by many but it oscillates at 11.0592MHz. Two small value ceramic capacitors of 33pF each is used as a standard connection for the crystal as shown in the circuit diagram.

56

RESET
Pin no 9 is provided with an RESET arrangement by a combination of an electrolytic capacitor and a register forming RC time constant. At the time of switch on, the capacitor gets charged, after charging it behaves as a full short circuit from the positive to the pin number 9.After the capacitor gets fully charged the current stops flowing and pin number 9 is pulled down by a 10k resistor to the ground. This arrangement of reset pin 9 going high initially and then to logic 0 i.e., low helps the program execution to start from the beginning. In absence of this the program execution could have taken place habitually anywhere from the program cycle.A pushbutton switch is connected across the capacitor so that at any given time as desired it can be pressed that discharges the capacitor and while released the capacitor starts charging again and then pin number 9 goes to high and then back to low, to enable the program execution from the beginning. This operation of high to low of the reset pin takes place in fraction of a second as decided by the time constant R and C. For example: A 10F capacitor and a 10k resistor would render a 100ms time to pin number 9 from logic high to low, there after the pin number 9 remains low.

57

OPERATION EXPLANATION CONNECTIONS:


Port0 P0.0 to P0.5 pins of MC are connected to pin2 of five opto-isolators respectively. Pin 5 of U1 is connected to pin2 of U7 and pin 5 of U2 is connected to pin3 of U7. Pin 5 of U3 is connected to pin2 of U8 and pin 5 of U4 is connected to pin3 of U8. U3 are connected to pin 2 of U7 & U8 resp. pin 4 of U1, U2, U3, U4, U5, U6, U7, U8, & U9. Pin1 of U1, U2, U3, U4, U5, U6 are connected to Vcc. Pins 7 & 5 of U7 are connected to gates of MOSFET Q1 & Q4 through a diode respectively.

WORKING:
This project basically comprises of a 3-ph inverter where fundamental sine wave is compared to develop pulse width modulated signals so generated by a program written onto the microcontroller. This output is fed to a set of six opto-isolators, U1 to U6 (MCT2E) from one of the ports of the MC i.e., PORT-0 from pin no. 34 to 39. The objective of using opto-isolator is to achieve galvanic isolation between the low voltage control circuit to the high voltage power circuits comprising of six nos of power switches such as MOSFETs Q1 to Q6 (IRF730), 3 for the top bank and balance 3 for the bottom bank. Snubber circuits comprising of resistors (R21R26), diodes (D25-D30) and capacitors (C11-C16) are provided across the drain, source of each of the MOSFET to take care of the inductive loads. The bottom bank source of MOSFET has ground reference. Therefore driving them through control signal is easy. However driving the top three it is difficult as they have no ground reference. In order to overcome such problem 3 nos of driver ICs U7, U8, U9 (IR2101) are used, each driver handling a pair of power switches in complementary mode to make sure that both of the power switches do not conduct simultaneously which would otherwise cause a short circuit of the DC power fed to the bank. Boot strap capacitors C5, C7 & C9 in combination with D1, D2 & D3 of the circuit. The high voltage DC power is derived directly from 230V AC source after rectification by a power bridge rectifier duly filtered by capacitors. The control power requirement is achieved by small low power transformers, bridge rectifier and the filter capacitor in the level of 12V to 15V range. MC power requirement of 5V is derived from the 12V source. Three phase output is taken from the junction points of top MOSFETs source and the bottom MOSFETs drain.
58

8. LAYOUT DIAGRAM

59

FIG 8: LAYOUT

60

9. BILL OF MATERIALS
COMPONENT NAME Resistors
330R 10K 1K 470R 33K 15K 47R 100R/2W

QUANTITY
1 13 7 6 2 4 18 6

Capacitors

470uF 10uF 2.2uF 33pF 0.1uF 0.1uF/1000V 0.1uF/400V 100uF/400V

2 5 3 2 4 7 1 4

Integrated Circuits
7805 AT89S52 MCT2E IR2101 1 1 6 3

IC Bases

40 Pin BASE 06 Pin BASE 08 Pin BASE

1 6 3

Transistors
IRF730

Diodes
1N4007 1N4148 BA159 16V ZENER DIODE RED-LED 17 6 6 6 4

Miscellaneous

CRYSTAL 11.0592MHz TRANSFORMER 0-12V POWER CORD HEAT SINK SCREW NUT FOR HEAT SINK

1 2 1 1 1

61

MALE BERGE 2-PIN FEMALE BERGE 2-PIN 2-PIN PUSH BUTTON MALE BERGE 8-PIN MALE RELEMENT 3-PIN FEMALE RELEMENT TWO SIDED 3-PIN FEMALE RELEMENT TWO SIDED 8-PIN FUSE CARRIER FUSE ___ AMP PCB CONNECTOR 3-PIN

2 2 1 2 2 1 1 2 2 4

100W BULB 100W BULB HOLDER THREE PHASE MOTOR ASSEMBLED PCB (WORKING) PLAIN PCB ZERO BOARD SOLDERING IRON CUTTER MULTIMETER SCREW DRIVER SOLDERING LED (50 gm) CONNECTING WIRE RIBBON WIRE FOR ZERO BOARD CD DVD

1 1 1 1 1 1 1 1 1 1

1 1

62

10. CODING
10.1 SOURCE CODE

1. 2.

Click on the Keil Vision Icon on Desktop The following fig will appear

3. 4.

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

63

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.


64

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

10. 11.

Then Click on OK The Following fig will appear


65

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.

66

15.

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

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 EMBEDDED C or ASM. For a program written in Assembly, then save it with extension . asm and for EMBEDDED C based program save it with extension .C
67

19.

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

68

20.

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

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.

69

24. 25.

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

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.

70

29. 30.

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

71

10.2 SOURCE CODE

#include<reg52.h>

//header file

sbit sbit sbit sbit sbit sbit

SW1 = P0^0; SW2 = P0^5; SW3 = P0^1; SW5 = P0^2; SW6 = P0^4; SW4 = P0^3;

void sector1(); void sector2(); void sector3(); void sector4(); void sector5(); void sector6();

void delay_10us(unsigned char time) { unsigned char i; for(i=0;i<time;i++) { TMOD |= 0x01; // select timer0 in mode1 mode

TH0 = 0xFF; // load timer0 high count


72

TL0 = 0xF7; //load timer0 low count TR0 = 1; while(TF0 == 0); TF0 = 0; TR0 = 0; } } void delay_555us() { TMOD |= 0x01; TH0 = 0x1F; TL0 = 0xD6; TR0 = 1; while(TF0 == 0); TF0 = 0; TR0 = 0; } void delay_280us() { TMOD |= 0x01; TH0 = 0x4E; TL0 = 0x69; TR0 = 1; while(TF0 == 0); TF0 = 0; TR0 = 0; // select timer0 in mode1 mode // load timer0 high count //load timer0 low count //start the timer0 //wait here till the timer overflows //clear the timer0 overflow flag //stop the timer0
73

//start the timer0 //wait here till the timer overflows //clear the timer0 overflow flag //stop the timer0

// select timer0 in mode1 mode // load timer0 high count //load timer0 low count //start the timer0 //wait here till the timer overflows //clear the timer0 overflow flag //stop the timer0

void main() { P0 = 0xff; // t1=1ms,t2=1ms,t0=1.3,t0/2=650us

while(1) { sector1(); sector2(); sector3(); sector4(); sector5(); sector6(); } } //call sector1 function //call sector2 function //call sector3 function //call sector4 function //call sector5 function //call sector6 function

void sector1() {

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//sector1 start

delay_280us();

SW1 = SW6 = SW2 = 0;


74

SW3 = SW5 = SW4 = 1;

delay_555us();

SW1 = SW3 = SW2 = 0; SW4 = SW5 = SW6 = 1;

delay_555us();

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

delay_280us();

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

delay_280us();

SW1 = SW3 = SW2 = 0; SW5 = SW4 = SW6 = 1;

delay_555us();

SW1 = SW6 = SW2 = 0; SW3 = SW5 = SW4 = 1;


75

delay_555us();

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

delay_280us();

//sector1 end

void sector2() { SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1; //sector2 start

delay_280us();

SW3 = SW4 = SW2 = 0; SW1 = SW5 = SW6 = 1;

//switch ON the Q3,Q4,Q2 transistors //switch OFF the Q1,Q5,Q6 transistors

delay_555us();

SW1 = SW3 = SW2 = 0; SW4 = SW5 = SW6 = 1;

//switch ON the Q1,Q3,Q2 transistors //switch OFF the Q4,Q5,Q6 transistors

delay_555us();
76

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

//switch ON the Q1,Q3,Q5 transistors //switch OFF the Q2,Q4,Q6 transistors

delay_280us();

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

//switch ON the Q1,Q3,Q5 transistors //switch OFF the Q2,Q4,Q6 transistors

delay_280us();

SW1 = SW3 = SW2 = 0; SW5 = SW4 = SW6 = 1;

//switch ON the Q3,Q1,Q2 transistors //switch OFF the Q4,Q5,Q6 transistors

delay_555us();

SW3 = SW4 = SW2 = 0; SW1 = SW5 = SW6 = 1;

//switch ON the Q3,Q4,Q2 transistors //switch OFF the Q1,Q5,Q6 transistors

delay_555us();

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//switch ON the Q6,Q4,Q2 transistors //switch OFF the Q1,Q5,Q3 transistors

delay_280us();

//sector2 end

77

void sector3() { SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1; //sector3 start

delay_280us();

//T0/2

SW3 = SW4 = SW2 = 0; SW1 = SW5 = SW6 = 1;

//switch ON the Q3,Q4,Q2 transistors //switch OFF the Q1,Q5,Q6 transistors

delay_555us();

//T1

SW3 = SW5 = SW4 = 0; SW1 = SW6 = SW2 = 1;

//switch ON the Q3,Q4,Q5 transistors //switch OFF the Q1,Q2,Q6 transistors

delay_555us();

//T2

SW1 = SW3 = SW5 = 1; SW4 = SW6 = SW2 = 0;

//switch OFF the Q3,Q1,Q5 transistors //switch ON the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW3 = SW5 = 1; SW4 = SW6 = SW2 = 0;

//switch OFF the Q3,Q1,Q5 transistors //switch ON the Q2,Q4,Q6 transistors


78

delay_280us();

//T0/2

SW3 = SW5 = SW4 = 0; SW1 = SW6 = SW2 = 1;

//switch ON the Q3,Q4,Q5 transistors //switch OFF the Q1,Q2,Q6 transistors

delay_555us();

//T2

SW3 = SW4 = SW2 = 0; SW1 = SW5 = SW6 = 1;

//switch ON the Q3,Q4,Q2 transistors //switch OFF the Q1,Q5,Q6 transistors

delay_555us();

//T1

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//switch ON the Q6,Q4,Q2 transistors //switch OFF the Q1,Q5,Q3 transistors

delay_280us();

//sector3 end

void sector4() { SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1; //sector4 start

delay_280us();

//T0/2
79

SW5 = SW4 = SW6 = 0; SW1 = SW3 = SW2 = 1;

//switch ON the Q5,Q4,Q6 transistors //switch OFF the Q1,Q2,Q3 transistors

delay_555us();

//T2

SW3 = SW5 = SW4 = 0; SW1 = SW6 = SW2 = 1;

//switch ON the Q3,Q4,Q5 transistors //switch OFF the Q1,Q2,Q6 transistors

delay_555us();

//T1

SW1 = SW3 = SW5 = 1; SW4 = SW6 = SW2 = 0;

//switch OFF the Q3,Q1,Q5 transistors //switch ON the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

//switch ON the Q3,Q1,Q5 transistors //switch OFF the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW3 = SW5 = SW4 = 0; SW1 = SW6 = SW2 = 1;

//switch ON the Q3,Q4,Q5 transistors //switch OFF the Q1,Q2,Q6 transistors

delay_555us();

//T1

80

SW5 = SW4 = SW6 = 0; SW1 = SW3 = SW2 = 1;

//switch ON the Q5,Q4,Q6 transistors //switch OFF the Q1,Q2,Q3 transistors

delay_555us();

//T2

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//switch ON the Q6,Q4,Q2 transistors //switch OFF the Q1,Q5,Q3 transistors

delay_280us();

//sector4 end

void sector5() { SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1; //sector5 start

delay_280us();

//T0/2

SW5 = SW4 = SW6 = 0; SW1 = SW3 = SW2 = 1;

//switch ON the Q5,Q4,Q6 transistors //switch OFF the Q1,Q2,Q3 transistors

delay_555us();

//T1

SW1 = SW5 = SW6 = 0; SW3 = SW4 = SW2 = 1;

//switch ON the Q1,Q5,Q6 transistors //switch OFF the Q2,Q4,Q3 transistors


81

delay_555us();

//T2

SW1 = SW3 = SW5 = 1; SW4 = SW6 = SW2 = 0;

//switch OFF the Q3,Q1,Q5 transistors //switch ON the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

//switch ON the Q3,Q1,Q5 transistors //switch OFF the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW5 = SW6 = 1; SW3 = SW4 = SW2 = 0;

//switch OFF the Q1,Q5,Q6 transistors //switch ON the Q2,Q4,Q3 transistors

delay_555us();

//T1

SW5 = SW4 = SW6 = 0; SW1 = SW3 = SW2 = 1;

//switch ON the Q6,Q4,Q5 transistors //switch OFF the Q1,Q2,Q3 transistors

delay_555us();

//T2

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//switch ON the Q6,Q4,Q2 transistors //switch OFF the Q1,Q5,Q3 transistors

82

delay_280us();

//sector4 end

} void sector6() { SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1; //sector6 start

delay_280us();

//T0/2

SW1 = SW6 = SW2 = 0; SW3 = SW5 = SW4 = 1;

//switch ON the Q6,Q1,Q2 transistors //switch OFF the Q4,Q5,Q3 transistors

delay_555us();

//T2

SW1 = SW5 = SW6 = 0; SW3 = SW4 = SW2 = 1;

//switch ON the Q1,Q5,Q6 transistors //switch OFF the Q2,Q4,Q3 transistors

delay_555us();

//T1

SW1 = SW3 = SW5 = 0; SW4 = SW6 = SW2 = 1;

//switch ON the Q3,Q1,Q5 transistors //switch OFF the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW3 = SW5 = 1;

//switch OFF the Q3,Q1,Q5 transistors


83

SW4 = SW6 = SW2 = 0;

//switch ON the Q2,Q4,Q6 transistors

delay_280us();

//T0/2

SW1 = SW5 = SW6 = 0; SW3 = SW4 = SW2 = 1;

//switch ON the Q1,Q5,Q6 transistors //switch OFF the Q2,Q4,Q3 transistors

delay_555us();

//T1

SW1 = SW6 = SW2 = 0; SW3 = SW5 = SW4 = 1;

//switch ON the Q6,Q1,Q2 transistors //switch OFF the Q4,Q5,Q3 transistors

delay_555us();

//T2

SW4 = SW6 = SW2 = 0; SW1 = SW3 = SW5 = 1;

//switch ON the Q6,Q4,Q2 transistors //switch OFF the Q1,Q5,Q3 transistors

delay_280us();

//sector6 end

84

11. SIMULATED RESULT

FIG. 9

85

86

87

88

12.CONCLUSION

From the above project it can be concluded that , a three phase induction motor can be run on a single phase AC supply by the implementation of the SPACE VECTOR PULSE WIDTH MODULATION technique.

This project can be further developed for the speed control of the induction motor i.e complete VECTOR CONTROL along with the reduction of the total harmonic distortion i.e; THD of the motor. Also, the THD ( total harmonic distortion ) of the motor can be compared for sinusoidal PWM and Space Vector PWM.

89

90

13.REFERENCES
TEXT BOOKS REFERED:
1. Muhammad Ali Mazidi and Janice Gillispie Mazidi, The 8051 Microcontroller and Embedded systems Pearson Education. 2. ATMEL 89S52 Data Sheets. 3 Bimal K Bose Modern Power Electronics & AC Drives Prentice Hall PTR,2002 4. R.Krishnan "Electric Motor Drives-Modelling,Analysis and Control" ,Prentice Hall of India Private Limited, New Delhi,2005 5 K. Vinoth Kumar "Simulation and comparison of SPWM and SVPWM control for three phase inverter" Karunya University, Tamil Nadu,India. 6. Professor V. Somashekhar, " Multilevel Inverter configuration for open end winding induction motor" by NIT, Warangal,

WEBSITES
www.scribd.com www.atmel.com www.beyondlogic.org www.wikipedia.org www.howstuffworks.com www.alldatasheets.com
91

92

You might also like