INTERNAL GEAR PUMP

90
CONTENTS Introduction Stepper Motor Introduction Stepper Motor Types Constructional Features Principle of Operation Data Sheet for Stepper Motor Simulating the Basic Idea Stepper Motor V/s D.C Motor Stepper Motor Basics Microcontroller What is a microcontroller ? Characteristics Microcontrollers vs microprocessors: A comparison 1 | Page

description

A

Transcript of INTERNAL GEAR PUMP

Page 1: INTERNAL GEAR PUMP

CONTENTS

Introduction

Stepper Motor

Introduction

Stepper Motor Types

Constructional Features

Principle of Operation

Data Sheet for Stepper Motor

Simulating the Basic Idea

Stepper Motor V/s D.C Motor

Stepper Motor Basics

Microcontroller

What is a microcontroller ?

Characteristics

Microcontrollers vs microprocessors: A comparison

Nomenclature

Architecture of Microcontrollers

Assembling and running of a 8051 program

1 | P a g e

Page 2: INTERNAL GEAR PUMP

Project Description

Circuit Description

Robot Basics

Data Sheet for ATMEL AT89C51

Software

Assembly Language Program

C Code (Interrupt Based)

Conclusion

Bibliography and appendix

2 | P a g e

Page 3: INTERNAL GEAR PUMP

INTRODUCTION

The most common problem we face when we use normal DC motors is that we don’t have precise control over how much it rotates. To rotate DC motors through a particular number of degrees what we can do is either calibrate it for a delay based operation i.e. if we switch it on for n seconds it moves 360 degrees; or what we can do is attach n encoder to the shaft which gives us a feedback on how much the motor shaft has rotated so that we can stop it when it rotates through the desired angle. Home made encoders give good results but don’t have such a high resolution and high resolution encoders are costly.

In such cases where we need to control the rotary position of the motor we can use stepper motors.

Internal Gear PumpsInternal Gear Pump Overview

Internal gear pumps are exceptionally versatile.  While they are often used on thin liquids such as solvents and fuel oil, they excel at efficiently pumping thick liquids such as asphalt, chocolate, and adhesives.  The useful viscosity range of an internal gear pump is from 1cPs to over 1,000,000cP.

In addition to their wide viscosity range, the pump has a wide temperature range as well, handling liquids up to 750°F / 400°C.  This is due to the single point of end clearance (the distance between the ends of the rotor gear teeth and the head of the

3 | P a g e

Page 4: INTERNAL GEAR PUMP

pump).  This clearance is adjustable to accommodate high temperature, maximize efficiency for handling high viscosity liquids, and to accommodate for wear.

The internal gear pump is non-pulsing, self-priming, and can run dry for short periods.  They're also bi-rotational, meaning that the same pump can be used to load and unload vessels.  Because internal gear pumps have only two moving parts, they are reliable, simple to operate, and easy to maintain.

 How Internal Gear Pumps Work

1. Liquid enters the suction port between the rotor (large exterior gear) and idler (small interior gear) teeth. The arrows indicatethe direction of the pump and liquid.

2. Liquid travels through the pump between the teeth of the "gear-within-a-gear" principle. The crescent shape divides the liquid and acts as a seal between the suction and discharge ports.

3. The pump head is now nearly flooded, just prior to forcing the liquid out of the discharge port.  Intermeshing gears of the idler and rotor form locked pockets for the liquid which assures volume control.

4. Rotor and idler teeth mesh completely to form a seal equidistant from the discharge and suction ports. This seal forces the liquid out of the discharge port

4 | P a g e

Page 5: INTERNAL GEAR PUMP

Applications

Common internal gear pump applications include, but are not limited to:

All varieties of fuel oil and lube oil Resins and Polymers Alcohols and solvents Asphalt, Bitumen, and Tar Polyurethane foam (Isocyanate and polyol) Food products such as corn syrup, chocolate, and peanut

butter Paint, inks, and pigments Soaps and surfactants Glycol

 Materials Of Construction / Configuration Options

Externals (head, casing, bracket) - Cast iron, ductile iron, steel, stainless steel, Alloy 20, and higher alloys.

Internals (rotor, idler) - Cast iron, ductile iron, steel, stainless steel, Alloy 20, and higher alloys.

Bushing - Carbon graphite, bronze, silicon carbide, tungsten carbide, ceramic, colomony, and other specials materials as needed.

Shaft Seal - Lip seals, component mechanical seals, industry-standard cartridge mechanical seals, gas barrier seals, magnetically-driven pumps.

Packing - Impregnated packing, if seal not required

5 | P a g e

Page 6: INTERNAL GEAR PUMP

  Advantages Only two moving parts Only one stuffing box Non-pulsating discharge Excellent for high-viscosity

liquids Constant and even

discharge regardless of pressure conditions

Operates well in either direction

Can be made to operate with one direction of flow with either rotation

Low NPSH required Single adjustable end

clearance Easy to maintain

Flexible design offers application customization

Disadvantages Usually requires moderate

speeds Medium pressure

limitations One bearing runs in the

product pumped

Overhung load on shaft bearing

STEPPER MOTOR

6 | P a g e

Page 7: INTERNAL GEAR PUMP

Stepper motors are used for precision position control in many applications like floppy drives, printers, process control instruments, robotics and machine tool control.

Here’s a stepper motor controller based on 89C51 microcontroller to control the rotation of a DC stepper motor in clockwise and anti-clockwise directions. The controller is simple and easy-to-construct, and can be used in many application including machine control and robotics for controlling the axial rotation in XY plane. A similar circuit can be added to control the rotation of the motor in either XZ or YZ plane.

Fig. 1: Block diagram of the stepper motor control system

7 | P a g e

POWER SUPPLY

MICROCONTROLLER 89C51 STEPPER

MOTOR

CONTROL SWITCH

Page 8: INTERNAL GEAR PUMP

TABLE I

Power Consumption of Microcontrollers

IC Voh Ioh Voi Ioi Vil Iil Vih Iih Pt

CMOS

NMOS

2.4V

2.4V

-60A

-80A

0.45V

0.45V

1.7 mA

1.7Ma

0.9V

0.8V

10A

-800mA

1.9V

2.0V

10A

10A

50mW

800mW

Fig. 1 shows the block diagram of the stepper motor control system. The power supply section (in fig. 2) consists of a step-down transformer (7.5V AC, 1A), bridge rectifier (comprising diodes D1 through D4), filter capacitors (C1 and C2) and regulator IC 7805.

We have used here an Atmel Make low-power, high-performance, 8-bit CMOS microcontroller AT89C51 with 4 kb of Flash programmable and erasable read-only memory n(PEROM). It has a 128x8-bit internal RAM, 32 programmable input/output (I/O) lines and two 16-bit timer/counters. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-valuable memory programmer.

By combining a versatile 8-bit CPU with Flash on a monolithic chip, Atmel AT89C51 is a powerful, highly flexible and cost-effective solution to many embedded control applications. From traffic control equipment to input devices, computer net working, products and stepper motor controller, 89C51 microcontroller deliver a high performance with a choice of configurations and options matched to the specific need of each application.

8 | P a g e

Page 9: INTERNAL GEAR PUMP

STEPPER MOTOR BASIC

A stepper motor is a brushless motor whose rotor rotates in discrete angular movements when its stator windings are energized in a programmed manner. Rotation occurs because of magnetic interaction between rotor poles and poles of sequentially energized stator windings. The rotor has no electrical windings, but has salient and magnetized poles.

The input given to the motor is in the form of electrical pulses. For every input pulse the motor shaft turns through a specified number of degree called a step. The name stepping given to this motor is based on its working principle i.e. one step rotation for one input pulse. The range of step size may vary from 0.720 to 900. Actually a stepper motor can be regarded as a digital electromechanical device, which translates input digital information in form of electric pulses into discrete steps of shaft rotation. In position control system if the number of input pulses sent to the motor is known, the actual position of driven job can be obtained. Thus a digital position control system employing a stepper motor needs no rotor position sensors and an expensive feedback loop.

9 | P a g e

Page 10: INTERNAL GEAR PUMP

A stepping motor differs from a conventional motor as under:-

Input to stepper motor is in form of electric pulses whereas input a conventional motor is invariably from a constant voltage source.

A conventional motor has a free running shaft whereas shaft of stepper motor moves through angular steps.

In control system applications, no feedback loop is required when stepper motor is used but a feedback loop is required when conventional motor is used.

A stepper motor is digital electromechanical device whereas a conventional motor is an electromechanical device.

10 | P a g e

Page 11: INTERNAL GEAR PUMP

STEPPER MOTOR TYPES

There are three basic stepper motor types. They are: -• Variable-reluctance• Permanent magnet• Hybrid

Variable-reluctance (VR)This type of stepper motor has been around for a long time. It is probably the easiest to understand from a structural point of view. Figure 1 shows a cross section of a typical V.R. stepper motor. This type of motor consists of a soft iron multi-toothed rotor and a wound stator. When the stator windings are energized with DC current the poles become magnetized. Rotation occurs when the rotor teeth are attracted to the energized stator poles.

Figure 1. Cross-section of a variable reluctance (VR) motorPermanent Magnet (PM)Often referred to as a “tin can” or “canstock” motor the permanent magnet step motor is a low cost and low-resolution type motor with typical step angles of 7.5° to 15°. (48 – 24 steps/revolution) PM motors as the name implies have permanent magnets added to the

11 | P a g e

Page 12: INTERNAL GEAR PUMP

motor structure. The rotor no longer has teeth as with the VR motor. Instead the rotor is magnetized with alternating north and south poles situated in a straight line parallel to the rotor shaft. These magnetized rotor poles provide an increased magnetic flux intensity and because of this the PM motor exhibits improved torque characteristics when compared with the VR type.

Hybrid (HB)The hybrid stepper motor is more expensive than the PM stepper motor but provides better performance with respect to step resolution, torque and speed. Typical step angles for the HB stepper motor range from 3.6° to 0.9° (100 – 400 steps per revolution). The hybrid stepper motor combines the best features of both the PM and VR type stepper motors. The rotor is multi-toothed like the VR motor and contains an axially magnetized concentric magnet around its shaft. The teeth on the rotor provide an even better path, which helps guide the magnetic flux to preferred locations in the airgap. This further increases the detent, holding and dynamic torque characteristics of the motor when compared with both the VR and PM types.The two most commonly used types of stepper motors are the permanent magnet and the hybrid types. If a designer is not sure which type will best fit his applications requirements he should first evaluate the PM type as it is normally several times less expensive. If not then the hybrid motor may be the right choice.

There also exist some special stepper motor designs. One is the disc magnet motor. Here the rotor is designed as a disc with rare earth magnets (Fig. 2). This motor type has some advantages such as very low inertia and an optimized magnetic flow path with no coupling between the two-stator windings. These qualities are essential in some applications.

12 | P a g e

Page 13: INTERNAL GEAR PUMP

Figure 5. Magnetic flux path through a two-pole stepper motor with a lag between the rotor and stator.

INDUSTRIAL APPLICATION OF STEPPER MOTORS

Floppy Disk Drives.Hard Disk Drives.Printers, Plotters.Electronic Watches.Electronic Typewriters.Teleprinter, Telex-machines.Robotics.CNC-System.Instrumentation Control.

The main reason for the use of stepper motor instead of ordinary DC motors in disk drives is requirement to position the read/write header. Stepper motors can be rotated at a fixed angle and their angular rotation can be converted into linear movements to move the read/write head over the disk surface in a fixed increment.

13 | P a g e

Page 14: INTERNAL GEAR PUMP

14 | P a g e

Page 15: INTERNAL GEAR PUMP

CONSTRUCTIONAL FEATURES

A two-phase bipolar stepper motor has two coils A and B which are wound around the upper and lower halves of stator as shown in figure 1. The stator surrounds a rotor that contains specifically aligned permanent magnets. The number of steps per revolutions is determined by the number of pole pairs on the rotor and stator. The cross sectional view of stator and rotor of the stepper motor are clearly depicted in figure 1 and 2.

The stepper motor are clearly used in our circuit is having 10 pole rotor structure but still 6 pole rotor structure has been depicted in figure 2 for simplicity of the figure and easy understanding principle.

Stator :

Stator of the stepper motor has salient poles on which concentrated windings A and B are wound. These windings are appropriately connected so as to result in two-phase windings on stator. The salient pole structure of stator is continuous from one end to other end of the rotor.

Rotor :

The rotor of stepping motor does not carry any winding. The rotor is made up of ferromagnetic material.

A schematic view of a bipolar hybrid stepping motor is shown in figure 2. It consists an axial permanent magnet at the two ends of which are attached tow identical ferromagnetic stacks as shown. These stacks consist of equal number of teeth and there are three

15 | P a g e

Page 16: INTERNAL GEAR PUMP

teeths on each stack. At one end the stack attains north magnetic polarity and at other end stack gets south magnetic polarity. The two stacks have an angular displacement of one half of the rotor tooth pitch.

Once the voltage is applied to the windings, the permanent magnet rotor of stepper motor assumes it unloaded holding position. This means that the permanent magnet poles of rotor are aligned according to the electromagnetic pole on the stator. The maximum torque with which the excited motor can be loaded without causing a continuous rotation is termed as stepper motor holding torque. A torque can also be perceived with a non-excited motor. This is because of the pole induction of permanent magnet on stator. This effect known as cogging together with motor internal friction produces detent torque, which is the torque with which a non-excited motor can be statically loaded.

16 | P a g e

Page 17: INTERNAL GEAR PUMP

17 | P a g e

Page 18: INTERNAL GEAR PUMP

PRINCIPLE OF OPERATION

The stepper motor is having a 10 pole rotor structure i.e. the rotor is axial permanent magnet type with ferromagnetic stacks of opposite polarities on the opposite ends. The numbers of stacks are 5 on each end. But for simplicity of the explanation of underlining we will first describe a simple PMDC stepper motor with two poles on rotor.

WORKING OF A SINGLE PMDC STEPPER MOTOR: -

A simple PMDC motor with two coils A A' and B B' wound on stator and the motor having a two pole structure is shown in figure along side. The operation of this motor is clearly described in steps

18 | P a g e

Page 19: INTERNAL GEAR PUMP

below with the corresponding figure showing the magnetic flux linkage between stator and rotor structures is shown along side:

Referring to figure 3. Now if the terminal A and B of stator windings are connected to the positive voltage, then two stator magnetic

field vectors Fa and Fb will be produced as shown in fig.3. The rotor will position itself in such a way as to lock its north pole to the resulting stator south pole and vice versa. The rotor will move in anti-clockwise direction.Refer figure 4. When the voltage polarity of coil A A' is revered with coil B B' energized a before, the resultant stator magnetic field vector

F will be at 900 from its former position. Hence the rotor will move

through a fixed angle of +900 as shown.

Refer figure 5. With coil A A' energized as before the voltage polarity

of coil B B' is reversed. The rotor will move through another 900 to align itself with the resultant stator magnetic field F as shown.

Refer figure 6. With coil B B' energized as before, the voltage polarity of coil A is again reversed. The motor will further move through

another 900 to align itself with the resultant stator magnetic field F as shown.

Refer figure 6. With coil A A' energized as before the voltage polarity of coil B B' is again reversed. The rotor will align itself as shown.

So the motor can be made to step in one direction by continuously changing the direction of current through these coils. To step in reverse direction the direction of current should be changed in reverse order through these coils. This method is called two phases on full step drive since the two-phase coils are energized together.

19 | P a g e

Page 20: INTERNAL GEAR PUMP

PRINCIPLE OF A SINGLE PMDC STEPPER MOTOR :-

The principle of operation of PMDC stepper motor having been clearly described above will now help us to have a clearer picture of working of hybrid stepper motor. We take the simpler case of 6 pole on the rotor structure and explain its working.

Referring to figure 7, 8, 9 the north poles are at the front end shown with full lines whereas the south poles are at far end shown with dotted lines.

When phase A winding is energized with current Ia North Pole at A and South Pole at A' are created on the stator. Pole at A attracts South Pole of far end and pole at A' attracts North Pole at front end as shown in figure 7.

This equilibrium position of rotor structure results in maximizing the flux linkages with the phase winding A. For turning the rotor clockwise through a step de-energies phase winding A and excite phase winding B so that North pole at B and South pole at B' are created on the stator. Pole at B attracts the pole of rear end and pole at B' attracts North Pole of front end, so a step angular rotation of 300 clockwise is achieved as in figure 8. In this equilibrium position, maximum flux linkages are now linked with phase winding B. If excitation is removed from phase winding B and reverse excitation is applied to phase winding A, pole on A attracts North pole and pole at A' attracts rear S pole as in figure 9. In this manner 12 steps will complete one revolution. Sequence of exciting the phase windings for clockwise rotation is A B A' B' A and therefore for anticlockwise rotation the sequence will be

A B' A' B A.

20 | P a g e

Page 21: INTERNAL GEAR PUMP

The magnitude of step angle

For Hybrid stepper motor = 3600/mP

Where m = number of stator phases P = number of poles on rotor structure.

The working of actual bipolar hybrid stepper motor used in the project can now be analogically understood. The only difference in the hybrid stepper motor described earlier and the one used in our project is that the numbers of poles on the rotor structure are different. In our motor we have 10-pole rotor structure i.e. 5 pole of North and South polarity on the two ends of an axial permanent magnet.

Some terms applicable to stepping motors are as under :

Step angle is the angle through which the shaft rotates in response to one input pulse.

Single step resolution is inversely proportional to step angle. Smaller the step angle greater the number of steps per revolution and therefore higher single step resolution.

At stand still the excited motor opposes the rotor rotation due to load torque. Holding torque is a term introduced for the measure of this opposing torque.

21 | P a g e

Page 22: INTERNAL GEAR PUMP

Thus holding torque is defined as the maximum load torque that can be applied to the shaft of an excited motor without continuous rotation.

In case motor is unexcited the permanent magnet hybrid stepping motors are able to develop a torque restricting the rotor rotation. The term detent torque is defined as the maximum load torque that can be applied to shaft of an unexcited motor without causing continuous rotation.

22 | P a g e

Page 23: INTERNAL GEAR PUMP

23 | P a g e

Page 24: INTERNAL GEAR PUMP

DATA SHEET

STEPPER MOTORType : Bipolar hybrid PMDC stepper motor.Source : Floppy disk drive of personal computer.No. of windings : 2on statorRated Current : 50 M amp. per winding.Resistance per : 120 mwindingStep angle : 180No. of steps : 20per revolution

DC SUPPLYType : AdapterMake : PanasonicRange : 10V, 500 mamp.

IC REGULATOR CHIPChip No. : L7805CMake : STVout : 5.0VTolerance : + 4%Iout : 500 mamp.Vin : 35 VPackage : T03

CONTROL CIRCUIT FOR STEPPER MOTOR WINDINGS

24 | P a g e

Page 25: INTERNAL GEAR PUMP

SIMULATING THE BASIC IDEA

The basic control circuit for stepper motor can be easily understood by referring to figure 3,4,5,6. The motor will step in one direction if the voltages to the coil A coil B are applied as in table1.

TABLE -1

Step Coil A Coil B

1 +V +V

2 -V +V

3 -V -V4 +V -V5 +V +V

If the voltage to the coil A and coil B are applied as shown in table 2 then motor steps in reverse direction.

TABLE -2

Step Coil A Coil B

1 +V +V 2 -V +V 3 -V -V 4 +V -V 5 +V +V

25 | P a g e

Page 26: INTERNAL GEAR PUMP

DC MOTORS VS. STEPPER MOTORS

Stepper motors are operated open loop, while most DC motors are operated closed loop.

Stepper motors are easily controlled with microprocessors, however logic and drive electronics are more complex.

Stepper motors are brushless and brushes contribute several problems, e.g., wear, sparks, electrical transients.

DC motors have a continuous displacement and can be accurately positioned, whereas stepper motor motion is incremental and its resolution is limited to the step size.

Stepper motors can slip if overloaded and the error can go undetected. (A few stepper motors use closed-loop control.)

Feedback control with DC motors gives a much faster response time compared to stepper motors.

26 | P a g e

Page 27: INTERNAL GEAR PUMP

ADVANTAGES OF STEPPER MOTORS

Position error is noncumulative. A high accuracy of motion is possible, even under open-loop control.

Large savings in sensor (measurement system) and controller costs are possible when the open-loop mode is used.

Because of the incremental nature of command and motion, stepper motors are easily adaptable to digital control applications.

No serious stability problems exist, even under open-loop control.

Torque capacity and power requirements can be optimized and the response can be controlled by electronic switching.

Brushless construction has obvious advantages.

DISADVANTAGES OF STEPPER MOTORS

They have low torque capacity (typically less than 2,000 oz-in) compared to DC motors.

They have limited speed (limited by torque capacity and by pulse-missing problems due to faulty switching systems and drive circuits).

They have high vibration levels due to stepwise motion.

Large errors and oscillations can result when a pulse is missed under open-loop control.

27 | P a g e

Page 28: INTERNAL GEAR PUMP

STEPPER MOTOR BASICS

STEPPER MOTOR STATES FOR MOTION

The above figure is the cross-section view of a single-stack variable-reluctance motor. The stator core is the outer structure and has six poles or teeth. The inner device is called the rotor and has four poles. Both the stator and rotor are made of soft steel. The stator has three sets of windings as shown in the figure. Each set has two coils connected in series. A set of windings is called a “phase”. The motor above, using this designation, is a three-phase motor. Current is supplied from the DC power source to the windings via the switches I, II, and, III.

28 | P a g e

Page 29: INTERNAL GEAR PUMP

Starting with state (1) in the upper left diagram, note that in state (1), the winding of Phase I is supplied with current through switch I. This is called in technical terms, “phase I is excited”. Arrows on the coil windings indicate the magnetic flux, which occurs in the air-gap due to the excitation. In state I, the two-stator poles on phase I being excited are in alignment with two of the four rotor teeth. This is an equilibrium state.

Next, switch II is closed to excite phase II in addition to phase I. Magnetic flux is built up at the stator poles of phase II in the manner shown in state (2), the upper right diagram. A counter-clockwise torque is created due to the “tension” in the inclined magnetic flux lines. The rotor will begin to move and achieve state (3), the lower left diagram. In state (3) the rotor has moved 15°.

When switch I is opened to de-energize phase I, the rotor will travel another 15° and reach state (4). The angular position of the rotor can thus be controlled in units of the step angle by a switching process. If the switching is carried out in sequence, the rotor will rotate with a stepped motion; the switching process can also control the average speed.

STEP ANGLE

The step angle, the number of degrees a rotor will turn per step, is calculated as follows:

29 | P a g e

Page 30: INTERNAL GEAR PUMP

For this motor:

BASIC WIRING DIAGRAM

30 | P a g e

Page 31: INTERNAL GEAR PUMP

TWO PHASE STEPPER-MOTOR WIRING DIAGRAM

The above motor is a two-phase motor. This is sometimes called UNIPOLAR. The two-phase coils are center-tapped and in this case they the center-taps are connected to ground. The coils are wound so that current is reversed when the drive signal is applied to either coil at a time. The north and south poles of the stator phases reverse depending upon whether the drive signal is applied to coil 1 as opposed to coil 2.

STEP SEQUENCING

There are three modes of operation when using a stepper motor. The mode of operation is determined by the step sequence applied. The three step sequences are:

WAVE STEPPING

The wave stepping sequence is shown below.

31 | P a g e

Page 32: INTERNAL GEAR PUMP

Wave stepping has less torque then full stepping. It is the least stable at higher speeds and has low power consumption.

FULL STEPPING

The full stepping sequence is shown below.

Full stepping has the lowest resolution and is the strongest at holding its position. Clock-wise and counter clockwise rotation is accomplished by reversing the step sequence.

HALF-STEPPING – A COMBINATION OF WAVE AND FULL STEPPING

The half-step sequence is shown below.

32 | P a g e

Page 33: INTERNAL GEAR PUMP

The half-step sequence has the most torque and is the most stable at higher speeds. It also has the highest resolution of the main stepping methods. It is a combination of full and wave stepping.

MICROCONTROLLER

What is a microcontroller?

A microcontroller is used to control some process or aspect of the environment. A typical microcontroller application is the monitoring of a house. As the temperature rises, the controller causes the windows to open. If the temperature goes above a certain threshold, the air conditioner is activated. In addition, upon detecting that my computer is turned on, without any user interaction it should be turned off etc.

A microcontroller is a highly integrated chip, which includes, on one chip, all or most of the parts needed for a controller. The microcontroller could be called a "one-chip solution". It typically includes:

CPU (central processing unit) RAM (Random Access Memory) EPROM/PROM/ROM (Erasable Programmable Read Only

Memory) I/O (input/output) - serial and parallel Timers Interrupt controller

33 | P a g e

Page 34: INTERNAL GEAR PUMP

By only including the features specific to the task (control), cost is relatively low. A typical microcontroller has bit manipulation instructions, easy and direct access to I/O (input/output), and quick and efficient interrupt processing. Microcontrollers are a "one-chip solution" which drastically reduces parts count and design costs.

Microcontroller is also a general-purpose device that is meant to read data, perform calculations on that data and control its environment based on those calculations. The prime use of the microcontroller is to control the operation of a machine using a fixed program that is stored in the ROM and that does not change over the lifetime of the system.

The microcontroller design uses a much more limited set of single and double byte instructions that are used to move code and data from internal memory to the ALU. Many instructions are coupled with the pins on the integrated circuit package; the pins are programmable i.e. capable of having several functions depending upon the wish of the programmer. The microcontroller is concerned with getting the data from and to its own pins; the architecture and the instructions set are optimized to handle data in bit and byte size

CHARACTERISTICS OF MICROCONTROLLERS

Microcontrollers are "embedded" inside some other device (often a consumer product) so that they can control the features or actions of the product.

Microcontrollers are dedicated to one task and run one specific program. The program is stored in ROM (read-only memory) and generally does not change.

Microcontrollers are often low-power devices. A microcontroller is often small and low cost. The components

are chosen to minimize size and to be as inexpensive as possible.

34 | P a g e

Page 35: INTERNAL GEAR PUMP

Common examples of the microprocessor are as follows: INTEL’S 8086, 80186,80286 through the PENTIUM 4 MOTOROLA’S 6801 AND MC68HC11

Microcontroller vs microprocessor: A comparison

• The contrast between microcontroller and microprocessor is the best exemplified from the fact that most microprocessors have many operational codes (opcodes) for moving data from the external memory to the CPU. But the microcontroller may have one or two operational codes.• Microprocessor may have one or two bit handling instructions but the microcontroller has many bit handling instructions.• Microprocessor is concerned with the rapid movement of the data and the code from the external address to the chip and the microcontroller is concerned with the rapid movement of the bits into the chip.• The microcontroller can function as a computer with addition of no external digital parts whereas the microprocessor has many additional parts to be operational.• The microprocessor is intended to be special purpose digital computer.

35 | P a g e

Page 36: INTERNAL GEAR PUMP

FAMILIES & TYPES OF MICROCONTROLLERS:

THE INTEL 8051 FAMILY- It was in the year 1980 that Intel Corporation introduced a powerful series of microcontrollers, Intel 8051.Family members of this series are:80C51BH80C31BH87C518X52/54/588CX51FX8XL52/54/588XL51FA/FB/FC

8XC51RA/RB/RC8XC51GB8XC51SL8XC152JA/JB/JC(X IS 0 FOR ROM LESS VERSIONS, 3 FOR VERSIONS WITH ROM, 7 FOR VERSIONS WITH EPROM)

SOME OTHER MICROCONTROLLERS ARE:#TEXAS INSTRUMENT’S TMS1000#MOTOROLLAS 6801 AND MC68HC11#ZILOG’S Z8#NEC’S 7800 SERIES

36 | P a g e

Page 37: INTERNAL GEAR PUMP

MERITS OF A GOOD MICROCONTROLLER:

A good microcontroller must satisfy the following criteria:

1.It should meet the computing needs of the task at hand both efficiently as well as cost effectively. Other considerations include#Speed#Packaging#Power consumption#The size of RAM\ROM on the chip#Number of input pins and timer on the chip#Ease of up gradation to higher performance or lower power consumption variants. 2. Easy availability of software development tools like compilers, assemblers and debuggers using which the device can be programmed easily.

3. Wide variety and reliable sources of procuring the microcontroller.

37 | P a g e

Page 38: INTERNAL GEAR PUMP

NOMENCLATURE OF MICROCONTROLLERS:

The naming scheme of a microcontroller follows a set of rules that gives vital information regarding the characteristics of that particular microcontroller. For example the name AN83C51FA tells the following about the microcontroller:

A N 8 3 C 51FA

PROGRAM MEMORY 0=ROMLESS

3=ROM 7=EPROM OR OTP

PACKAGE TYPE OPTION: P=PLASTIC DIP, 40 PIN

N=PLASTIC,LEADEDCARRIER (PLCC),44 PIN TEMPERATURE OPTION

ARCHITECTURE OF THE MICROCONTROLLER:

The architecture of the 8051 microcontroller consists of these specific features:

Eight bit CPU with registers A (accumulator) and B Sixteen bit program counter (PC) and data pointer (DPTR) Eight bit program status word (PSW) Eight bit stack pointer (SP) Internal RAM of 128 bytes Thirty two input\output pins arranged as four eight pin ports Two 16 bit timer counters Full duplex serial data receiver\transmitter Control registers

38 | P a g e

Page 39: INTERNAL GEAR PUMP

Two external and three internal interrupt sources Oscillator and clock circuits

THE 8051 OSCILLATOR AND CLOCK:

The heart of the 8051 is the circuitry that generates the clock pulses by which all internal operations are synchronized. Pins XTAL1 AND XTAL2 are provided for connecting a resonant network to form an oscillator.Manufacturers make available 8051 designs that can run at frequencies ranging from 1 MHz to 16 MHz. The oscillator generates a pulse train at the frequency of the crystal. The clock frequency establishes the smallest interval of time within the microcontroller called the pulse, This pulse is used to synchronize and control all the operations of the microcontroller.

PROGRAM COUNTER AND DATA POINTER:

A 8051 contains two 16 bit registers which are the program counter (PC) and the data pointer (DPTR).Each is used to hold the address of a byte in a memory. Program instruction bytes are fetched from location in memory that are addressed by the PC. The PC is automatically incremented after every instruction byte is fetched and may also be altered by certain instructions

The DPTR register is made of two 8 bit registers DPH & DPL which are used to furnish addresses for internal &external code access and external data access .

39 | P a g e

Page 40: INTERNAL GEAR PUMP

A & B CPU REGISTERS:

These registers hold result of many instructions particularly of mathematical and logical ones.The A register is the most versatile of the two CPU registers and is used for many operations like addition, subtraction, multiplication and division and Boolean bit manipulations. It is also used for all data transfers between the 8051 and external memory. The B register is used in conjunction with the A register during multiplication and division and is used as a data storage location.

INTERNAL MEMORY:

The 8051 has internal RAM & ROM memory which can be used for program code bytes and to store variable data that can be altered as the program runs.The 8051 is also equipped with a stack .The stack refers to an area of internal RAM that is used in conjunction with certain opcodes to store and retrieve data quickly. The 8 bit stack pointer is used by the 8051 to hold an internal RAM address that is called top of the stack. The address held in the SP register is the location in internal RAM where the last byte of data was stored by a stack operation.When data is to be placed on the stack, the SP increments before storing data on the stack so that the stack grows up as data is stored. As data is retrieved from the stack, byte is read and then the SP decrements to point to the next available byte of stored data. The 8051 operations that do not use the internal 128 byte RAM addresses are done by a group of specific internal registers each called a special function register (SFR) and may be addressed much like the internal RAM.

40 | P a g e

Page 41: INTERNAL GEAR PUMP

COUNTERS AND TIMERS:

Many microcontroller applications require the counting of external events, which can be done using two 16 bit up counters called T0 and T1. Each counter may be programmed to count internal clock pulses, acting as timer or programmed to count external pulses as a counter. Timers may be used in mode one, two or three.

THE PSW REGISTER

The Program Status Word or the flag register an 8 bit register. However only 6 bits are used. Four of these flags are conditional flags. These are as follows:

CY, The Carry Flag:This flag is set if there is a carry out from the d7 bit. It is affected by 8-bit addition or subtraction. This can be set to 1 or 0.

AC, The Auxiliary Carry FlagIf there is a carry from D3 to D4 during addition or subtraction this bit is set.

P, The Parity FlagIf the accumulator has odd number of ones then this flag is set to 1 or else it is equal to zero.

OV, The Overflow FlagThis flag is set whenever the result of a signed number operation is large causing the higher order bit to overflow into the sign bit.

The unconditional flags are RS0 and RS1 and are used to select a register bank if one different from the default one is desired to be used.

CY AC RS0 RS1 OV P

THE PSW REGISTER

41 | P a g e

Page 42: INTERNAL GEAR PUMP

INTERRUPTS:

A computer program has only two ways to determine the conditions in internal and external circuits. One method uses software instructions and the other uses hardware signals called interrupts that force the program to call a subroutine. Software techniques take up the processor time that could be put to other uses while interrupts take processor time action by the program is needed and are therefore preferred.Interrupts may be generated by internal chip operations or provided by external sources. Any interrupt can cause the 8051 to perform a hardware call to an interrupt handling subroutine that is located at a predetermined absolute address in program memory.

ASSEMBLING AND RUNNING OF AN 8051 PROGRAM In order to put the microcontroller to any use we need to program it according to the need. Programs for microcontrollers are generally written in assembly language. Many editors or word processors are available that can be used to create and/or edit the program. A widely used editor is the MS-DOS EDIT program (or the notepad in Windows), which comes with all the Microsoft operating systems. Notice that the editor must be able to produce an ASCII file. For many assemblers, the file names follow the usual DOS conventions; but the source file has the extension “asm” or “src”, depending on which assembler is being used. An assembler in the next step uses the “asm” extension for the source file.The “asm” source file containing the program code created in the previous steps fed to an 8051 assembler. The assembler converts the instructions into the machine codes.

42 | P a g e

Page 43: INTERNAL GEAR PUMP

The assembler will produce an object file and a list file. The extension for the object file is “obj” while the extension for the list file is “lst”.Assemblers require a third step called linking. The link program takes one or more object files and produces an absolute object file with the extension “abs”. This abs file is used by the 8051 trainers that have a monitor program. Next the “abs” file is fed into a program called “OH” (object to hex converter) which creates a file extension “hex” that is ready to burn into ROM.This program comes with all 8051 assemblers.

43 | P a g e

Page 44: INTERNAL GEAR PUMP

PROJECT DESCRIPTION

In this project, a bipolar stepper motor is used, which is used widely in all kinds of floppy drives and CD drives. Specifications of the motor follow:

Maximum voltage: 5V DC

Maximum revolutions per minute (RPM): 1000

Step resolutions: 18 degrees per pulse

The bipolar stepper motor uses two coils, which have two terminals each.

There are three parameters of the stepper motor that can be controlled: direction, speed and number of rotations.

Direction : -

To change the direction of the motor, you have to change the sequence of pulses applied to its coils. The pulse sequence for clock-wise and anticlockwise rotation is shown in the table on the next page for better understanding. In the table, ‘0’ and ‘1’ indicate low logic, and high logic, respectively.

Speed: -

The speed of the motor can be changed by varying the pulse repetition frequency (PRF). PRF is the frequency of pulses that are applied to the motor coils in sequence. 20 PRF means 20 pulses will be given to the stepper motor in one second. Now because step resolution of the motor is 18 / pulse, the motor will rotate 2018 =

44 | P a g e

Page 45: INTERNAL GEAR PUMP

360 (i.e., one complete revolution) in one second. So the speed of the motor is 1 RPS (60 RPM). Now if you increase PRF from 20 Hz to 40 Hz, the RPS will also double to 2 RPS (120 RPM).

Number of rotations: -

The step resolution is 18 / pulse. This means that if you apply one pulse, the motor will rotate only 18. If you apply 20 pulses in series, the motor will rotate 360, which means one complete revolution. So if you limit the number of pulses applied to the motor, you can restrict it to rotate the desired number of rotations.

45 | P a g e

Page 46: INTERNAL GEAR PUMP

CIRCUIT DESCRIPTION

Fig. 1: Circuit of microcontroller-based stepper motor controller

Fig. 1 shows the circuit of the microcontroller-based stepper motor controller. Microcontroller AT89C51 (IC1) is at the heart of the circuit, which can control all functions of the stepper motor. It is interfaced with six tactile switches, five light-emitting diodes (LEDs) and coils of the stepper motor. Port pins P0.0 through P0.4 of AT89C51 are

46 | P a g e

Page 47: INTERNAL GEAR PUMP

connected to LED1 through LED5 for indications of key-press, clockwise rotation, anticlockwise rotation, RPM and number of rotations, respectively. Port pins P1.0 through P1.5 are connected to switches S2 through S7 to control clockwise and anticlockwise rotation, in crement RPM, decrement RPM, increment the number of rotations and decrement the number of rotations, respectively. Port pins P2.0 through P2.7 are used to interface the stepper motor coils.

A 12MHz crystal produces clock frequency for the microcontroller. Pin 21 through 28 of IC1 are connected to input pins of inverters N1 through N8. The outputs of inverters N1 through N8 are connected to the bases of npn transistors 2N2222 through 1-kilo-ohm resistors. These transistors are used for the H-bridge stepper motor driver circuit.

Fig. 2. Stepper motor driver circuit

Fig. 2 shows the stepper motor driver circuit. Since there are two coils in the bipolar stepper motor, we need two H-bridge circuits, one for each coil. The first H-bridge comprises transistors T1 through T4. The

47 | P a g e

Page 48: INTERNAL GEAR PUMP

first coil of the motor with red and blue terminals is connected to this section as shown in Fig. 2. Transistors T5, T6, T7 and T8 from another H-bridge and second coil of the motor with white and yellow terminals is connected to this section as shown in Fig. 2. The high input voltage to the base of the transistor will drive the transistor and current will pass through the coil. The pulse sequence applied to the coil is shown in the table.

Clockwise rotation::Initially, blue and yellow terminals are high and red and white

terminals are low. So to rotate the motor clockwise, you have to switch on transistor T2, T3, T6 and T7 and switch off the remaining transistors. For this, apply hex data word CC (1100 1100).

For the next sequence, red and yellow terminals are high and blue and white terminals are low. So you have to switch on transistors T1, T4, T6 and T7 and switch off the rest. For this apply hex data word 3C (0011 1100).

Next, red and white terminals are high and blue and yellow terminals are low. So you have to switch on transistors T1, T4, T5 and T8 and switch off the rest. The hex data word will be 33 (0011 0011).

Finally, red and yellow terminals are low and blue and white terminals are on high logic. So transistors T2, T3, T5 and T8 should be ‘on’ and the rest should be ‘off’. For this, apply hex data word C3 (1100 0011). Thus the complete sequence needed to rotate the motor clockwise is CC-3C-33-C3.

Anticlockwise rotation::As shown in the table for clockwise rotation, the only change for

anticlockwise rotation is that here the current changes its direction in

48 | P a g e

Page 49: INTERNAL GEAR PUMP

coil 2 first and then in coil1. So for anticlockwise rotation, the pulse sequence will be CC-C3-33-3C. This pulse sequence is applied to the motor with appropriate delay (depending upon the RPM) until the motor completes the desired number of rotations.

Fig. 1 shows the circuit of the power supply. The AC mains is stepped down by transformer X1 to deliver a secondary output of 7.5V at 500 mA. The transformer output is rectified by a full-wave bridge rectifier comprising diodes D1 through D4, filtered by capacitor C3 and regulated by IC4. Capacitor C4 bypasses any ripple present in the regulated output. Regulated 5V DC is used to power the circuit.

The actual-size, single-side, single-side PCB for the microcontroller-based stepper motor controller (Fig.1) is shown in Fig.3 and its component layout in Fig.4.

Fig. 3: Actual-size, single-side PCB layout for microcontroller-based stepper motor controller

49 | P a g e

Page 50: INTERNAL GEAR PUMP

Fig. 4: Component layout for the PCB in Fig. 3

Clock and reset circuit – Two 33pF capacitors (C4 and C5 are connected to pins 18 and 19 of the microcontorller, respectively, with an 11.059MHz piezo electric crystal (XTALI) across them. The clock frequency of the microcontroller depends on the frequency of the crystal oscillator used. Typically, the maximum and minimum frequencies are 1 MHz and 16 MHz, respectively, so we should use a piezoelectirc crystal with a frequency in this range. The speed of the stepper motor is proportional to the frequency of the input pulses or it is inversely proportional to the time delay between pulses, which can be achieved through software by making use of instruction execution time.

50 | P a g e

Page 51: INTERNAL GEAR PUMP

The time taken by any instruction to get executed can be computed as follows:

Time = C 12 F

Where ‘C’ is the number of cycles an instruction takes to execute and ‘F’ is the crystal frequency. SOFTWARE

The software program is written in Assembly language and assembled using 8051 cross-assembler (ASM 51). It is well commented and easy to understand. Port P1 is initialized as the input port. Data FFH is sent to port P1 and all its pins become high. The program continuously checks port-P1 pins for low status. When any port-P1 pin goes low, it goes into the comparison mode. After comparison, it decides a particular action. LEDs glow to indicate the action. Subroutines clkwise, aclkwise, incrpm, decrpm, incnum and decnum are used for clockwise rotation, anticlockwise rotation, incrementing RPM, decrementing RPM, incrementing the number of rotations and decrementing the number of rotations, respectively.

Applied Pulse Sequence for ClockwiseAnd Anticlockwise Rotation

Clockwise rotation Anticlockwise rotation

Red Blue White Yellow Red Blue White Yellow

0 1 0 1 0 1 0 1

1 0 0 1 0 1 1 0

1 0 1 0 1 0 1 0

0 1 1 0 1 0 0 1

51 | P a g e

Page 52: INTERNAL GEAR PUMP

PARTS LIST

Semiconductor:

IC1 AT89C51 microcontrollerIC2, IC3 7404 hex inverterIC4 7805 5V regulatorT1- T8 2N2222 npn transistorD1-D4 IN4007 rectifier diodeLED1-LED6 5mm light-emitting diode

Resistors (all ¼-watt, 5% carbon):

R1-R8 1-kilo-ohmR9-R14 220-ohmR15 4.7-kilo-ohm

Capacitors:

C1, C2 33pF ceramic diskC3 1000F, 16V electrolyticC4 0.1F ceramic desk

Miscellaneous:

X1 230V AC primary to 7.5V,500mA secondary transformer

XTALPush-to-on tactile switchS1-S7 Stepper motor 18 per step angle

52 | P a g e

Page 53: INTERNAL GEAR PUMP

Robot BasicsThe vast majority of robots do have several qualities in common. First of all, almost all robots have a movable body. Some only have motorized wheels, and others have dozens of movable segments, typically made of metal or plastic. Like the bones in your body, the individual segments are connected together with joints.Robotic Arm ControlRobots have become important over a wide range of applications--from manufacturing, to surgery, to the handling of hazardous materials. Consequently, it's important to understand how they work, and what problems exist in designing effective robots. This project will address one of those problems: positional control.

One of a robot's functions is to move to a specified location or along a predetermined path so it can perform a task. Motion may consist of the robot itself moving, or of an articulated arm being actuated from a fixed pivot position. Here we want to consider the problem of controlling the motion of a very simple articulated arm--a two-segment arm that can move only in the x-y plane and pivots about the position x=0, y=0. A stepper motor M1 at (0,0) is attached to the first arm segment L1 and controls the angle of L1 with respect to the x-axis. A second stepper motor M2, afixed to the end of L1, is attached to a second arm segment L2 and controls its angle with respect to the x-axis. Each arm segment is 100 units long, for a total maximum extension of 200 units. Neither of the arm segments may move below the base, i.e., y = 0.

53 | P a g e

Page 54: INTERNAL GEAR PUMP

DATASHEET

FOR ATMEL

AT89C51

54 | P a g e

Page 55: INTERNAL GEAR PUMP

55 | P a g e

Page 56: INTERNAL GEAR PUMP

56 | P a g e

Page 57: INTERNAL GEAR PUMP

57 | P a g e

Page 58: INTERNAL GEAR PUMP

58 | P a g e

Page 59: INTERNAL GEAR PUMP

59 | P a g e

Page 60: INTERNAL GEAR PUMP

60 | P a g e

Page 61: INTERNAL GEAR PUMP

Assembly Language Program:

$MOD51uf1 equ 2fhuf2 equ 2eh

org 0000h mov 2ah,#32h mov 2bh,#01h mov 2ch,#05h mov 2dh,#01h clr uf1 clr uf2 mov r0,#01h mov p1,#0ffh lop: mov a,p1 cjne a,#0ffh,jp ajmp lop

jp: clr p0.0

loop: rrc a jnc num inc r0 sjmp loop num: acall delay setb p0.0 cjne r0,#01h,nxt acall clkwise sjmp over

61 | P a g e

Page 62: INTERNAL GEAR PUMP

nxt: cjne r0,#02h,nxt2 acall aclkwise sjmp over nxt2: cjne r0,#03h,nxt3 jnb uf1,ledoff setb p0.3 ledoff: acall incrpm sjmp over nxt3: cjne r0,#04h,nxt4 jnb uf1,ledof setb p0.3 ledof: acall decrpm sjmp over nxt4: cjne r0,#05h,nxt5 jnb uf2,of setb p0.4 of: acall incnum sjmp over nxt5: cjne r0,#06h,over acall decnum

over: mov p2,#0ffh mov p1,#0ffh mov r0,#01h sjmp lop clkwise: mov r3,2ch

rot: clr p0.1 mov p2,#33h acall delay

62 | P a g e

Page 63: INTERNAL GEAR PUMP

mov p2,#3ch acall delay setb p0.1 mov p2,#0cch acall delay mov p2,#0c3h acall delay djnz r3,rot ret aclkwise: mov r3,2ch

rott: clr p0.2 mov p2,#33h acall delay mov p2,#0c3h acall delay setb p0.2 mov p2,#0cch acall delay mov p2,#3ch acall delay djnz r3,rott ret incrpm: clr p0.3 mov r4,2bh cjne r4,#0ah,incr setb uf1 ajmp out incr: inc 2bh mov b,2bh mov a,#32h div ab mov 2ah,a acall dely setb p0.3

63 | P a g e

Page 64: INTERNAL GEAR PUMP

out: ret

decrpm: clr p0.3 mov r4,2bh cjne r4,#01h,decr setb uf1 ajmp out1 decr: dec 2bh mov b,2bh mov a,#32h div ab mov 2ah,a acall dely setb p0.3 out1: ret

incnum: clr p0.4 inc 2dh mov a,#05h mov b,2dh mul ab mov 2ch,a acall dely setb p0.4 ret decnum: clr p0.4 mov r4,2dh cjne r4,#01h,decn setb uf2 ajmp out2 decn: dec 2dh mov a,#05h mov b,2dh mul ab mov 2ch,a acall dely

64 | P a g e

Page 65: INTERNAL GEAR PUMP

setb p0.4 out2: ret

delay: mov r1,2ah lp5: mov r2,#0c8h

lp4: nop nop nop djnz r2,lp4 djnz r1,lp5 ret dely: mov r6,#0ffh

lp2: mov r7,#0c8h

lp1: nop nop nop djnz r7,lp1 nop nop djnz r6,lp2 ret end

65 | P a g e

Page 66: INTERNAL GEAR PUMP

C Code For rotation (Interrupt based)

#include<c51rd2.h>

void clkwise(void);void anticlk(void);void delay(void);

void main(void){ P2=0xff; P1=0xff; while(1) { if(P1==0xbf) { clkwise(); } else if(P1==0xdf) { anticlk(); } }} void clkwise(void){ P2=0xcc; delay(); P2=0x3c; delay(); P2=0x33; delay(); P2=0xc3; delay(); P2=0xff;

66 | P a g e

Page 67: INTERNAL GEAR PUMP

} void anticlk(void){ P2=0xcc; delay(); P2=0xc3; delay(); P2=0x33; delay(); P2=0x3c; delay(); P2=0xff;} void delay(void) { int i=1,tick=0; while(i) { tick++; if(tick==200) { tick=0; i=0; } } }

67 | P a g e

Page 68: INTERNAL GEAR PUMP

CONCLUSION

This project has been successfully completed. With the help of this project, we can control various parameters of a stepper motor. This can be used to precisely simulate a human arm.

In the world of automation, stepper motor is regarded as a milestone in robotic industry. With its accuracy extending to small angles it is used in almost every field of robotics.

Our project is a stepping stone towards complex robotics. This project bridges the gap between diverse branches i.e. Electrical, Electronics & Mechanical.

BIBLIOGRAPHY

68 | P a g e

Page 69: INTERNAL GEAR PUMP

“The 8051 Microcontroller and Embedded Systems “,Muhammad Ali Mazidi &

Janice Gillispie Mazidi , PEARSON Education

“The 8051 microcontroller second edition”, Kenneth J. Ayala

“Electronics For you“ , November 2006, Stepper Motor Controller using

AT89C51, A.M. Bhatt, Page 66

“Robotics”, K.S. Fu, R.C. Gonzales, C.S.G Lee, Mc-Graw Hill International

Editions.

http:// www.wikipedia.com

http://computer.howstuffworks.com/microprocessor1.htm/

http://www.atmel.com

69 | P a g e