Top Banner
CHAPTER 1: INTRODUCTION Automation and precise control has become a necessity in most industries. By incorporating automation in processes, industries enjoy greater quality, increased production and control and decreased costs and labour. The need for controlling motors has been a pressing one as there are numerous applications that run on motors. Also, the need to incorporate several features in a single machine requires that we are able to run a particular motor at several speeds and in several different modes. Prior to the development of Power Electronic devices and the Micro Controller, it was very difficult to manage the variable speed in any application. However, nowadays, the long and cumbersome set up required to achieve the control has been transformed into few power devices and a microcontroller. Reliability and efficiency have also increased and such a process is aptly suited for the stringent demands of today’s industries. DC Motors provide high starting torque and can be used over a wide range of applications. The speed control methods of DC Motors are much simpler than those of AC Motors, in addition to this; DC Motors are also less expensive. The conventional approach for speed control is the phase control method but this method has been discarded because it generates too many harmonics and has 1
145
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: FQC

CHAPTER 1: INTRODUCTION

Automation and precise control has become a necessity in most industries. By

incorporating automation in processes, industries enjoy greater quality, increased

production and control and decreased costs and labour. The need for controlling

motors has been a pressing one as there are numerous applications that run on motors.

Also, the need to incorporate several features in a single machine requires that we are

able to run a particular motor at several speeds and in several different modes.

Prior to the development of Power Electronic devices and the Micro Controller, it was

very difficult to manage the variable speed in any application. However, nowadays,

the long and cumbersome set up required to achieve the control has been transformed

into few power devices and a microcontroller. Reliability and efficiency have also

increased and such a process is aptly suited for the stringent demands of today’s

industries.

DC Motors provide high starting torque and can be used over a wide range of

applications. The speed control methods of DC Motors are much simpler than those of

AC Motors, in addition to this; DC Motors are also less expensive. The conventional

approach for speed control is the phase control method but this method has been

discarded because it generates too many harmonics and has lower power factor at

decreased speeds. Therefore, the microprocessor based IGBT switching technique is

employed. Pulse Width Modulation technique is also employed to control the speed of

the motor through duty cycle variations.

In our project armature of the DC Motor is excited by a variable dc supply

obtained from four-quadrant chopper. The motor is a 1500 rpm, 0.5 KW Shunt Motor

and four IGBTs along with Optocouplers are employed. The motor is controlled using

the ATMEL AT89S52 Microcontroller. The system is provided with various control

keys, such as START, STOP, REVERSE MOTORING, REVERSE BRAKE,

FORWARD MOTORING, FORWARD BRAKE, INCREMENT and DECREMENT.

Using these keys, the user can set the motor to run in any one of the following modes,

namely Forward motoring, Reverse motoring, Forward braking and reverse braking.

The speed can be varied by varying the voltage given to the PWM converter (using

keypad).1

Page 2: FQC

Moreover, the system is provided with Soft start facility i.e., starting the

motor without allowing the armature current to exceed the full load current. The

Hardware of this system includes uncontrolled rectifier using diodes, chopper

using IGBT’S, control keys, speed adjust potentiometer and other logical circuits.

2

Page 3: FQC

CHAPTER 2: LITERATURE SURVEY

2.1 Principle of DC Motor

Basics:

Like any other electric motor, a DC motor converts electrical energy into mechanical

energy. A DC motor works on the simple principle that whenever a current carrying

conductor is placed in a magnetic field, a mechanical force is experienced by the

conductor. [1]

The magnitude of the mechanical force is dependent upon the formula

F = B Ic lc (1)

Where B is the magnetic field strength in Teslas (Weber/m2), Ic is the current flowing

through the conductor and lc is the length of the conductor in metres. [1]

The direction of the magnetic field is given by using Fleming’s left hand rule. It states

that if the first finger represents the direction of magnetic field and the second finger

represents the direction of conventional current, then the direction of the thumb

indicates the direction of the resultant motion. [2]

Contrary to the principle of motor, when a current carrying conductor is made to

move in a magnetic field, an EMF is induced in it. The direction of this EMF known

as the Back EMF is such that it is opposite to the applied voltage. In other words,

relative motion between armature of the motor and external magnetic field produce

Back EMF.

The Back EMF is given by the formula

Eb = ΦZN/60 * P/A (2)

Where Eb is the Back EMF in volts, Φ is the flux per pole in Weber, Z is the number

of armature conductors, N is the speed, P is the number of poles and A is the number

of parallel paths. [1]

The direction of induced EMF is obtained from Lenz’s law, which states that an

induced EMF or current is always in opposition to the cause that produces it. [2]

3

Page 4: FQC

The applied voltage V must be large enough to balance both the voltage drop in the

armature resistance and the Back EMF at all times.

V = Eb + Ia Ra (3)

Where Eb is the induced EMF in the armature by the generator action also known as

the Back EMF, Ia is the armature current and Ra is the armature resistance.

The induced EMF depends upon the armature speed in a DC motor. If the armature

speed is high, the back EMF will be large and hence armature current is small. On the

other hand, if the speed of the armature is low, then back EMF will be less, armature

current will be more which eventually results in the development of a large torque. [1]

Types of DC Motors:

All DC motors have two types of windings namely the field and the shunt windings.

Based on how these two windings are connected motors can be classified as either

series motor, shunt motor or separately excited motor. The series and shunt motors are

not appropriate for speed control because of their limitations and therefore we use

separately excited DC machines. In a separately excited DC motor, armature and field

coils are fed from different supply sources and therefore may have different voltage

ratings. [1]

We use the voltage and flux field control to give increased ability to drive

requirements.

In a general drive system, both active and passive torques are present, therefore the

motor may operate in different regimes. Before we understand the operation of the

motor in two and four quadrants, we need to analyse the active and passive torques.

Active torques are due to either gravitational forces or deformation in elastic bodies

and continues to act in the same direction irrespective of the direction of the

movement of the drive.

Passive torques are due to friction or due to shear and deformation in inelastic bodies

and always opposes the motion retarding the rotation of the driven machine.

4

Page 5: FQC

Two Quadrant Operation of Motor

In the two quadrant operation of an electric motor, the motor operates in forward

motoring mode and in regenerative braking mode.

Forward Motoring Mode:

This is the simple process in which electric motor is switched to electric supply mains

and in this mode mechanical device like line shafts, machine tools, gear systems etc

are operated.

Reverse Braking Mode:

For an electric motor to be stopped, brakes are to be applied. In this mode, the motor

begins to operate as a generator and the kinetic energy of the motor and the load

coupled to it is converted into electrical energy. A part of this electrical energy is

returned to supply and the remaining part is lost as heat in the windings and bearings

of electrical machines. In this mode, the armature current and induced EMF in the

motor is in the same direction but both are in opposition to the supply voltage. The

electromagnetic torque developed is in the direction opposite to that of rotation of

armature. [1]

Fig 2.1 Two Quadrant Operation of Motor

5

Page 6: FQC

Four Quadrant Operation of Motor

The motor will act as a motor for specific periods and will also act as a generator at

other times. There are also instances in which the motor might act as a brake. There

are several applications in which motor may be required to run in both directions.

Therefore, in sketching the speed torque characteristics of the motor or the load, it is

preferable to make use of all the four quadrants of the speed torque plane for plotting

rather than simply confining into first quadrant operation. [1]

Conventions used in the study of the four quadrant chopper:

The speed is assumed to have a positive sign, if the direction of rotation is counter

clockwise or is in such a way to cause an upward or forward motion of the drive. In

case of reversible drives, the positive sign for speed may have to be assigned

arbitrarily either to counter clockwise or clockwise for rotation. The motor torque is

taken to be positive when it causes an increase in speed in the positive sense. The load

torque is assigned a positive sign when it acts against the motor torque.

The field polarity is maintained and the armature current is reversed to obtain

negative torque, the same effect is obtained by reversing the field polarity and

maintaining the armature current direction. Field reversal is necessary with some

forms of rectifier control. These four quadrants of operation are feasible for any DC

or AC rotating machine but the DC machine is much freer to transfer its operation

between quadrants and operates satisfactorily at any point within the envelope.

The four modes of operation of a DC motor are discussed hereunder:

Forward Motoring Mode:

In the forward motoring mode of operation, armature current flows in opposition to

the EMF induced in the armature. The direction of EMF induced in the armature is in

direct opposition to the applied voltage. The torque developed is in the direction of

armature rotation.

6

Page 7: FQC

Regenerative Braking Mode:

In this mode the motor is made to operate as a generator and the kinetic energy of the

motor and load coupled to it is converted in to electrical energy, part of which is

returned to the supply and rest of the energy is lost as heat in the windings and

bearings of electrical machines. The armature current and induced EMF in the motor

is in the same direction but in opposition to supply voltage. The torque developed is in

direction opposite to that of rotation of armature.

Reverse Motoring Mode:

In this mode the motor is made to operate as generator and the kinetic energy of the

motor is converted into electrical energy. This electrical energy is dissipated in

braking resistance connected to the terminals. When the chopper is turned on by a

gate pulse, the kinetic energy is partly dissipated in armature resistance and partly

stored in armature inductance. When chopper is turned off, the energy stored in

inductance is transferred to braking resistance and dissipated as heat.

Reverse Generating Mode:

Reverse generating mode is feasible only if motor generated emf is made to exceed

the dc source voltage.

7

Page 8: FQC

Fig 2.2 Four Quadrant Operation of Motor

8

Page 9: FQC

2.2 Thyristors and their usage for switching

To switch between different modes of the four quadrant operation, chopper circuit is

employed. Several power devices are available which can be used as a switch in the

chopper circuit.

An ideal power semiconductor switch has zero conduction drops, zero leakage current

at OFF condition, and turns ON and OFF instantaneously. Such a device is lossless

and therefore the chopper efficiency tends to be 100%. However practically, devices

have loses and also several other issues which hinder the working of the project. [5]

The main problem in practical switching is the generation of harmonics on the load

and source lines. The present state of power electronics has evolved technologically

over a considerable period of time. The most obvious is the PNPN triggering

transistor also known as the thyristor. In theory, power electronic apparatus are

basically ON and OFF switches; practical devices are far more complex and fragile.

[4]

There are several options which can be used as a switch in the chopper circuit. Each

of these and their possible reasons to use/omit are discussed hereunder:

i. Thyristor:

The thyristor or SCR is the main component in power electronics. It can be

turned on by positive gate current pulses. The device cannot be turned off

using negative gate pulse however. The working of the thyristor can be

understood as a regenerative feedback configuration of the component PNP

and NPN transistors. [3]

The problem with a thyristor circuit is that it needs a Snubber circuit. The

Snubber is used to protect the device from voltage transients; it also limits the

anode di/dt effect and also reduces the off state and reapplied anode dv/dt. For

the device to carry greater currents, it needs to have cooling. [3]

9

Page 10: FQC

Fig 2.3 SCR

Thyristors find applications in electrochemical processes, lighting and heating

control, welding, HVDC, static VAR compensation and solid state breaker

circuits.

ii. Gate Turn Off (GTO) Thyristor:

This is a slight improvement over the conventional SCR thyristor. It has the

ability to be turned off by using negative current pulse. However the turn off

current gain is low. Minority carrier lifetime control and shorted anode

construction are frequently used to reduce the turn off time. The turns off

characteristics are very similar to that of the thyristor but slightly more

complex. [4]

The main problem with a GTO is that during the steep fall time of the anode

current, even a very small leakage inductance in the Snubber will create an

anode spike voltage that will tend to cause a second breakdown failure. [3] In

addition, there is also excessive power dissipation because of large anode tail

current during device voltage build up. Therefore, GTO circuits need to be

designed with large Snubbers to avoid these problems.

Because of high Snubber loss in GTO, the switching frequency is usually

restricted to 1 or 2 KHz.[4]

10

Page 11: FQC

Fig 2.4 GTO Thyristor

GTOs are used in DC and AC machine drives, uninterruptable power supply

systems (UPS), static VAR compensators etc.

iii. Power Transistor:

A power Bipolar Junction Transistor (BJT) is a two junction self controlled

device where the collector current is under the control of base drive current.

Basically, it is a linear device that is operated in the switching mode and fault

over current can be suppressed by base drive control. Generally the current

gain for power transistor is low and varies widely with collector current and

temperature. [3]

In power transistors, in addition to avalanche breakdown, there is also a

second breakdown effect. The collector current is switched ON. There is

crowding at the base emitter junction periphery, thus constricting the collector

current in a narrow area of reverse biased collector junction. [3]

11

Page 12: FQC

Fig 2.5 Power Transistor

The main disadvantage is that the rise in junction temperature at the hotspot

accentuates the current concentration due to negative temperature co-efficient

of the drop and this regeneration effect causes collapse of collector voltage

hereby destroying the device. A similar problem arises when an inductor load

is turned OFF.

iv. Power MOSFET:

The Power MOSFET is a voltage controlled, zero junction majority carrier

devices. The GATE impedance is extremely high at steady state but the

effective GATE SOURCE capacitance demands a pulse current during fast

TURN ON and TURN OFF. The device is basically linear with asymmetrical

blocking capability and as an integral diode that can carry full current in

reverse direction. [3]

Power MOSFETs are characterized by slow recovery and is often by-passed

by external fast recovery diodes in high frequency applications. Even though,

12

Page 13: FQC

the switching loss is very less because TURN ON and TURN OFF times are

very small, it has a major disadvantage of higher conduction drop. Also, the

device power dissipation can be high on short duty cycle. [3]

Figure 2.6 Power MOSFET

In the above diagram, ’G’ stands for GATE,’D’ for DRAIN and ‘S’ for

SOURCE.

Power MOSFETs are extremely popular in low voltage , low power and high

frequency switching circuits such as Brushless DC Motor(BLDC) drives,

solid state DC relay and other automobile applications.

v. Insulated Gate Bi-polar Transistor:

An IGBT is preferred over all other thyristors because it combines the

attributes of MOSFET, BJT and Thyristors. For the sake of understanding, we

refer to the n channel IGBT. The operation of a p channel IGBT is also very

similar. [3]

13

Page 14: FQC

Fig 2.7 Structure of an IGBT

Structure:

The structure is very similar to that of a vertically diffused MOSFET featuring a

double diffusion of a p-type region and an n-type region. An inversion layer can be

formed under the gate by applying the correct voltage to the gate contact as with a

MOSFET. The main difference is the use of a p+ substrate layer for the drain. The

effect is to change this into a bipolar device as this p-type region injects holes into the

n-type drift region. [3]

Operation:

Blocking Operation

The on/off state of the device is controlled, as in a MOSFET, by the gate voltage VG.

If the voltage applied to the gate contact, with respect to the emitter, is less than the

14

Page 15: FQC

threshold voltage Vth then no MOSFET inversion layer is created and the device is

turned off. When this is the case, any applied forward voltage will fall across the

reversed biased junction J2. The only current to flow will be a small leakage current.

[3]

The forward breakdown voltage is therefore determined by the breakdown voltage of

this junction. This is an important factor, particularly for power devices where large

voltages and currents are being dealt with. The breakdown voltage of the one-sided

junction is dependent on the doping of the lower-doped side of the junction, i.e. the n-

side. This is because the lower doping results in a wider depletion region and thus a

lower maximum electric field in the depletion region. It is for this reason that the n-

drift region is doped much lighter than the p-type body region. The device that is

being modelled is designed to have a breakdown voltage of 600V.[3]

The n+ buffer layer is often present to prevent the depletion region of junction J2 from

extending right to the p bipolar collector. The inclusion of this layer however

drastically reduces the reverse blocking capability of the device as this is dependent

on the breakdown voltage of junction J3, which is reverse, biased under reverse

voltage conditions. The benefit of this buffer layer is that it allows the thickness of the

drift region to be reduced, thus reducing on-state losses.

On-state Operation

The turning on of the device is achieved by increasing the gate voltage VG so that it is

greater than the threshold voltage Vth. This results in an inversion layer forming under

the gate which provides a channel linking the source to the drift region of the device.

Electrons are then injected from the source into the drift region while at the same time

junction J3, which is forward biased, injects holes into the n- doped drift region. [3]

15

Page 16: FQC

Fig 2.8 Internal hole and electron flow in the IGBT while in on state

This injection causes conductivity modulation of the drift region where both the

electron and hole densities are several orders of magnitude higher than the original n -

doping. It is this conductivity modulation which gives the IGBT its low on-state

voltage because of the reduced resistance of the drift region. Some of the injected

holes will recombine in the drift region, while others will cross the region via drift and

diffusion and will reach the junction with the p-type region where they will be

collected. The operation of the IGBT can therefore be considered like a wide-base pnp

transistor whose base drive current is supplied by the MOSFET current through the

channel. If the current flowing through this resistance is high enough it will produce a

voltage drop that will forward bias the junction with the n+ region turning on the

parasitic transistor which forms part of a parasitic thyristor. Once this happens there is

16

Page 17: FQC

a high injection of electrons from the n+ region into the p region and all gate control is

lost. This is known as latch up and usually leads to device destruction. [3]

17

Page 18: FQC

2.3 Regulated Power Supply

The IGBTs, ICs and the Microcontrollers require DC supply, but commonly available

supply is in AC and therefore, we need to convert the existing AC supply to DC. We

have our usual 220 V single phase supply which needs to be converted to a DC

supply. The components required for the Regulated Power Supply are discussed

hereunder:

Transformer:

The transformer is a device which converts AC electricity from one voltage to another

with little loss of power. Transformers work only with AC and this is one of the

reasons why mains electricity is AC. [1]

There are two types of transformers- step up and step down. Step-up transformers

increase in output voltage, step-down transformers decrease in output voltage. Most

power supplies use a step-down transformer to reduce the dangerously high mains

voltage to a safer low voltage.

Structure of the Transformer:

The transformer consists of two coils, primary and secondary. 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. The core is made up of soft iron or silicon steel

core and two windings placed on it. This core provides a path of low reluctance to

magnetic flux. The winding connected to the high voltage side is called high voltage

winding. The winding connected to the low voltage side is called low voltage

winding. [1]

18

Page 19: FQC

Fig 2.9 Structure of a Transformer

Operation of the transformer:

The action of a transformer is base don the principle that energy may be efficiently

transferred by induction from one set of coils to another by means of varying

magnetic flux, provided that both the set of coils are on a common magnetic circuit.

In a transformer, the coils and magnetic circuit are all stationary with respect to one

another. The emfs are induced by varying the magnetic flux with time. The current

flowing through the primary winding produces an alternating flux in the core. Since

this flux is alternating emf is induced in the secondary winding. Thus, the energy is

transformed from the primary winding to the secondary winding without any change

in frequency. There is also a self induced emf in the primary winding which opposes

the applied voltage and it is known as back emf of the primary.[1]

Transformers waste very little power so the power out is (almost) equal to the power

in. Note that as voltage is stepped down current is stepped up. The ratio of the

number of turns on each coil, called the turn’s 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. [1]

19

Page 20: FQC

The transformer reduces the primary high voltage AC to low voltage AC. After the

reduction of voltage, the AC voltage needs to be converted to DC. For this, we need

to use a rectifier.

Fig 2.10 Transformer

Formulae involved in Transformer Calculations:

Turns ratio = Vp/ VS = Np/NS

Power Out= Power In

VS X IS=VP X IP

Vp = primary (input) voltage

Np = number of turns on primary coil

Ip = primary (input) current

20

Page 21: FQC

Rectifier

A rectifier is a circuit which converts AC voltage to DC voltage. The process is

known as rectification. There are three very well known rectifier circuits which can be

employed namely the half wave rectifier, full wave rectifier and the bridge rectifier.

Half Wave Rectifier:

In the half wave single phase controlled rectifier, only one SCR is employed in the

circuit .It is included between AC source and load. The performance of controlled

rectifier very depends upon the type and parameters of the output circuit. [4]

The circuit is energised by the line voltage or transformer secondary voltage. It is

assumed that the peak supply voltage never exceeds the forward and reverse blocking

ratings of the thyristors. The single phase half wave controlled rectifier is operated

normally under resistive load or inductive load. During the positive half cycle of

supply voltage the thyristor anode is positive with respect to its cathode and until the

thyristor is triggered by a proper gate pulse it blocks the flow of load current in the

forward direction. When a thyristor is fired at an angle, full supply voltage is applied

to the load. In other words, the load is directly connected to the AC supply. During

the negative half cycle of the supply voltage, the thyristor blocks the flow of the load

current and no voltage is applied across the load. [4].

Fig 2.11 Half Wave controlled rectifier

21

Page 22: FQC

Many circuits, particularly those which are half or uncontrolled, include a diode

across the load which is described as the freewheeling diode, commutating diode or

the by-pass diode. This diode serves two main functions; firstly it prevents reversal of

load voltage except for small diode voltage drop. Secondly, it transfers the load

current away from the main rectifier thereby allowing all of its thyristors to regain

their blocking states. Freewheeling diodes help in improvement of the input power

factor of the system.

Full Wave Rectifier:

In a single phase full wave controlled rectifier, generally two types of converters are

employed based on the type of SCR configuration. These are mid-point converters

and bridge converters.

Midpoint converters: In a single phase full wave controlled rectifier circuit with

midpoint configuration, two SCRs and a single phase transformer with a centre tapped

secondary winding is employed. These converters are also referred to as two pulse

converters as two triggering pulses are generated during every cycle. These rectifiers

are used for low ratings. Similar to half wave rectifier resistive and inductive are

employed here also. When a purely resistive load is used, the load current is always

discontinuous. However, in case of RL load, the load current may be continuous or

discontinuous. The load current is continuous if the inductance value is greater than

its critical value and discontinuous otherwise. Due to large inductance in the circuit

and continuous current conduction, the thyristors continue to conduct even when there

anode voltages are negative with respect to the cathode [4].

The following diagram shows a Full Wave Mid Point Converter with just the resistive

load and at 110 V AC supply. However in, normal circumstances we give 220 V AC

supply and employ both Resistances and Inductances across the load.

22

Page 23: FQC

Fig 2.12 Full Wave Mid Point Converter

Bridge rectifier is an alternate arrangement of a two quadrant converter operating

from a single phase supply. The operation of the circuit is in principle similar to that

of two pulse midpoint configuration. [4].

Fig 2.13 Full Wave Bridge Circuit with Resistive Load

23

Page 24: FQC

In the bridge circuit, diagonally opposite pair of thyristors are made to conduct and

are commutated simultaneously. As can be observed from the diagram above SCRs

S1 and S2 are forward biased and if they are triggered simultaneously. Hence in

positive half cycle thyristors S1 and S2 are conducting.[4].

During the negative half cycle of the AC input, SCRs S3 and S4 are forward biased

and if they are triggered simultaneously. Thyristors S1,S2 and S3,S4 are triggered at

the same firing angle in each positive and negative half cycles of the supply voltage

respectively.[4].

When the supply voltage falls to zero, the current also goes zero. Thyristors T1, T2 in

positive half cycles and T3, T4 in negative half cycle turn OFF by natural

commutation.

Fig 2.14a Voltage Waveform across Load Resistor

24

Page 25: FQC

Fig 2.14bVoltage Waveform across SCR 1

Fig 2.14c Average Load Current

Fig 2.14 Waveform for Fully Controlled Bridge Rectifier with Resistive Load

25

Page 26: FQC

Two modes of operation are possible with fully controlled single phase bridge circuit.

These are rectifying mode and inverting mode. In the rectifying mode, power flows

from AC to DC and the converter acts as a rectifier. In the inverting mode, power is

now being delivered from DC side to the AC side and the converter is operating as a

line commutated inverter. [4]

Table 2.1 Rectifiers

Parameter

Type of Rectifier

Half wave Full wave Bridge

Number of diodes

1

2

4

PIV of diodes

Vm

2Vm

Vm

D.C output voltage

Vm/

2Vm/

2Vm/

Vdc,at

no-load

0.318Vm

0.636Vm 0.636Vm

Ripple factor

1.21

0.482

0.482

Ripple

frequency

f

2f

2f

Rectification

efficiency

0.406

0.812

0.812

Transformer

Utilization

Factor(TUF)

0.287 0.693 0.812

RMS voltage Vrms Vm/2 Vm/√2 Vm/√226

Page 27: FQC

Instead of thyristors, full wave rectifier can be achieved using diodes also. It is

already been established that the bridge rectifier is the most efficient. A bridge

rectifier makes use of four diodes in a bridge arrangement to achieve full-wave

rectification. This is a widely used configuration, both with individual diodes wired as

shown and with single component bridges where the diode bridge is wired internally.

A bridge rectifier makes use of four diodes in a bridge arrangement as shown

in Fig 2.13 to achieve full-wave rectification. This is a widely used configuration,

both with individual diodes wired as shown and with single component bridges where

the diode bridge is wired internally.

Fig 2.15 Bridge Rectifier

27

Page 28: FQC

Operation:

During positive half cycle of secondary, the diodes D2 and D3 are in forward biased

while D1 and D4 are in reverse biased as shown in the Fig 2.16. The current flow

direction is shown in the figure with dotted arrows.

Fig 2.16 Positive Half Cycle of Bridge Rectifier

During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward

biased while D2 and D3 are in reverse biased as shown in the Fig 2.17 The current

flow direction is shown in the figure with dotted arrows.

Fig 2.17 Negative Half Cycle of Bridge Rectifier

28

Page 29: FQC

Filters:

Need for filtering:

While the output of a rectifier is a pulsating dc, most electronic circuits require a

substantially pure dc for proper operation. This type of output is provided by single or

multi section filter circuits placed between the output of the rectifier and the load. We

have seen that the ripple content in the rectified output of half wave rectifier is 121%

or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages

of ripples is not acceptable for most of the applications. Ripples can be removed by

one of the following methods of filtering.

(a) A capacitor, in parallel to the load, provides an easier by –pass for the ripples

voltage though it due to low impedance. At ripple frequency and leave the D.C. to

appear at the load.

(b) An inductor, in series with the load, prevents the passage of the ripple current (due

to high impedance at ripple frequency) while allowing the d.c (due to low resistance

to d.c)

(c) Various combinations of capacitor and inductor, such as L-section filter section

filter, multiple section filter etc. which make use of both the properties mentioned in

(a) and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and

another with full wave rectifier.

Types of Filter Circuits:

Simple capacitor filter

LC choke-input filter

LC capacitor-input filter(pi-type)

RC capacitor-input filter(pi-type)

Working:

Filtering is accomplished by the use of capacitors, inductors, and/or resistors in

various combinations. Inductors are used as series impedances to oppose the flow of 29

Page 30: FQC

alternating (pulsating dc) current. Capacitors are used as shunt elements to bypass the

alternating components of the signal around the load (to ground). Resistors are used in

place of inductors in low current applications.

First, a capacitor opposes any change in voltage. The opposition to a change in current

is called capacitive reactance (XC) and is measured in ohms. The capacitive reactance

is determined by the frequency (f) of the applied voltage and the capacitance (C) of

the capacitor.

From the formula, we can see that if frequency or capacitance is increased, the

XC decreases. Since filter capacitors are placed in parallel with the load, a low XC will

provide better filtering than a high XC. For this to be accomplished, a better shunting

effect of the ac around the load is provided, as shown in figures.

Fig 2.18 Filer charging and discharging

To obtain a steady dc output, the capacitor must charge almost instantaneously to the

value of applied voltage. Once charged, the capacitor must retain the charge as long as

possible. The capacitor must have a short charge time constant (view A). This can be

30

Page 31: FQC

accomplished by keeping the internal resistance of the power supply as small as

possible (fast charge time) and the resistance of the load as large as possible (for a

slow discharge time as illustrated in view B).

Voltage Regulators:

A voltage regulator module or VRM, sometimes called PPM (processor

power module) is an electronic device that provides a microprocessor or a

microcontroller an appropriate supply voltage. It can be an installable device or

soldered to the required circuitry. It allows processors and microcontrollers with

different supply voltage to be mounted on the same circuit..

Some voltage regulators provide a fixed supply voltage to the processor, but most of

them sense the required supply voltage from the processor. The series of voltage

regulator that we are using is 78XX where 78 is the series and XX is the voltage value

required.

Fig 2.19 Internal Block Diagram of 78XX Voltage Regulator

31

Page 32: FQC

78XX:

The Bay Linear LM78XX is integrated linear positive regulator with three

terminals. The LM78XX offer several fixed output voltages making them useful in

wide range of applications. When used as a zener diode/resistor combination

replacement, the LM78XX usually results in an effective output impedance

improvement of two orders of magnitude, lower quiescent current. The LM78XX is

available in the TO-252, TO-220 & TO-263packages.

VRs are buck converters that convert from +5 V or +12 V to a much smaller voltage

required by the CPU or other devices like microcontrollers.

32

Page 33: FQC

2.4 Optocouplers

Description

There are many situations where signals and data need to be transferred from one

subsystem to another within a piece of electronics equipment, or from one piece of

equipment to another, without making a direct .Ohmic electrical connection. Often

this is because the source and destination are (or may be at times) at very different

voltage levels, like a microprocessor which is operating from 5V DC but being used

to control a triac which is switching 240V AC. In such situations the link between the

two must be an isolated one, to protect the microprocessor from overvoltage damage.

Relays can of course provide this kind of isolation, but even small relays tend to be

fairly bulky compared with ICs and many of today’s other miniature circuit

components. Because they are electro-mechanical, relays are also not as reliable and

only capable of relatively low speed operation. Where small size, higher speed and

greater reliability are important, a much better alternative is to use an Optocoupler.

The IC Diagram with the Pins and the Basic Schematic diagram of an Optocoupler is

shown hereunder followed by the explanation.

Fig 2.20 Optocoupler Pin Diagram and Schematic

33

Page 34: FQC

Working

These use a beam of light to transmit the signals or data across an electrical barrier,

and achieve excellent isolation. Optocouplers typically come in a small 6-pin or 8-pin

IC package, but are essentially a combination of two distinct devices: an optical

transmitter, typically a gallium arsenide LED (light-emitting diode) and an optical

receiver such as a phototransistor or light-triggered diac. The two are separated by a

transparent barrier which blocks any electrical current flow between the two, but does

allow the passage of light. The basic idea is shown in Fig along with the usual circuit

symbol for an Optocoupler.

Usually the electrical connections to the LED section are brought out to the pins on

one side of the package and those for the phototransistor or diac to the other side, to

physically separate them as much as possible. This usually allows Optocouplers to

withstand voltages of anywhere between 500V and 7500V between input and output.

Optocouplers are essentially digital or switching devices, so they are best for

transferring either on-off control signals or digital data. Analog signals can be

transferred by means of frequency or pulse-width modulation.

34

Page 35: FQC

2.5 Atmel AT89S52 Microcontroller

A Micro controller consists of a powerful CPU tightly coupled with memory,

various I/O interfaces such as serial port, parallel port timer or counter, interrupt

controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog

converter, integrated on to a single silicon chip.

If a system is developed with a microprocessor, the designer has to go for

external memory such as RAM, ROM, EPROM and peripherals. But controller is

provided all these facilities on a single chip. Development of a Micro controller

reduces PCB size and cost of design.

One of the major differences between a Microprocessor and a Micro controller

is that a controller often deals with bits not bytes as in the real world application.

In our application, we are using the ATMEL 89S52 Microcontroller.

Features of ATMEL 89S52:

• Compatible with MCS-51® Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

• Endurance: 1000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz

• Three-level Program Memory Lock

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Eight Interrupt Sources

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer

• Dual Data Pointer

35

Page 36: FQC

Description

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 Atmel’s 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, axis-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.

36

Page 37: FQC

Pin diagrams:

Pin diagrams are available in three formats (PDIP, PLCC, TQFP)

Fig 2.21 PDIP 89S52

37

Page 38: FQC

Fig 2.22 PLCC 89S52

Fig 2.23 TQFP 89S52

38

Page 39: FQC

Block Diagram of ATMEL 89S52

Fig 2.24 Atmel 89S52 Block Diagram

Pin Description39

Page 40: FQC

VCC

Supply voltage.

GND

GND is used to designate Ground.

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can

sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high

impedance inputs. Port 0 can also be configured to be the multiplexed low order

address/data bus during accesses to external program and data memory. In this mode,

P0 has internal pullups. Port 0 also receives the code bytes during Flash programming

and outputs the code bytes during program verification. External pullups are required

during program verification.

Port 1

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

can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled

high by the internal pullups and can be used as inputs. As inputs, Port 1 pins that are

externally being pulled low will source current (IIL) because of the internal pullups.

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), respectively, as

shown in the following table. Port 1 also receives the low-order address bytes during

Flash programming and verification.

Table 2.2 Atmel AR89S52 Port 1Pins and their alternate functions

40

Page 41: FQC

Port Pin Alternate Functions

P1.0 T2 (external count input to Timer/Counter

2),clock-out

P1.1 T2EX (Timer/Counter 2 capture/reload

trigger and direction control)

P1.5 MOSI (used for In-System Programming)

P1.6 MISO (used for In-System Programming

P1.7 SCK (used for In-System Programming)

Port 2

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

can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled

high by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are

externally being pulled low will source current (IIL) because of the internal pullups.

Port 2 emits the high-order address byte during fetches from external program

memory and during accesses to external data memory that uses 16-bit addresses

(MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when

emitting 1s. During accesses to external data memory that uses 8-bit addresses

(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2

also receives the high-order address bits and some control signals during Flash

programming and verification.

Port 3

41

Page 42: FQC

Port 3 is an 8-bit bidirectional I/O port with internal pullups. The Port 3 output buffers

can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled

high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are

externally being pulled low will source current (IIL) because of the pullups. Port 3

also serves the functions of various special features of the AT89S52, as shown in the

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

verification.

Table 2.3 Atmel AR89S52 Port 3 Pins and their alternate functions

Port Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 RD (external data memory read strobe)

RST

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

resets the device. This pin drives High for 96 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

42

Page 43: FQC

Address Latch Enable (ALE) is an output pulse for latching the low byte of the

address during accesses to external memory. This pin is also the program pulse input

(PROG) during Flash programming. In normal operation, ALE is emitted at a constant

rate of 1/6 the oscillator frequency and may be used for external timing or clocking

purposes. Note, however, that one ALE pulse is skipped during each access to

external data memory. If desired, ALE operation can be disabled by setting bit 0 of

SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC

instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has

no effect if the microcontroller is in external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When

the 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

EA stands for 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

Special Function Registers43

Page 44: FQC

A map of the on-chip memory area called the Special Function Register (SFR) space

is shown in Table.

Note that not all of the addresses are occupied, and unoccupied addresses may not be

implemented on the chip. Read accesses to these addresses will in general return

random data, and write accesses will have an indeterminate effect. User software

should not write 1s to these unlisted locations, since they may be used in future

products to invoke new features. In that case, the reset or inactive values of the new

bits will always be 0.

Timer 2 Registers: Control and status bits are contained in registers T2CON (shown in

Table 2) and T2MOD (shown in Table 3) for Timer 2. The register pair (RCAP2H,

RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit

auto-reload mode.

Interrupt Registers: The individual interrupt enable bits are in the IE register. Two

priorities can be set for each of the six interrupt sources in the IP register.

T2CON – Timer/Counter 2 Control Register

• T2CON Address = 0C8H

• Reset Value = 0000 0000B

• Bit Addressable

• 8-bit counter

Table 2.4 Bits of T2CON

TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2 CP/RL2

7 6 5 4 3 2 1 0

Table 2.5 Description of each bit of T2CON Timer

44

Page 45: FQC

Symbol Function

TF2 Timer 2 overflow flag set by a Timer 2 over flow and must be cleared by software. TF2 will not be set when either RCLK = 1 or TCLK = 1.

EXF2 Timer 2 external flag set when either a capture or reload is caused by a

negative transition on T2EX and EXEN2 = 1.When Timer 2 interrupt is

enabled, EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt

routine. EXF2 must be cleared by software. EXF2 does not cause an

interrupt in up/down counter mode (DCEN = 1).

RCLK Receive clock enable. When set, causes the serial port to use Timer 2

overflow pulses for its receive clock in serial port Modes 1 and 3.

RCLK = 0 causes Timer 1 overflow to be used for the receive clock.

TCLK Transmit clock enable. When set, causes the serial port to use Timer 2

overflow pulses for its transmit clock in serial port Modes 1 and 3.

TCLK = 0 causes Timer1 overflows to be used for the transmit clock.

EXEN2 Timer 2 is external enable. When set, allows a capture or reload to occur

as a result of a negative transition on T2EX if Timer 2 is not being used

to clock the serial port. EXEN2 = 0 causes Timer 2 to ignore events at

T2Ex.

TR2 Start/Stop control for Timer 2. TR2 = 1 starts the timer.

C/T2 Timer or counter select for Timer 2. C/T2 = 0 for timer function. C/T2 =

1 for external event counter (falling edge triggered).

CP/RL2 Capture/Reload select. CP/RL2 = 1 causes captures to occur on negative

transitions at T2EX if EXEN2 = 1. CP/RL2 = 0 causes automatic

reloads to occur when Timer 2 overflows or negative transitions occur at

T2EX when EXEN2 = 1. When either RCLK or TCLK = 1, this bit is

ignored and the timer is forced to auto-reload on Timer 2 overflow.

AUXR: Auxiliary Register

45

Page 46: FQC

• Address = 8EH

•Reset Value = XXX00XX0B

• Not Bit Addressable

Table 2.6 Auxiliary Register

- - - WDIDLE DISTRO - - DISABLE

7 6 5 4 3 2 1 0

Table 2.7 Symbols and Functions

SYMBOL FUNCTION

DISALE Disable/Enable ALE

DISALE Operating Mode

0 ALE is emitted at a constant rate of 1/6 the

oscillator frequency

1 ALE is active only during a MOVX or MOVC

instruction

DISRTO Disable/Enable Reset out

DISRTO

0 Reset pin is driven High after WDT times out

1 Reset pin is input only

WDIDLE Disable/Enable WDT in IDLE mode

WDIDLE

0 WDT continues to count in IDLE mode

1 WDT halts counting in IDLE mode

46

Page 47: FQC

Dual Data Pointer Registers: To facilitate accessing both internal and external data

memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR

address locations 82H-83H and DP1 at 84H-85H. Bit DPS = 0 in SFR AUXR1 selects

DP0 and DPS = 1 selects DP1. The user should always initialize the DPS bit to the

appropriate value before accessing the respective Data Pointer Register.

Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the

PCON SFR. POF is set to “1” during power up. It can be set and rest under software

control and is not affected by reset.

AUXR: Auxiliary Register 1

• Address = A2H

• Reset Value = XXX00XX0B

• Not Bit Addressable

Table 2.8 Auxiliary Register 1

- - - - - - - DPS

7 6 5 4 3 2 1 0

Table 2.9 Symbols and Functions

47

Page 48: FQC

SYMBOL FUNCTION

- Reserved for future expansion

DPS Data Pointer Register Select

DPS

0 Selects DPTR Registers DP0L, DP0H

1 Selects DPTR Registers DP1L, DP1H

Timers

At89s52 has got three timers 0, 1 and 2. Their description is given below.

Timer 0 and 1: Timer 0 and Timer 1 in the AT89S52 operate the same way as Timer

0 and Timer 1 in the AT89C51 and AT89C52. For further information on the timers’

operation, refer to the ATMEL Web site (http://www.atmel.com). From the home

page, select ‘Products’, then ‘8051-Architecture Flash Microcontroller’, then ‘Product

Overview’.

Timer 2: Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an

event counter. The type of operation is selected by bit C/T2 in the SFR T2CON

(shown in Table 2). Timer 2 has three operating modes: capture, auto-reload (up or

down counting), and baud rate generator. The modes are selected by bits in T2CON,

as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the

Timer function, the TL2 register is incremented every machine cycle. Since a machine

cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator

frequency

Table 2.10 Timer 2 operating modes

48

Page 49: FQC

RCLK +TCLK CP/RL2 TR2 MODE

0 0 1 16-bit Auto-reload

0 1 1 16-bit Capture

1 X 1 Baud Rate Generator

X X 0 (Off)

Capture mode: In the capture mode, two options are selected by bit EXEN2 in

T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets

bit TF2 in T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1,

Timer 2 performs the same operation, but a 1- to-0 transition at external input T2EX

also causes the current value in TH2 and TL2 to be captured into RCAP2H and

RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in

T2CON to be set. The EXF2 bit, like TF2, can generate an interrupt.

49

Page 50: FQC

Figure 2.25 Timer in Capture Mode

Auto-reload (Up or Down Counter): Timer 2 can be programmed to count up or

down when configured in its 16-bit auto-reload mode. This feature is invoked by the

DCEN (Down Counter Enable) bit located in the SFR T2MOD (see Table 4). Upon

reset, the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN is

set, Timer 2 can count up or down, depending on the value of the T2EX pin. Figure 6

shows Timer 2 automatically counting up when DCEN=0. In this mode, two options

are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to 0FFFFH

and then sets the TF2 bit upon overflow. The overflow also causes the timer registers

to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in Timer in

Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a 16-bit

50

Page 51: FQC

reload can be triggered either by an overflow or by a 1-to-0 transition at external input

T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can

generate an interrupt if enabled. Setting the DCEN bit enables Timer 2 to count up or

down, as shown in Figure 6. In this mode, the T2EX pin controls the direction of the

count. Logic 1 at T2EX makes Timer 2 count up. The timer will overflow at 0FFFFH

and set the TF2 bit. This overflow also causes the 16-bit value in RCAP2H and

RCAP2L to be reloaded into the timer registers, TH2 and TL2, respectively. Logic 0

at T2EX makes Timer 2 count down. The timer underflows when TH2 and TL2 equal

the values stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and

causes 0FFFFH to be reloaded into the timer registers. The EXF2 bit toggles

whenever Timer 2 overflows or underflows and can be used as a 17th bit of

resolution. In this operating mode, EXF2 does not flag an interrupt.

Figure 2.26 Timer 2 Auto Reload Mode

51

Page 52: FQC

Baud Rate Generator: Timer 2 is selected as the baud rate generator by setting

TCLK and/or RCLK in T2CON (Table 2). Note that the baud rates for transmit and

receive can be different if Timer 2 is used for the receiver or transmitter and Timer 1

is used for the other function. Setting RCLK and/or TCLK puts Timer 2 into its baud

rate generator mode, as shown in Figure 8. The baud rate generator mode is similar to

the auto-reload mode, in that a rollover in TH2 causes the Timer 2 registers to be

reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which are preset

by software. The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow

rate according to the following equation..

Modes 1 and 3 Baud Rates = Timer 2 overflow rate/16

The Timer can be configured for either timer or counter operation. In most

applications, it is configured for timer operation (CP/T2 = 0). The timer operation is

different for Timer 2 when it is used as a baud rate generator. Normally, when

operating as a timer, it increments every machine cycle. (At 1/12 the oscillator

frequency) When operating as a baud rate generator, however, it increments every

state time (at 1/2 the oscillator frequency). The baud rate formula is given below,

where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-

bit unsigned integer.

Modes 1 and 3/Baud Rate = Oscillator Frequency/32 x [65536-RCAP2H,

RCAP2L)]

52

Page 53: FQC

Figure 2.27 Timer 2 in Baud Generator Mode

T2MOD – Timer 2 Mode Control Register

• Address = 0C9H

• Reset Value = XXX00XX0B

• Not Bit Addressable

Table 2.11 T2MOD

- - - - - - T20E DCEN

7 6 5 4 3 2 1 0

53

Page 54: FQC

Table 2.12 Symbols and Functions

SYMBOLS FUNCTIONS

- Not implemented, reserved for future

T20E Timer 2 Output Enable bit

DCEN When set, this bit allows Timer 2 to be

configured as an up/down counter

Interrupts:

The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and

INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These

interrupts are all shown in Figure 10. Each of these interrupt sources can be

individually enabled or disabled by setting or clearing a bit in Special Function

Register IE. IE also contains a global disable bit, EA, which disables all interrupts at

once. Note that Table 5 shows that bit position IE.6 is unimplemented. In the

AT89S52, bit position IE.5 is also unimplemented. User software should not write 1s

to these bit positions, since they may be used in future AT89 products. Timer 2

interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON.

Neither of these flags is cleared by hardware when the service routine is vectored to.

In fact, the service routine may have to determine whether it was TF2 or EXF2 that

generated the interrupt, and that bit will have to be cleared in software. The Timer 0

and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers

overflow. The values are then polled by the circuitry in the next cycle. However, the

Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer

overflows.

54

Page 55: FQC

Fig 2.28 Interrupt sources

55

Page 56: FQC

2.6 LCD and Keypad

Liquid crystal displays (LCDs) have materials which combine the properties of both

liquids and crystals. Rather than having a melting point, they have a temperature

range within which the molecules are almost as mobile as they would be in a liquid,

but are grouped together in an ordered form similar to a crystal. An LCD consists of

two glass panels, with the liquid crystal material sand witched in between them. The

inner surface of the glass plates are coated with transparent electrodes which define

the character, symbols or patterns to be displayed polymeric layers are present in

between the electrodes and the liquid crystal, which makes the liquid crystal

molecules to maintain a defined orientation angle.

One each polarizer are pasted outside the two glass panels. This polarizer

would rotate the light rays passing through them to a definite angle, in a particular

direction When the LCD is in the off state, light rays are rotated by the two polarizer’s

and the liquid crystal, such that the light rays come out of the LCD without any

orientation, and hence the LCD appears transparent. When sufficient voltage is

applied to the electrodes, the liquid crystal molecules would be aligned in a specific

direction. The light rays passing through the LCD would be rotated by the polarizer,

which would result in activating / highlighting the desired characters.

The LCD’s are lightweight with only a few millimeters thickness. Since the

LCD’s consume less power, they are compatible with low power electronic circuits,

and can be powered for long durations. The LCD s doesn’t generate light and so light

is needed to read the display. By using backlighting, reading is possible in the dark.

The LCD’s have long life and a wide operating temperature range. Changing the

display size or the layout size is relatively simple which makes the LCD’s more

customer friendly. The LCDs used exclusively in watches, calculators and measuring

instruments are the simple seven-segment displays, having a limited amount of

numeric data. The recent advances in technology have resulted in better legibility,

more information displaying capability and a wider temperature range. These have

resulted in the LCDs being extensively used in telecommunications and entertainment

electronics. The LCDs have even started replacing the cathode ray tubes (CRTs) used

for the display of text and graphics, and also in small TV applications.

56

Page 57: FQC

LCD operation:

1. The declining prices of LCDs.

2. The ability to display numbers, characters and graphics. This is in contrast to

LED which is limited to numbers and a few characters.

3. Incorporation of a refreshing controller into the LCD, there by relieving the

CPU of the task of refreshing the LCD. In the case of LED s, they must be

refreshed by the CPU to keep on displaying the data.

4. Ease of programming for characters and graphics.

Fig 2.29 LCD Pin Description

57

Page 58: FQC

Table 2.13 Pin description for LCD

Pin symbol I/O Description

1 Vss -- Ground

2 Vcc -- +5V power supply

3 VEE -- Power supply to

control contrast

4 RS I 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 E I/O Enable

7 DB0 I/O The 8-bit data bus

8 DB1 I/O The 8-bit data bus

9 DB2 I/O The 8-bit data bus

10 DB3 I/O The 8-bit data bus

11 DB4 I/O The 8-bit data bus

12 DB5 I/O The 8-bit data bus

13 DB6 I/O The 8-bit data bus

14 DB7 I/O The 8-bit data bus

The LCD can display a character successfully by placing the

58

Page 59: FQC

1. Data in Data Register

2. Command in Command Register of LCD

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

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

The commonly used commands are shown below with their operations.

Table 2.14 LCD Command Codes

Code (hex) Command to LCD Instruction Register

1 Clear display screen

2 Return home

4 Decrement cursor

6 Increment cursor

5 Shift display right

7 Shift display left

8 Display off, cursor off

A Display off, cursor on

C Display on, cursor off

E Display on, cursor on

F Display on, cursor blinking

10 Shift cursor position to left

59

Page 60: FQC

14 Shift cursor position to right

18 Shift the entire display to the left

1C Shift the entire display to the right

80 Force cursor to beginning of 1st line

C0 Force cursor to beginning of 2nd line

38 2 lines and 5x7 matrix

Applications:

The LCDs used exclusively in watches, calculators and measuring instruments are the

simple seven-segment displays, having a limited amount of numeric data. The recent

advances in technology have resulted in better legibility, more information displaying

capability and a wider temperature range. These have resulted in the LCDs being

extensively used in telecommunications and entertainment electronics.

60

Page 61: FQC

Linear keypad

This section basically consists of a Linear Keypad. Basically a Keypad can be

classified into 2 categories. One is Linear Keypad and the other is Matrix keypad.

1. Matrix Keypad.

2. Linear Keypad.

Matrix Keypad: This Keypad got keys arranged in the form of Rows and Columns.

That is why the name Matrix Keypad. According to this keypad, In order to find the

key being pressed the keypad need to be scanned by making rows as i/p and columns

as output or vice versa .This Keypad is used in places where one needs to connect

more no. of keys with less no. of data lines.

Linear Keypad: This Keypad got ‘n’ no. of keys connected to ‘n’ data lines of

microcontroller.

This Keypad is used in places where one needs to connect less no. of keys. Generally,

in Linear Keypads one end of the switch is connected to Microcontroller (Configured

as i/p) and other end of the switch is connected to the common ground. So whenever a

key of Linear Keypad is pressed the logic on the microcontroller pin will go LOW.

Here in this project, a linear keypad is used with switches connected in a serial

manner. Linear keypad is used in this project because it takes less no. of port pins.

The Linear Keypad with 4 Keys is shown below.

61

Page 62: FQC

Fig 2.30 Linear Keypad

CHAPTER 3: BLOCK DIGARM AND OVERVIEW

62

Page 63: FQC

Aim:

The main aim of the project is to develop a speed control system for DC motor using

four-quadrant chopper. Using four-quadrant chopper it is possible to demonstrate

forward and reverse motoring and braking.

Purpose:

The purpose of the project is to implement a simple and cost effective process to

control the speed of DC motors using the most popular technique four-quadrant

chopper method.

Block Diagram:

Fig 3.1 Block Diagram of a Four Quadrant Chopper using Microcontroller and

IGBTs.

63

Page 64: FQC

At several instances, we need to convert AC to DC. A Regulated Power Supply is

required for such a set up. This is enunciated through the block diagram hereunder:

Fig 3.2 Regulated Power Supply Schematic

Software used:

1. Embedded C

2. Keil IDE

3. Uc-Flash

Hardware used:

1. Micro controller

2. power supply

3. Keypad

4. LCD Display

5. Embedded controller

6. IGBT Driver circuit

7. IGBT Chopper

8. DC Motor

9. Rectifier circuit

64

Page 65: FQC

Applications:

1. Motor speed regulation

2. In manufacturing industries

3. Speed control of DC motor

Advantages:

1. Reliable operations at large currents

2. Controls the process

3. Ease of operation

Result:

Hence, by using this project we can effectively control the speed of DC motor by using four-quadrant chopper method.

65

Page 66: FQC

CHAPTER 4: HARDWARE DESIGN

4.1 Motor Specifications

The hardware design includes the choice of IBTS, ICs and even the transformers and

capacitors and resistances employed. All these components are suited such that they

are able to run the motor effectively. It is therefore of immense importance to choose

the motor such that it is convenient, practical and feasible to execute the four quadrant

operation.

In our project, the DC Motor is a separately excited DC Motor in which we excite the

Armature and the Field separately. Throughout the experiment, we achieve this by

maintaining field voltage constant and varying the speed by varying the armature

voltage. The armature voltage is varied using the Pulse Width Modulation technique

by using the IGBTs and the Micro Controller.

The specifications of the motor being used are given hereunder:

Table 4.1 Motor Specifications

Parameter under study Value

Current 0.0

H. P. 0.5

Speed 1500 rpm

Volts 230

Amps 2.1

Winding Shunt

Field Voltage 230

Field Current 0.2

Enclosure SPDP

66

Page 67: FQC

4.2 Hardware Layout:

The hardware of the circuitry consists of two main circuits. The first circuit is

the part comprising of the Microcontroller and other auxiliary circuitry. The

second circuit consists of the four IGBTs which are controlled through driver

ICs and Optocouplers.

Step Down Transformers:

Both these circuits have different requirements and therefore both these

circuits need two different transformers for supply of AC current. In both

these circuits, this AC current is eventually converted into DC current using

Bridge Rectifiers and capacitors.

The first half of the circuit which consists of the Microcontroller requires only

5V DC supply for the Microcontroller to work. Therefore, we employ a simple

230 V to 9 V step down transformer to achieve this.

67

Page 68: FQC

Fig 4.1 Step down Transformer for the Microcontroller circuit.

The second half of the circuit i.e. the part containing the IGBTs and the

Optocouplers requires 12 V DC supply throughout the circuit. We therefore

need a slightly higher supply at the secondary end of the transformer if we

intend to achieve this.

68

Page 69: FQC

Fig 4.2 Step down transformer for the Optocoupler Circuit.

In both the cases, the transformer receives 230 V, 50 Hz supply at the primary and

give 9 V and 12 V AC output to the bridge rectifier.

4.3 The Microcontroller Circuit

69

Page 70: FQC

Fig 4.3 The Microcontroller Circuitry

In the power supply section of the Microcontroller Circuitry, the most important

component after the transformer is the Bridge Rectifier. Using diode action, we

convert AC to DC. This Bridge Rectifier is achieved using IN4007 diode.

70

Page 71: FQC

IN4007 diodes:

Four IN4007 diodes are used to construct the bridge rectifier.

Fig 4.4 IN4007 diodes

IN 4007 is preferred in our project because it is suitable for general purpose low

power applications. This diode weighs very less (approximately 0.4 gram), is

corrosion resistant and can be easily soldered.

The Maximum ratings and Electrical Characteristics of IN4007 are discussed

hereunder:

Table 4.2 Maximum Ratings of IN4007

Rating Value

Peak Repetitive Reverse Voltage

Working Peak Reverse Voltage

DC Blocking Voltage

1000 Volts

Non Repetitive Peak Reverse Voltage

for half wave, single phase

1200 Volts

RMS Reverse Voltage 700 Volts

Average Rectified Forward Current 1.0 Amps

71

Page 72: FQC

Non Repetitive Peak Surge Current 30 (for 1 cycle)

Operating and storage junction

temperature range

-65 to 175

Table 4.3 Electrical Characteristics of IN4007

Rating Typical Value Maximum Value

Maximum instantaneous

forward voltage drop

0.93 volts 1.1 volts

Maximum Full Cycle

Average Forward

Voltage Drop

0.8 volts

Maximum Reverse

Current (Rated DC

Voltage )

0.05 µA (Tj = 25 degrees

C)

1.0 µA (Tj = 100 degrees

C)

10 µA (Tj = 25 degrees C)

50 µA (Tj = 100 degrees

C)

Maximum Full Cycle

Average Reverse

Current

30µA.

The IN 4007 bridge rectifier generates a DC voltage but it has large ripples in it.

These ripples in the voltage disturb the performance of the circuit and need to be

removed. To remove these ripples, we use a 1000 µF Capacitor.

Capacitor

72

Page 73: FQC

Fig 4.5 1000 µF Capacitor

Following the capacitor action, we regulate the voltage using a Voltage

Regulator. We use the LM 7805 regulator which gives a constant 5 V DC

output irrespective of the input supply.

The 7805 has an output current up to 1 A. It also has thermal overload

protection, short circuit protection and output transistor operating area

protection.

The necessary values which are relevant to the project are tabulated hereunder:

Table 4.4 7805 Specifications

Parameter Typical Value

Output Voltage 5.0 V

Peak Current 2.2 V

Ripple Rejection 73 dB

Output Resistance 230 mΩ at 1 KHz frequency.

73

Page 74: FQC

Short Circuit Current 230 mA

Fig 4.6 78XX

Fig 4.7 7805

After the voltage regulation, we employ yet another capacitor which eventually

provides us with pure DC current.

74

Page 75: FQC

Fig 4.8 100 µF Capacitor

After achieving the perfect DC Voltage of 5 V, we supply it to the Microcontroller.

The Microcontroller diagram is shown in the following figure:

Fig 4.9 Atmel AT 89S52

4.4 The Optocoupler-IGBT Circuit

75

Page 76: FQC

Fig 4.10 Optocoupler-IGBT Circuit

76

Page 77: FQC

Similar to the Microcontroller circuit, we need a regulated DC supply even in this

circuit as well. We employ three transformers (the figure is already displayed in the

previous sections) which each provide 12 V supply.

The main connection between the Microcontroller and the Optocoupler-IGBT circuit

is the Optocoupler.

The Optocoupler used in the circuit is the MCT 2E. Precisely, for our experiment, we

use five Optocoupler ICs. Four of these Optocouplers are connected to the IR 2110 IC

which controls the IGBTs. Precisely, every IR 2110 IC gets supply from two

Optocouplers. The fifth Optocoupler is used to toggle between both the ICs.

The Optocoupler used in our circuit is a Gallium Arsenide Diode Infrared Source

Optically Coupled to a Silicon npn Phototransistor. This Optocoupler has a High

Direct-Current Transfer Ratio and displays high speed switching. Typically, the t r

value is 5 µs and so is the tf value.

The parameters relevant to our experiment are displayed hereunder:

Table 4.5 Optocoupler Specifications

Parameter Typical Value

Collector- Base Breakdown Voltage

(Ic= 10 µA, IE =0, IF =0)

70 V

Collector Emitter Breakdown Voltage

(Ic= 1 mA, IE =0, IF =0)

30 V

Emitter- Collector Breakdown Voltage

(IE= 100 µA, IE =0, IF =0)

7 V

Input diode static reverse current 10 µA

Input diode static forward voltage 1.25 V

77

Page 78: FQC

Fig 4.11 MCT 2E Optocoupler

The IR 2110 IC used in our project is the 14-Lead PDIP IR 2110.

Fig 4.12 IR 2110

78

Page 79: FQC

The connections of the IR 2110 relevant to the circuit are described hereunder:

Table 4.6 Pin Description IR 2110

Pin Description

1 Connected to IN 4148 and 33 Ω Resistance which in turn are

parallel to a 47 Ω Resistance. This connection proceeds to the

IGBT.

2 Connected to 104 pF Capacitor.

3 Connected to 104 pF Capacitor.

4 NC

5 Connected to 104 pF Capacitor.

6 Connected to 104 pF Capacitor.

7 Connected to IN 4148 and 33 Ω Resistance which in turn are

parallel to a 47 Ω Resistance. This connection proceeds to the

IGBT.

8 Connected to 12 V Vcc

9 Connected to 12 V Vcc

10 Input from the Optocoupler

11 Connected to the other IR 2110

12 Input from the Optocoupler

13 Ground

14 -

79

Page 80: FQC

IGBTs:

The IGBTs used in the circuit are shown in the figure. We use four such IGBTs in an

H bridge to achieve the chopper action. Two IGBTs corresponding to a particular are

connected to each other. Both pairs of IGBTs are connected to the Motor at the

Armature. The detailed operation of the four IGBTs is already explained in the

previous sections.

Fig 4.13 IGBT along with the IN 5408 diode

Supply for the Motor:

80

Page 81: FQC

The motor is a 220 V DC supply motor. We need to convert the 220 V AC to DC. To

achieve this, we use a readymade powerful Bridge Rectifier and also a 470 µF

Capacitor to remove the ripples. This provides the pure DC supply the motor requires.

Fig 4.14 Bridge Rectifier for the Motor

Fig 4.15 Capacitor for the Supply to the Motor

Operation of the Hardware:

81

Page 82: FQC

This section gives an overview of the whole circuitry and hardware involved in the

project. The aim of the project is to control the speed of DC motor using four

quadrant chopper method, switches are provided at the input section, speed will be

increased for every switch, i.e., speed values are predefined for these switches.

During motoring mode, when the chopper is on, Vo=Vs and current Io flows

and when chopper is off, Vo=0 but Io in the load continues flowing in the

same direction through freewheeling diode, Vo and Io will be positive.

During regenerative braking mode, when the chopper is on Vo=0 but load

voltage E drives current through load and chopper. Load stores energy during

Ton of chopper. When chopper is off, Vo=E+L.di/dt exceeds Vs. As, a result,

diode D2 is forward biased and begins conducting, thus allowing power to

flows through the source, Vo is positive and Io is negative.

During reverse motoring mode, the choppers 1, 4 are kept off, chopper 2 is

kept on whereas chopper 3 is operated. When CH3 and CH2 are on, armature

gets connected to source voltage Vs so that both armature voltage and

armature current are negative. As armature current is reversed, motor torque is

reversed and when CH3 is turned off, negative armature current freewheels

through CH2, D4, Ea, La, Ra, armature current decreases and thus speed

control is obtained in third quadrant.

During reverse generating mode, the choppers 1, 2 and 3 are kept off where as

chopper 4 is operated. When chopper 4 is turned on, positive armature current

rises through CH4, D2, Ra, La, and Ea. When CH4 is turned off, diodes D2,

D3 begin to conduct and motor acting as generator returns energy to the dc

source.

In this project we are giving power supply to all units, it basically consists

of a Transformer to step down the 230V ac to 18V ac followed by diodes. Here diodes

are used to rectify the ac to dc. After rectification the obtained rippled dc is filtered

using a capacitor Filter. A positive voltage regulator is used to regulate the obtained

dc voltage. However, in this project three power supplies are used one is meant to

82

Page 83: FQC

supply operating voltage for Microcontroller and the other is to supply control voltage

for Motors. The choppers convert dc to dc with variable voltage; the speed can be

varied by varying the voltage given to the PWM converter (using keypad). The speed

of DC motor is directly proportional to armature voltage and inversely proportional to

flux. By maintaining the flux constant, the speed can be varied by varying the

armature voltage. The direction of rotation is reversed by reversing either field or

armature voltage and by varying the firing angle the speed of the motor can be

controlled and this values are given to microcontroller, the microcontroller control or

compare this values and this values are displayed in LCD.

83

Page 84: FQC

CHATER 5: SOFTWARE AND CODING

In a Microcontroller based device, the hardware works only when the relevant

software is written into the ROM area of the MC. The processor of the

Microcontroller runs the particular program and generates the outputs to achieve the

specific tasks.

There are three types of software used in the project:

*Keil software for C programming: µVision3 is an IDE (Integrated Development

Environment) that helps you write, compile, and debug embedded programs. It has an

editor and a powerful debugger.

*Express PCB for lay out design: Express PCB is a Circuit Design Software and PCB

manufacturing service

*Express SCH for schematic design: The Express SCH schematic design program is

very easy to use. This software enables the user to draw the Schematics with drag and

drop options.

The program for this project is written in Embedded C. A short description of this is

provided hereunder:

The programming Language used here in this project is an Embedded C Language.

This Embedded C Language is different from the generic C language in few things

like

a) Data types

b) Access over the architecture addresses.

The Embedded C Programming Language forms the user friendly language with

access over Port addresses, SFR Register addresses etc.

Table 4.6 Embedded C Data types

Data Types Size in Bits Data Range/Usage

unsigned char 8-bit 0-255

84

Page 85: FQC

signed char 8-bit -128 to +127

unsigned int 16-bit 0 to 65535

signed int 16-bit -32,768 to +32,767

sbit 1-bit SFR bit addressable only

bit 1-bit RAM bit addressable

only

sfr 8-bit RAM addresses 80-FFH

only

Signed char:

o Used to represent the – or + values.

o As a result, we have only 7 bits for the magnitude of the signed number,

giving us values from -128 to +127.

85

Page 86: FQC

Code:

// Four - Qudrant Operation of DC MOTOR

#include<reg52.h>

#include<lcd216.h>

unsigned int count;

unsigned int pwm_width;

unsigned char Mode=0;

bit mybit;

sbit SW_FM = P3^0; // Forward Motoring

sbit SW_FB = P3^1; // Forward Break

sbit SW_RM = P3^2; // Reverse Motoring

sbit SW_RB = P3^3; // Reverse Break

sbit SW_ON = P3^4; // Motor On

sbit SW_OF = P3^5; // Motor Off

sbit SW_UP = P3^6; // Increment Speed

sbit SW_DW = P3^7; // Decrement Speed

sbit CH1 = P1^0; // CHOPPER - 1 For Forward motoring

sbit CH2 = P1^1; // CHOPPER - 2 For Regenerative Breaking

sbit CH3 = P1^2;

sbit CH4 = P1^3;

sbit SD12 = P1^4; // Shut Down PIN of the IR2110 to which CH1 and CH2 are

Connected

sbit SD34 = P1^5; // Shut Down PIN of the IR2110 to which CH3 and CH4 are

Connected

sfr16 DPTR = 0x82;

86

Page 87: FQC

void main()

unsigned char sw_value=0,pwm_ch=0;

bit on_flag=0;

CH1 = 0;

CH2 = 0;

CH3 = 0;

CH4 = 0;

pwm_setup();

LCD_Init(); Disp_Str("4Q Chopper Drive");

LCD_Cmd(0xC0); Disp_Str(" For DC Motor ");

Delay(200);

LCD_Cmd(0x80); Disp_Str("Motor Sts: OFF ");

LCD_Cmd(0xC0); Disp_Str("Duty Cycle: UK ");

pwm_width = 65500;

SD12 = 1; // Shut down bit ON i.e IR2110 is in ON condition

SD34 = 1;

while(1)

if(SW_ON==0 && on_flag==0) // Motor ON

EA = 1; // Enable all interrupts

87

Page 88: FQC

SD12 = 0; // IR2110 ON

SD34 = 0;

pwm_width = 65500;

sw_value = 0;

LCD_Cmd(0x8B); Disp_Str(" ON ");

LCD_Cmd(0xCC);

LCD_Data((sw_value/10)+0x30);LCD_Data((sw_value%10)+0x30); LCD_Data('%');

on_flag=1;

while(SW_ON==0);

Delay(30);

if( SW_UP==0 && on_flag==1 && Mode!=0 ) // Increment

Speed

//if(pwm_width<64535)

// pwm_width += 1000;

if(sw_value<100) sw_value = sw_value+25;

if(sw_value==0) pwm_width =65500;

else if(sw_value==25) pwm_width = 60000;

else if(sw_value==50) pwm_width = 45000;

else if(sw_value==75) pwm_width = 20000;

else if(sw_value==100) pwm_width = 100;

if(sw_value==100)

LCD_Cmd(0xCC); Disp_Str("100%");

else

LCD_Cmd(0xCC);

LCD_Data((sw_value/10)+0x30);LCD_Data((sw_value%10)+0x30); LCD_Data('%');

88

Page 89: FQC

while(SW_UP==0);

Delay(30);

if( SW_DW==0 && on_flag==1 && Mode!=0)

// Decrement Speed

//if(pwm_width>1000)

// pwm_width -= 1000;

if(sw_value>0) sw_value = sw_value-25;

if(sw_value==0) pwm_width =65500;

else if(sw_value==25) pwm_width = 60000;

else if(sw_value==50) pwm_width = 45000;

else if(sw_value==75) pwm_width = 20000;

else if(sw_value==100) pwm_width = 500;

if(sw_value==100)

LCD_Cmd(0xCC); Disp_Str("100%");

else

LCD_Cmd(0xCC);

LCD_Data((sw_value/10)+0x30);LCD_Data((sw_value%10)+0x30); LCD_Data('%');

while(SW_DW==0);

Delay(30);

if(SW_OF==0) // Motor Off

SD12 = 1; // IR2110 shutdown

SD34 = 1;

89

Page 90: FQC

EA=0; // Disable All interrupts

pwm_width = 65500;

LCD_Cmd(0x8B); Disp_Str(" OFF");

LCD_Cmd(0xCC); Disp_Str(" UK ");

sw_value=0;

LCD_Cmd(0xCC);

LCD_Data((sw_value/10)+0x30);LCD_Data((sw_value%10)+0x30); LCD_Data('%');

on_flag=0;

while(SW_OF==0);

Delay(30);

if(SW_FM==0 && on_flag==1 ) // Forward

Motoring

CH4 = 1; // Chopper 4 ON

CH3 = 0; // Chopper 3 OFF

CH2 = 0; // Chopper 2 OFF

EA = 1; // Enable all interrupts

LCD_Cmd(0x8B); Disp_Str(" FM ");

Mode = 1; // PWM for Chopper 1

while(SW_FM==0);

if( SW_FB==0 && Mode==1 ) // Forward

Regenerative Breaking

EA = 0;

90

Page 91: FQC

LCD_Cmd(0x8B); Disp_Str(" FB ");

CH1 = 0; // Chopper 1 off

CH3 = 0; // Chopper 3 off

CH4 = 0; // Chopper 4 off

CH2 = 1; // Chopper 2 On

Delay(250); Delay(250);

CH2 = 0; // Break

pwm_width = 65500;

on_flag=0;

Mode = 2;

while(SW_FB==0);

if( SW_RM==0 && on_flag==1 ) // Reverse

Motoring

CH1 = 0; // Chopper 1 Off

CH2 = 1; // Chopper 2 ON

CH4 = 0; // Chopper 4 Off

EA = 1; // Enable all interrupts

LCD_Cmd(0x8B); Disp_Str(" RM ");

Mode = 3; // PWM for Chopper 3

while(SW_RM==0);

91

Page 92: FQC

if(SW_RB==0 && Mode==3) // Reverse

Regenerative Breaking

EA=0;

LCD_Cmd(0x8B); Disp_Str(" RB ");

CH1 = 0;

CH2 = 0;

CH3 = 0;

CH4 = 1; // Breaking

Delay(250);Delay(250);

CH4 = 0;

Mode = 4;

pwm_width = 65500;

on_flag=0;

while(SW_RB==0);

92

Page 93: FQC

Additional Code:

void lcdcmd(unsigned char);

void lcddata(unsigned char);

void lcdinit(void);

void delay(unsigned int);

void disp_str(unsigned char*);

sfr ldata=0x80;

sbit rs=P2^7;

sbit rw=P2^6;

sbit en=P2^5;

void lcdint()

lcdcmd (0x38);

delay(10);

lcdcmd(0x0E);

delay(10);

lcdcmd(0x01);

delay(10);

lcdcmd(0x06);

delay(10);

lcdcmd(0x80);

delay(10);

93

Page 94: FQC

void lcdcmd(unsigned char a)

ldata=a;

rs=0;

rw=0;

en=1;

delay(1);

en=0;

void lcddata(unsigned char b)

ldata=b;

rs=1;

rw=0;

en=1;

delay(1);

en=0;

void disp_str(unsigned char *p)

94

Page 95: FQC

while( *p != '\0')

lcddata(*p);

p++;

void delay(unsigned int z)

unsigned int u,v;

for(u=0;u<z;u++)

for(v=0;v<1275;v++);

95

Page 96: FQC

CHAPTER 6: LIMITATIONS

The project suffers from a few limitations that can be improved in the future

constructions:

Wireless control of DC Motor can be very easily programmed and set up.

Such a set up will help distant and multiple control of DC Motors in

industries.

Safety features like over current protection, over temperature protection of the

motor are missing and this might cause damage to the circuitry or the motor.

The Four Quadrant chopper control can only be applied to DC motors whereas

most motors in industry are AC motors.

96

Page 97: FQC

CHAPTER 7: CONCLUSIONS

We were successfully able to run the motor in all the four quadrants. In the forward

and reverse motoring modes, we were able to successfully change the duty cycle very

smoothly and achieve speed regulation. The forward and reverse braking was also

working excellently. The Microcontroller was successfully programmed in Embedded

C and the board was soldered with all the components. Eventually, we were able to

express the desired result.

Prospects of Future Work:

The project can be improvised in several ways. By introducing algorithms in the

feedback loop, greater control can be achieved. Fuzzy logic algorithms can also be

introduced in the loop to maintain uninterrupted supply even in the event of a fault. A

current measurement and control system can be established which might have a relay

such that the circuit is protected from over current faults. Safety features like Air Gap

Flux Measurement, Motor Temperature and Speed sensing can be built and connected

for automatic protection.

97

Page 98: FQC

List of Figures

Serial Number

Figure Number

Description Page Number

1 2.1 Two quadrant operation of motor 5

2 2.2 Four quadrant operation of motor 8

3 2.3 SCR Equivalent Circuit 10

4 2.4 GTO Thyristor 11

5 2.5 Power Transistor 12

6 2.6 Power Mosfet 13

7 2.7 Structure of an IGBT 14

8 2.8 Hole and electron flow in the IGBT during on state

16

9 2.9 Structure of a Transformer 19

10 2.10 Transformer 20

11 2.11 Half Wave controlled rectifier 21

98

Page 99: FQC

12 2.12 Full Wave Mid Point Converter 23

13 2.13 Full Wave Bridge Circuit with Resistive Load

23

14 2.14a, 2.14b, 2.14c

Waveforms for Fully Controlled Bridge Rectifier with Resistive Load

24,25

15 2.15 Bridge Rectifier 27

16 2.16 Positive Half Cycle of Bridge Rectifier

28

17 2.17 Negative Half Cycle of Bridge Rectifier

28

18 2.18 Filer charging and discharging 30

19 2.19 Internal Block Diagram of 78XX

Voltage Regulator

31

20 2.20 Optocoupler Pin Diagram and

Schematic

33

21 2.21 PDIP 89S52 37

22 2.22 PLCC 89S52 38

23 2.23 TQFP 89S52 38

99

Page 100: FQC

24 2.24 Atmel 89S52 Block Diagram 39

25 2.25 Timer in Capture Mode 50

26 2.26 Timer 2 Auto Reload Mode 51

27 2.27 Timer 2 in Baud Generator Mode 53

28 2.28 Interrupt sources 55

29 2.29 LCD Pin Description 57

30 2.30 Linear Keypad 62

31 3.1 Block Diagram of a Four Quadrant

Chopper using Microcontroller and

IGBTs.

63

32 3.2 Regulated Power Supply Schematic 64

33 4.1 Step down Transformer for the

Microcontroller circuit.

67

34 4.2 Step down transformer for the

Optocoupler Circuit.

68

100

Page 101: FQC

35 4.3 The Microcontroller Circuitry 69

36 4.4 IN4007 diodes 70

37 4.5 1000 µF Capacitor 72

38 4.6 78XX 73

39 4.7 7805 73

40 4.8 100 µF Capacitor 74

41 4.9 Atmel AT 89S52 74

42 4.10 The Optocoupler-IGBT Circuit 75

43 4.11 MCT 2E 77

44 4.12 IR 2110 77

45 4.13 IGBT along with the IN 5408 diode 79

46 4.14 Bridge Rectifier for the Motor 80

47 4.15 Capacitor for the Supply to the 80101

Page 102: FQC

Motor

List of Tables

Serial Number

Table Number

Description Page Number

102

Page 103: FQC

1 2.1 Rectifiers 26

2 2.2 Atmel AR89S52 Port

1Pins and their

alternate functions

41

3 2.3 Atmel AR89S52 Port

3 Pins and their

alternate functions

42

4 2.4 Bits of T2CON 44

5 2.5 Description of each

bit of T2CON Timer

45

6 2.6 Auxiliary Register 46

7 2.7 Symbols and

Functions

46

8 2.8 Auxiliary Register 1 47

9 2.9 Symbols and

Functions

48

10 2.10 Timer 2 operating

modes

49

103

Page 104: FQC

11 2.11 T2MOD 53

12 2.12 Symbols and

Functions

54

13 2.13 Pin description for

LCD

58

14 2.14 LCD Command

Codes

59

15 4.1 Motor Specifications 66

16 4.2 Maximum Ratings of

IN4007

70

17 4.3 Electrical Characteristics of

IN4007

71

18 4.4 7805 Specifications 72

19 4.5 Optocoupler

Specifications

78

20 4.6 Embedded C Data

types

83

104

Page 105: FQC

References

1. J. B. Gupta, Theory and Performance of Electrical Machines. New Delhi: S K

Kataria & Sons, 2008.

2. D. Halliday, R. Resnick and J. Walker. Fundamentals of Physics. John Wiley

& Sons, 1997.

3. P.S. Bimbra. Power Electronics. Delhi: Khanna Publishers, 2007.

4. M.D. Singh and K.B. Kanchandani. Power Electronics. Tata McGraw Hill,

2008.

105

Page 106: FQC

5. B. Bose. Power Electronics and Motor Drives-Advances and Trends. Noida:

Academic Press- An Imprint of Elsevier, 2006.

6. M. A. Mazidi, J. G. Mazidi and R.D. McKinlay. The 8051 Microcontroller

and Embedded Systems- using Assembly and C. Delhi: Pearson Prentice Hall,

2009.

7. A. Morbid, S.B. Dewan, “Selection of commutation circuits for four quadrant

choppers”, In Proc. International Journal of Electronics’03, 1988, pp 507-520.

8. ATMEL, “8 bit Microcontroller with 8K Bytes in system programmable flash”

AT 89S52 datasheet, 2001.

9. Texas Instruments, “MCT2, MCT2E Optocouplers” SOES023 datasheet, Mar

1983 [Revised Oct 1995]

10. Motorola Semiconductor Technical Data, “Axial Lead Standard Recovery

Rectifiers” IN4001/N datasheet, 1996.

11. Fairchild Semiconductor, “3 Terminal 1A Positive Voltage Regulator”

KA78XX/KA78XXA datasheet, 2001.

Cost report

Name of the Equipment Qty Cost in

Rupees

Transformer (Secondary 9V) 1 150

Transformers (Secondary 18V) 3 450

IN4007 diodes 16 400

106

Page 107: FQC

ATMEL AT 89S52 1 400

Capacitors -1000µF 4 300

Capacitors- 100 µF 4 200

Optocouplers MCT 2E 5 100

IR2110 2 400

IGBT 4 1400

Readymade Bridge Rectifier for Motor 1 150

Large Capacitor for Motor 1 250

Key Pad 1 200

LCD 1 400

Other accessories, soldering paste, soldering gun etc. - 300

TOTAL 5100

Appendix:

Pictures of the completed project:

107

Page 108: FQC

108

Page 109: FQC

Video:

109

Page 110: FQC

To see the project in operation, please visit

http://4qmjcet.wordpress.com/

110