You are on page 1of 40

Abstract

In this project our main objection with 360 degree movement of stepper mot motor
and its speed controller in accordance with our application. We change speed of
stepper motor by using a variable potentiometer and we can change minimum
angle of torque with help of our desire coding in C language.
BLOCK DIAGRAM

CONTENTS
S.NO

TOPIC

PAGE NO

INTRODUCTION

MOTOR DRIVE

10

POWER SUPPLY

12

BRIDGE RECTIFIER

14

REGULATOR IC (78XX)

18

MICROCONTROLLER AT89C51

23

ULN2003

34

10

PROGRAM

36

11

CIRCUIT DIAGRAM IN PROTIEUS

37

12

FUTURE SCOPE & REFRENCES

39

Introduction:-

What is a Stepper Motor?


A stepper motor is an electromechanical device which converts electrical pulses
into discrete mechanical movements. The shaft or spindle of a stepper motor
rotates in discrete step increments when electrical command pulses are applied to it
in the proper sequence. The motors rotation has several direct relationships to these
applied input pulses. The sequence of the applied pulses is directly related to the
direction of motor shafts rotation. The speed of the motor shafts rotation is directly
related to the frequency of the input pulses and the length of rotation is directly
related to the number of input pulses applied. And control its speed using a variable
potentiometer.

How Stepper Motor works:


Stepper motors behaves differently than
standard DC motors. First of all, they cannot
run freely by themselves. Stepper motors do as
their name suggests -- they "step" a little bit at
a time. Stepper motors also differ from DC
motors in their torque-speed relationship. DC
motors generally are not very good at
producing high torque at low speeds, without
the aid of a gearing mechanism. Stepper
motors, on the other hand, work in the
opposite manner. They produce the highest
torque at low speeds. Stepper motors also
have another characteristic, holding torque, which is not present in DC motors.
Holding torque allows a stepper motor to hold its position firmly when not turning.
This can be useful for applications where the motor may be starting and stopping,
while the force acting against the motor remains present. This eliminates the need
for a mechanical brake mechanism. Steppers don't simply respond to a clock
signal, they have several windings which need to be energized in the correct
sequence before the motor's shaft will rotate. Reversing the order of the sequence
3

will cause the motor to rotate the other way. If the control signals are not sent in
the correct order, the motor will not turn properly. It may simply buzz and not
move, or it may actually turn, but in a rough or jerky manner. A circuit which is
responsible for converting step and direction signals into winding energization
patterns is called a translator. Most stepper motor control systems include a driver
in addition to the translator, to handle the current drawn by the motor's windings.

A basic example of the "translator +


driver" type of configuration. Notice
the separate voltages for logic and for
the stepper motor. Usually the motor
will require a different voltage than
the logic portion of the system.
Typically logic voltage is +5 V dc and
the stepper motor voltage can range
from +5 V dc up to about +48 V dc. The driver is also an "open collector" driver,
wherein it takes its outputs to GND to activate the motor's windings. Most
semiconductor circuits are more capable of sinking (providing a GND or negative
voltage) than sourcing (outputting a positive voltage).

When to use a Stepper Motor:

A stepper motor can be a good choice whenever controlled movement is required.


They can be used to advantage in applications where you need to control rotation
angle, speed, position and synchronism. Because of the inherent advantages listed
previously, stepper motors have found their place in many different applications.
Some of these include printers, plotters, high-end office equipment, hard disk
drives, medical equipment, fax machines, automotive and many more.

Torque Generation:
The torque produced by a stepper motor depends on several factors.
The step rate
The drive current in the windings
The drive design or type
In a stepper motor a torque is developed when the magnetic fluxes of the rotor and
stator are displaced from each other. The stator is made up of a high permeability
magnetic material. The presence of this high permeability material causes the
magnetic flux to be confined for the most part to the paths defined by the stator
structure in the same fashion that currents are confined to the conductors of an
electronic circuit. This serves to concentrate the flux at the stator poles. The torque
output produced by the motor is proportional to the intensity of the magnetic flux
generated when the winding is energized. The basic relationship which defines the
intensity of the magnetic flux is defined by:
H = (N I) l where: N = The number of winding turns
I = current, H = Magnetic field intensity, l = Magnetic flux path length.
This relationship shows that the magnetic flux intensity and consequently the
torque is proportional to the number of winding turns and the current and inversely
proportional to the length of the magnetic flux path. From this basic relationship
one can see that the same frame size stepper motor could have very different torque
output capabilities simply by changing the winding parameters. More detailed

information on how the winding parameters affect the output capability of the
motor can be found in the application note entitled Drive Circuit Basics.

Stepping Modes:
The following are the most common drive modes.

Full Step Drive (2 phases on):


Standard (hybrid) stepping motors have 200 rotor teeth, or 200 full steps per
revolution of the motor shaft. Dividing the 200 steps into the 360's rotation equals
a 1.8 full step angle. Normally, full step mode is achieved by energizing both
windings while reversing the current alternately. Essentially one digital input from
the driver is equivalent to one step.

Half Step Drive (1 & 2 phases on):


Half step simply means that the motor is rotating at 400 steps per revolution. In
this mode, one winding is energized and then two windings are energized
alternately, causing the rotor to rotate at half the distance, or 0.9's. (The same
effect can be achieved by operating in full step mode with a 400 step per revolution
motor). Half stepping is a more practical solution however, in industrial
applications. Although it provides slightly less torque, half step mode reduces the
amount "jumpiness" inherent in running in a full step mode.
Micro

stepping (Continuously varying motor currents)

Micro stepping is a relatively new stepper motor technology that controls the
current in the motor winding to a degree that further subdivides the number of
positions between poles. AMS micro steppers are capable of rotating at 1/256 of a
step (per step), or over 50,000 steps per revolution.

TYPES OF STEPPER MOTORS


Stepper motors fall into two basic categories: Permanent magnet and variable
reluctance. The type of motor determines the type of drivers, and the type of

translator used. Of the permanent magnet stepper motors, there are several "sub
flavors" available. These include the Unipolar, Bipolar, and Multiphase varieties.

Permanent Magnet Stepper Motors


Unipolar Stepper Motors

Unipolar motors are relatively easy to control. A simple 1-of-'n' counter circuit can
generate the proper stepping sequence, and drivers as simple as 1 transistor per
winding are possible with unipolar motors. Unipolar stepper motors are
characterized by their center-tapped windings. A common wiring scheme is to take
all the taps of the center-tapped windings and feed them +MV (Motor voltage).
The driver circuit would then ground each winding to energize it.

Figure 2.1 - A typical unipolar stepper motor driver circuit. Note the 4 back EMF protection diodes.

Unipolar stepper motors are recognized by their center-tapped windings. The


number of phases is twice the number of coils, since each coil is divided in two. So

the diagram below (Figure 3.1), which has two center-tapped coils, represents the
connection of a 4-phase unipolar stepper motor.

Figure 3.1 - Unipolar stepper motor coil setup (left) and 1-phase drive pattern (right).

In addition to the standard drive sequence, high-torque and half-step drive


sequences are also possible. In the high-torque sequence, two windings are active
at a time for each motor step. This two-winding combination yields around 1.5
times more torque than the standard sequence, but it draws twice the current. Halfstepping is achieved by combining the two sequences. First, one of the windings is
activated, then two, then one, etc. This effectively doubles the number of steps the
motor will advance for each revolution of the shaft, and it cuts the number of
degrees per step in half.

Full-stepping animation

Half-stepping animation

Figure 4.1 - Two-phase stepping sequence (left) and half-stepsequence (right).

Variable Reluctance Stepper Motors


Sometimes referred to as Hybrid motors, variable reluctance stepper motors are the
simplest to control over other types of stepper motors. Their drive sequence is
simply to energize each of the windings in order, one after the other This type of
stepper motor will often have only one lead, which is the common lead for all the
other leads. This type of motor feels like a DC motor when the shaft is spun by
hand; it turns freely
and you cannot feel
the steps. This type
of stepper motor is
not
permanently
magnetized like its
unipolar and bipolar
counpolar
counterparts.

Figure 7.1 - Variable reluctance stepper motor coil setup (left) and drive pattern (right).
9

Advantages:
1. The rotation angle of the motor is proportional to the input pulse.
2. The motor has full torque at stand-still (if the windings are energized)
3. Precise positioning and repeat-ability of movement since good stepper motors
have an accuracy of 3 5% of a step and this error is non cumulative from one step
to the next.
4. Excellent response to starting/stopping/reversing.
5. Very reliable since there are no contact brushes in the motor. Therefore the life
of the motor is simply dependant on the life of the bearing.

Disadvantages:
1. Resonances can occur if not properly controlled.
2. Not easy to operate at extremely high speeds.

APPLICATIONS:

Numerically Controlled Machine: Profile cutting, Grinding, Drilling, Milling and Boring
Machines
Tools and Machining Centres: Lathes, Spark Erosion Machines, Sheet Metal Presses.

Plastic and Packaging: Mark registration, labeling and cut to length.

Graphics: Photo Printing and Developing, Photo Type Setting, Printing Presses, Film Projectors
and Cameras, etc.

10

Process Control and Instrumentation: Textile web control, Valve controls, Material Handling
Sys Assembly Lines, Carburetor Adjusting, In process gauging, Chart Recorders, Servo
Mechanism, Electronic Gear Box, Precise RPM Control, RPM meter calibration.

Medical Instruments: Infusion Pumps, X-ray and Radioactive Machinery, Blood analysers etc.

Office Automation Equipments: Printers, Plotters, Hard Disk and Floppy Disk Drive, Telepri
and Typewriters, Copying Machines and Accounting Machines.

Motor Specification:
Model:-STM 602

Torque:-4kg. Step:-200

Motor Drive

Red

Switching
Green
Orange
Logic
1Sequence1

Green

Red

Half Step

Blue

Blue
0

Full Step

Orange

0
1
1
1

0
1
1

(Clockwise rotation):

11

12

POWER SUPPLY
Power supply is a reference to a source of electrical power. A device or system
that supplies electrical or other types of energy to an output load or group of loads
is called a power supply unit or PSU. The term is most commonly applied to
electrical energy supplies, less often to mechanical ones, and rarely to others. Here
in our application we need a 5v DC power supply for all electronics involved in the
project. This requires step down transformer, rectifier, voltage regulator, and filter
circuit for generation of 5v DC power. Here a brief description of all the
components are given as follows:

TRANSFORMER:
A transformer is a device that transfers electrical energy from one circuit to
another through inductively coupled conductors the transformer's coils or
"windings". Except for air-core transformers, the conductors are commonly wound
around a single iron-rich core, or around separate but magnetically coupled cores.
A varying current in the first or "primary" winding creates a varying magnetic field
in the core (or cores) of the transformer. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the "secondary" winding. This
effect is called mutual induction.

If a load is connected to the secondary circuit, electric


charge will flow in the secondary winding of the
transformer and transfer energy from the primary
circuit to the load connected in the secondary circuit.
The secondary induced voltage VS, of an ideal
transformer, is scaled from the primary VP by a factor equal to the ratio of the number of
turns of wire in their respective windings: By appropriate selection of the numbers of
turns, a transformer thus allows an alternating voltage to be stepped up by making NS
more than NP or stepped down, by making it.

13

BASIC PARTS OF A TRANSFORMER


In its most basic form a transformer consists of:

A primary coil or winding.


A secondary coil or winding.
A core that supports the coils or windings.
Refer to the transformer circuit in figure as you read the
following explanation: The primary winding is connected to a 60-hertz ac voltage source.
The magnetic field (flux) builds up (expands) and collapses (contracts) about the primary
winding.
The expanding and contracting magnetic field around the primary winding cuts the
secondary winding and induces an alternating voltage into the winding. This voltage
causes alternating current to flow through the load. The voltage may be stepped up or
down depending on the design of the primary and secondary windings.

THE COMPONENTS OF A TRANSFORMER

14

Two coils of wire (called windings) are wound on some type of core material. In some
cases the coils of wire are wound on a cylindrical or rectangular cardboard form. In
effect, the core material is air and the transformer is called an AIR-CORE
TRANSFORMER. Transformers used at low frequencies, such as 60 hertz and 400 hertz,
require a core of low-reluctance magnetic material, usually iron. This type of transformer
is called an IRON-CORE TRANSFORMER. Most power transformers are of the ironcore type. The principle parts of a transformer and their functions are:
The CORE, which provides a path for the magnetic lines of flux.
The PRIMARY WINDING, which receives energy from the ac source.
The SECONDARY WINDING, which receives energy from the primary winding and delivers it to the
load.
The ENCLOSURE, which protects the above components from dirt, moisture, and mechanical
damage.

BRIDGE RECTIFIER
A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave
rectification. This is a widely used configuration, both with individual diodes wired as
shown and with single component bridges where the diode bridge is wired internally.
Basic operation According to the conventional model of current flow originally
established by Benjamin Franklin and still followed by most engineers today, current is
assumed to flow through electrical conductors from the positive to the negative pole. In
actuality, free electrons in a conductor nearly always flow from the negative to the
positive pole. In the vast majority of applications, however, the actual direction of current
flow is irrelevant. Therefore, in the discussion below the conventional model is retained.
In the diagrams below, when the input connected to the left corner of the diamond is
positive, and the input connected to the right corner is negative, current flows from the
upper supply terminal to the right along the red (positive) path to the output, and returns
to the lower supply terminal via the blue (negative) path.

15

When the input connected to the left corner is negative, and the input connected to the right corner is
positive, current flows from the lower supply terminal to the right along the red path to the output, and
returns to the upper supply terminal via the blue path.

In each case, the upper right output remains positive and lower right output negative.
Since this is true whether the input is AC or DC, this circuit not only produces a DC
output from an AC input, it can also provide what is sometimes called "reverse polarity
protection". That is, it permits normal functioning of DC-powered equipment when
batteries have been installed backwards, or when the leads (wires) from a DC power
source have been reversed, and protects the equipment from potential damage caused by
reverse polarity.
Prior to availability of integrated electronics, such a bridge rectifier was always
constructed from discrete components. Since about 1950, a single four-terminal
component containing the four diodes connected in the bridge configuration became a
standard commercial component and is now available with various voltage and current
ratings.

16

OUTPUT SMOOTHING

For many applications, especially with single phase AC where the full-wave bridge
serves to convert an AC input into a DC output, the addition of a capacitor may be
desired because the bridge alone supplies an output of fixed polarity but continuously
varying or "pulsating" magnitude (see diagram above).

The function of this capacitor, known as a reservoir capacitor (or smoothing capacitor) is
to lessen the variation in (or 'smooth') the rectified AC output voltage waveform from the
bridge. One explanation of 'smoothing' is that the capacitor provides a low impedance

path to the AC component of the output, reducing the AC voltage across, and AC current
through, the resistive load. In less technical terms, any drop in the output voltage and
current of the bridge tends to be canceled by loss of charge in the capacitor. This charge
flows out as additional current through the load. Thus the change of load current and
voltage is reduced relative to what would occur without the capacitor. Increases of
voltage correspondingly store excess charge in the capacitor, thus moderating the change
in output voltage / current. The simplified circuit shown has a well-deserved reputation
for being dangerous, because, in some applications, the capacitor can retain a lethal
charge after the AC power source is removed. If supplying a dangerous voltage, a
practical circuit should include a reliable way to safely discharge the capacitor.
If the normal load cannot be guaranteed to perform this function, perhaps because it can
be disconnected, the circuit should include a bleeder resistor connected as close as
practical across the capacitor. This resistor should consume a current large enough to
discharge the capacitor in a reasonable time, but small enough to minimize unnecessary
17

power waste. Because a bleeder sets a minimum current drain, the regulation of the
circuit, defined as percentage voltage change from minimum to maximum load, is
improved. However in many cases the improvement is of insignificant magnitude. The
capacitor and the load resistance have a typical time constant = RC where C and R are
the capacitance and load resistance respectively. As long as the load resistor is large
enough so that this time constant is much longer than the time of one ripple cycle, the
above configuration will produce a smoothed DC voltage across the load. In some
designs, a series resistor at the load side of the capacitor is added.
The smoothing can then be improved by adding additional stages of capacitorresistor
pairs, often done only for sub-supplies to critical high-gain circuits that tend to be
sensitive to supply voltage noise.
The idealized waveforms shown above are seen for both voltage and current when the
load on the bridge is resistive. When the load includes a smoothing capacitor, both the
voltage and the current waveforms will be greatly changed. While the voltage is
smoothed, as described above, current will flow through the bridge only during the time
when the input voltage is greater than the capacitor voltage. For example, if the load
draws an average current of n Amps, and the diodes conduct for 10% of the time, the
average diode current during conduction must be 10n Amps. This non-sinusoidal current
leads to harmonic distortion and a poor power factor in the AC supply. In a practical
circuit, when a capacitor is directly connected to the output of a bridge, the bridge diodes
must be sized to withstand the current surge that occurs when the power is turned on at
the peak of the AC voltage and the capacitor is fully discharged. Sometimes a small series
resistor is included before the capacitor to limit this current, though in most applications
the power supply transformer's resistance is already sufficient.
Output can also be smoothed using a choke and second capacitor. The choke tends to
keep the current (rather than the voltage) more constant. Due to the relatively high cost of
an effective choke compared to a resistor and capacitor this is not employed in modern
equipment. Some early console radios created the speaker's constant field with the current
from the high voltage ("B +") power supply, which was then routed to the consuming
circuits, (permanent magnets were then too weak for good performance) to create the
speaker's constant magnetic field. The speaker field coil thus performed 2 jobs in one: it
acted as a choke, filtering the power supply, and it produced the magnetic field to operate
the speaker

18

REGULATOR IC (78XX)
It is a three pin IC used as a voltage regulator. It converts unregulated DC current into regulated DC
current.

Normally we get fixed output by connecting the voltage regulator at the output of
the filtered DC (see in above diagram). It can also be used in circuits to get a low
DC voltage from a high DC voltage (for example we use 7805 to get 5V from
12V).
There are two types of voltage regulators
1. Fixed voltage regulators (78xx, 79xx)
2. Variable voltage regulators (LM317)
In fixed voltage regulators there is another classification 1. +ve voltage regulators
2. -ve voltage regulators POSITIVE

VOLTAGE REGULATORS
These include 78xx voltage regulators. The most commonly used ones are 7805
and 7812. 7805 gives fixed 5V DC voltage if input voltage is in (7.5V, 20V).

19

THE CAPACITOR FILTER


The simple capacitor filter is the most basic type of power supply filter. The application
of the simple capacitor filter is very limited. It is sometimes used on extremely highvoltage, low-current power supplies for cathode ray and similar electron tubes, which
require very little load current from the supply. The capacitor filter is also used where the
power-supply ripple frequency is not critical; this frequency can be relatively high.
The capacitor (C1) shown in figure 4-15 is a simple filter connected across the output of
the rectifier in parallel with the load.

Full-wave rectifier with a capacitor filter.


When this filter is used, the RC charge time of the filter capacitor (C1) must be short and
the RC discharge time must be long to eliminate ripple action. In other words, the
capacitor must charge up fast, preferably with no discharge at all. Better filtering also
results when the input frequency is high; therefore, the full-wave rectifier output is easier
to filter than that of the half-wave rectifier because of its higher frequency. For you to
have a better understanding of the effect that filtering has on Eavg, a comparison of a
rectifier circuit with a filter and one without a filter is illustrated in views A and B of
figure 4-16. The output waveforms in figure 4-16 represent the unfiltered and filtered
outputs of the half-wave rectifier circuit. Current pulses flow through the load resistance
(RL) each time a diode conducts. The dashed line indicates the average value of output
voltage. For the half-wave rectifier, Eavg is less than half (or approximately 0.318) of the
peak output voltage. This value is still much less than that of the applied voltage. With no
capacitor connected across the output of the rectifier circuit, the waveform in view A has
a large pulsating component (ripple) compared with the average or dc component. When
a capacitor is connected across the output (view B), the average value of output voltage
(Eavg) is increased due to the filtering action of capacitor C1.
20

UNFILTERED

Half-wave rectifier with and without filtering.

FILTERED

The value of the capacitor is fairly large (several microfarads), thus it presents a relatively
low reactance to the pulsating current and it stores a substantial charge.
The rate of charge for the capacitor is limited only by the resistance of the conducting
diode, which is relatively low. Therefore, the RC charge time of the circuit is relatively
21

short. As a result, when the pulsating voltage is first applied to the circuit, the capacitor
charges rapidly and almost reaches the peak value of the rectified voltage within the first
few cycles.
The capacitor attempts to charge to the peak value of the rectified voltage anytime a
diode is conducting, and tends to retain its charge when the rectifier output falls to zero.
(The capacitor cannot discharge immediately.) The capacitor slowly discharges through
the load resistance (RL) during the time the rectifier is non-conducting.
The rate of discharge of the capacitor is determined by the value of capacitance and the
value of the load resistance. If the capacitance and load-resistance values are large, the
RC discharge time for the circuit is relatively long.
A comparison of the waveforms shown in figure 4-16 (view A and view B) illustrates that
the addition of C1 to the circuit results in an increase in the average of the output voltage
(Eavg) and a reduction in the amplitude of the ripple component (Er) which is normally
present across the load resistance. Now, let's consider a complete cycle of operation using
a half wave rectifier, a capacitive filter (C1), and a load resistor (RL).
As shown in view A of figure 4-17, the capacitive filter (C1) is assumed to be large
enough to ensure a small reactance to the pulsating rectified current. The resistance of RL
is assumed to be much greater than the reactance of C1 at the input frequency.
When the circuit is energized, the diode conducts on the positive half cycle and current
flows through the circuit, allowing C1 to charge. C1 will charge to approximately the
peak value of the input voltage. (The charge is less than the peak value because of the
voltage drop across the diode (D1)). In view A of the figure, the heavy solid line on the
waveform indicates the charge on C1. As illustrated in view B, the diode cannot conduct
on the negative half cycle because the anode of D1 is negative with respect to the
cathode. During this interval, C1 discharges through the load resistor (RL). The discharge
of C1 produces the downward slope as indicated by the solid line on the waveform in
view B. In contrast to the abrupt fall of the applied ac voltage from peak value to zero,
the voltage across C1 (and thus across RL) during the discharge period gradually
decreases until the time of the next half cycle of rectifier operation. Keep in mind
that for good filtering, the filter capacitor should charge up as fast as possible and
discharge as little as possible.
Figure 4-17A. - Capacitor filter circuit (positive and negativehalf cycles).

22

POSITIVE HALF-CYCLE

Figure 4-17B. - Capacitor filter circuit (positive and negative half cycles).
NEGATIVE HALF-CYCLE

Since practical values of C1 and RL ensure a more or less gradual decrease of the
discharge voltage, a substantial charge remains on the capacitor at the time of the next
half cycle of operation. As a result, no current can flow through the diode until the rising
ac input voltage at the anode of the diode exceeds the voltage on the charge remaining on
23

C1. The charge on C1 is the cathode potential of the diode. When the potential on the
anode exceeds the potential on the cathode (the charge on C1), the diode again conducts,
and C1 begins to charge to approximately the peak value of the applied voltage.
After the capacitor has charged to its peak value, the diode will cut off and the capacitor
will start to discharge. Since the fall of the ac input voltage on the anode is considerably
more rapid than the decrease on the capacitor voltage, the cathode quickly become more
positive than the anode, and the diode ceases to conduct.
Operation of the simple capacitor filter using a full-wave rectifier is basically the same as
that discussed for the half-wave rectifier. Referring to figure 4-18, you should notice that
because one of the diodes is always conducting on. Either alternation, the filter capacitor
charges and discharges during each half cycle. (Note that each diode conducts only for
that portion of time when the peak secondary voltage is greater than the charge across the
capacitor.)
Figure 4-18. - Full-wave rectifier (with capacitor filter).

Another thing to keep in mind is that the ripple component (E r) of the output voltage is
an ac voltage and the average output voltage (Eavg) is the dc component of the output.
Since the filter capacitor offers relatively low impedance to ac, the majority of the ac
component flows through the filter capacitor. The ac component is therefore bypassed
(shunted) around the load resistance, and the entire dc component (or Eavg) flows
through the load resistance. This statement can be clarified by using the formula for XC
in a half-wave and full-wave rectifier. First, you must establish some values for the
circuit.

24

As you can see from the calculations, by doubling the frequency of the rectifier, you
reduce the impedance of the capacitor by one-half. This allows the ac component to pass
through the capacitor more easily. As a result, a full-wave rectifier output is much easier
to filter than that of a half-wave rectifier. Remember, the smaller the XC of the filter
capacitor with respect to the load resistance, the better the filtering action. Since

the largest possible capacitor will provide the best filtering. Remember, also, that the load
resistance is an important consideration. If load resistance is made small, the load current
increases, and the average value of output voltage (Eavg) decreases. The RC discharge
time constant is a direct function of the value of the load resistance; therefore, the rate of
capacitor voltage discharge is a direct function of the current through the load. The
greater the load current, the more rapid the discharge of the capacitor, and the lower the
average value of output voltage. For this reason, the simple capacitive filter is seldom
25

used with rectifier circuits that must supply a relatively large load current. Using the
simple capacitive filter in conjunction with a full-wave or bridge rectifier provides
improved filtering because the increased ripple frequency decreases the capacitive
reactance of the filter capacitor.

Microcontroller AT89C51

A microcontroller is an entire computer manufactured on a single chip.


Microcontrollers are usually dedicated devices embedded within an application.
For example, microcontrollers are used as engine controllers in automobiles and as
exposure and focus controllers in cameras. In order to serve these applications,
they have a high concentration of on-chip facilities such as serial ports, parallel
input-output ports, timers, counters; interrupt control, analog-to-digital converters,
random access memory, read only memory, etc. The I/O, memory, and on-chip
peripherals of a microcontroller are selected depending on the specifics of the
target application.

Since microcontrollers are powerful digital processors, the

degree of control and programmability they provide significantly enhances the


effectiveness of the application. The 8051 is the first microcontroller of the MCS51 family introduced by Intel Corporation at the end of the 1970s. The 8051
family with its many enhanced members enjoys the largest market share, estimated
to be about 40%, among the various microcontroller architectures.

The

architecture of the 8051 family of the microcontrollers is presented in this chapter.


First, the original 8051 microcontroller is discussed, followed by the enhanced
features of the 8032, and the 80C515.

26

27

Block diagram of the 8051 Microcontroller:

Pin diagram of the 8051 Microcontroller:

28

29

Port Description of AT89C51:


Port 0
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1sare written to port 0 pins, the pins can be used as
high-impedance inputs. Port 0 may also be configured to be the multiplexed loworder address/data bus during accesses to external pro-gram 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 bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1
pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups. Port 1 also receives the low-order address bytes during Flash
programming and verification.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they
are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2
pins that are externally being pulled low will source current (IIL) because of the
internal pull-ups. Port 2 emits the high-order address byte during fetches from
external program memory and during accesses to external data memory that uses
16-bit addresses (MOVX @DPTR). In this application, it uses strong internal pullups 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 3
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they
are pulled high by the internal pull-ups and can be used as inputs. As inputs , Port 3
pins that are externally being pulled low will source current (IIL) because of the
pull-ups. Port 3 also serves the functions of various special features of the
AT89C51 as listed below:

30

Port pin
P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

Alternate Features
RXD (serial input port)
TXD (serial output port)
INT0 (external interrupt 0)
INT1 (external interrupt 1)
T0 (timer 0 external input)
T1 (timer 1 external input)
WR (external data memory write strobe)
RD (external data memory read strobe)

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

ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG)
during Flash programming. In normal operation ALE is emitted at a constant rate
of 1/6the 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.
PSEN:
Program Store Enable is the read strobe to external pro-gram memory. When the
AT89C51 is executing code from external pro-gram 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 pro-gram 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 volt-age (VPP) during Flash
programming, for parts that require12-volt VPP.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.
XTAL2
Output from the inverting oscillator amplifier.
31

What Are SFRs?


The 8051 is a flexible microcontroller with a relatively large number of modes of
operations. Your program may inspect and/or change the operating mode of the
8051 by manipulating the values of the 8051's Special Function Registers (SFRs).
SFRs are accessed as if they were normal Internal RAM. The only difference is
that Internal RAM is from address 00h through 7Fh whereas SFR registers exist in
the address range of 80h through FFh.
Each SFR has an address (80h through FFh) and a name. The following chart
provides a graphical presentation of the 8051's SFRs, their names, and their
address.

As we can see, although the address range of 80h through FFh offer 128 possible
addresses, there are only 21 SFRs in a standard 8051. All other addresses in the
SFR range (80h through FFh) are considered invalid. Writing to or reading from
these registers may produce undefined values or behavior.
32

SFR Types:
As mentioned in the chart itself, the SFRs that have a blue background are SFRs
related to the I/O ports. The 8051 has four I/O ports of 8 bits, for a total of 32 I/O
lines. Whether a given I/O line is high or low and the value read from the line are
controlled by the SFRs in green.
The SFRs with yellow backgrounds are SFRs which in some way control the
operation or the configuration of some aspect of the 8051. For example, TCON
controls the timers, SCON controls the serial port.
The remaining SFRs, with green backgrounds, are "other SFRs." These SFRs can
be thought of as auxiliary SFRs in the sense that they don't directly configure the
8051 but obviously the 8051 cannot operate without them. For example, once the
serial port has been configured using SCON, the program may read or write to the
serial port using the SBUF register.

33

ULN2003

The ULN functions as an inverter.

34

If the logic at input 1B is high then the output at its corresponding pin 1C
will be low.
About Proteus

Proteus is a great electrical suite for circuit simulation purposes.

Proteus is a Virtual System Modeling and circuit simulation application. The suite
combines mixed mode circuit simulation, animated components and
microprocessor models to facilitate co-simulation of complete microcontroller
based designs.

Proteus also has the ability to simulate the interaction between software running
on a microcontroller and any analog or digital electronics connected to it.

Overview of Proteus

35

Circuit Diagram :

36

RV1
10uF

U1
19
18

X1
9

C2
22pF

CRYSTAL

XTAL1
XTAL2

RST

C1
22pF
29
30
31

R4
10k

100%

C3

1
2
3
4
5
6
7
8

PSEN
ALE
EA

P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7

P0.0/AD0
P0.1/AD1
P0.2/AD2
P0.3/AD3
P0.4/AD4
P0.5/AD5
P0.6/AD6
P0.7/AD7
P2.0/A8
P2.1/A9
P2.2/A10
P2.3/A11
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15
P3.0/RXD
P3.1/TXD
P3.2/INT0
P3.3/INT1
P3.4/T0
P3.5/T1
P3.6/WR
P3.7/RD

39
38
37
36
35
34
33
32
21
22
23
24
25
26
27
28

1k
+88.8
Volts

U2
1
2
3
4
5
6
7

1B
2B
3B
4B
5B
6B
7B

COM
1C
2C
3C
4C
5C
6C
7C

9
16
15
14
13
12
11
10

ULN2003A
10
11
12
13
14
15
16
17

+88.8

UNIPOLAR STEPPER

AT89C51

Program: (It will have some changes)


37

#include<reg51.h>
sfr stepper=0xA0;
void delay(unsigned int count)
{
int i;
for(i=0;i<count;i++);
}
void main()
{
while(1)
{
stepper=0x01;
delay(350);
stepper=0x02;
delay(350);
stepper=0x04;
delay(350);
stepper=0x08;
delay(350);
}
}

Working of the Project:-

38

From power supply circuit we convert 230v ac to 5v dc. This 5v use for supply
voltage of 8051 microcontroller.
After that we interface dc stepper motor to 8051 microcontroller with the help of
uln2003 inverting IC.
Finally we use our program in kiel s/w for generating hex file.
After generating hex file we burn that file into 8051 microcontroller. So that our
stepper motor move 360 degree with minimum torque given by our coding.
Further its speed can be controlled by variable potentiometer.

Conclusion:39

In this project we successfully able to rotate a dc stepper motor in the entire 360
degree angle with desired torque and speed by C programming coding in KIEL
software.
Future Scope: We electrical automation and robotic advance application stepper motor is going to
lots of application.

REFRENCES
www.circuitsgallery.com Google
www.en.wikipedia.org
www.engineersgarage.com
www.electroskan.wordpress.com
www.datasheetarchive.com
www.youtube.com
Various other books and magazines

40

You might also like