Design Project

81
THE UNIVERSITY OF THE WEST INDIES ST. AUGUSTINE, TRINIDAD & TOBAGO, WEST INDIES FACULTY OF ENGINEERING Department of Electrical & Computer Engineering BSc. in Electrical & Computer Engineering ECNG 2005 Lab and Project Design III Individual Design Project PI Control of a DC Motor Using a Peripheral Interface Controller Dale Persad 810000263 Group E Course Lecturer: Mr. Marcel Byron

description

PI DC motor control

Transcript of Design Project

Page 1: Design Project

THE UNIVERSITY OF THE WEST INDIES

ST. AUGUSTINE, TRINIDAD & TOBAGO, WEST INDIES

FACULTY OF ENGINEERING

Department of Electrical & Computer Engineering

BSc. in Electrical & Computer Engineering

ECNG 2005

Lab and Project Design III

Individual Design Project

PI Control of a DC Motor Using a

Peripheral Interface Controller

Dale Persad

810000263

Group E

Course Lecturer: Mr. Marcel Byron

Date Submitted: April 19th, 2013

Page 2: Design Project

Abstract Outlined in this project are the design and construction details of a DC motor controller which

utilises a PI control strategy. This design was done taking into consideration, the design

requirements which were outlined in the project outline (Engineering 2013) such as current limiting,

current sensing, and voltage regulation. Other general requirements which were taken into

consideration are, standards, laboratory protocol ad industrial standards. This design was also done,

in a safe and environmentally conscience manner, taking into consideration, the users and

stakeholders involved.

ii

Page 3: Design Project

Table of ContentsAbstract................................................................................................................................................. ii

Table of Figures..................................................................................................................................... iv

List of Tables..........................................................................................................................................v

1 Introduction...................................................................................................................................1

2 Background Theory........................................................................................................................2

2.1 DC motor Operation..............................................................................................................2

2.2 Existing Control Schemes for a DC motor and their Advantages and Disadvantages.............4

2.3 Existing Motor Protection and Current Sensing Technology................................................11

2.4 Existing Approaches to Implementation of Control Algorithm............................................14

2.5 Existing Approaches for the Measurement of Motor Speed................................................15

3 Design Approach and Methodology............................................................................................16

3.1 Design Brief..........................................................................................................................16

3.2 Product Design Specification...............................................................................................19

3.3 Concept design and Evaluation............................................................................................21

3.4 Motor & Controller design...................................................................................................25

3.5 Implementation of PI Controller and Data Processing.........................................................35

3.6 Other Design Considerations...............................................................................................39

4 Results and Analysis.....................................................................................................................48

4.1 Presentation of Results........................................................................................................48

4.2 Discussion............................................................................................................................51

4.3 Conclusion...........................................................................................................................52

5 References...................................................................................................................................53

iii

Page 4: Design Project

Table of FiguresFigure 1 Components of a DC motor.....................................................................................................2

Figure 2 Fleming's Left Hand Rule (TeacherTube 2010).........................................................................3

Figure 3 Block Diagram showing Proportional Control..........................................................................7

Figure 4 Block Diagram showing Integral Control..................................................................................8

Figure 5 Block Diagram showing Derivative Control..............................................................................9

Figure 6 Gantt chart.............................................................................................................................18

Figure 7 Block diagram of System........................................................................................................23

Figure 8 DC motor equivalent Circuit..................................................................................................25

Figure 9 DC Motor Signal Flow............................................................................................................29

Figure 10 Simplified DC Motor block diagram.....................................................................................30

Figure 11 Characteristic Graphs of DC Motor (Jameco n.d.)................................................................31

Figure 12 Block diagram of system......................................................................................................32

Figure 13 Complete block diagram......................................................................................................33

Figure 14 Step response of system transfer function..........................................................................34

Figure 15 Step response with compensator........................................................................................34

Figure 16 Simple Flow Diagram of System...........................................................................................35

Figure 17 PI control Flow Chart...........................................................................................................35

Figure 18 Sixteen bit addition Routine................................................................................................36

Figure 19 Sixteen by Eight Division Routine.........................................................................................36

Figure 20 Display Output Flowchart....................................................................................................39

Figure 21 Phototransistor optical interrupter switch..........................................................................40

Figure 22 Display wiring (Best-Micocontroller-Projects 2013).............................................................41

Figure 23 External hardware design....................................................................................................42

Figure 24 Risk Assessment Key............................................................................................................45

Figure 25 Step Response of closed Loop control System.....................................................................48

Figure 26 Step Response with Compensator.......................................................................................49

iv

Page 5: Design Project

List of TablesTable 1 Advantages and Disadvantages of Open Loop Control.............................................................5

Table 2 Advantages and Disadvantages of closed loop control.............................................................5

Table 3 Summary of Control Schemes...................................................................................................6

Table 4 Advantages and Disadvantages of Proportional Control...........................................................7

Table 5 Advantages and Disadvantages of Integral Control..................................................................8

Table 6 Advantages and disadvantages of derivative control................................................................9

Table 7 Methods used for DC motor protection..................................................................................12

Table 8 Summary of current sensing techniques.................................................................................13

Table 9 Control Algorithm Implementation.........................................................................................14

Table 10 Task description....................................................................................................................16

Table 11 Motor Parameters.................................................................................................................25

Table 12 Model parameters................................................................................................................25

Table 13 Conversion of Parameters to Laplace Domain......................................................................27

Table 14 Calculation of Ki and Kp..........................................................................................................32

Table 15 Microprocessor Peripherals..................................................................................................37

Table 16 Hardware Components.........................................................................................................37

Table 17 Different Oscillator modes....................................................................................................41

Table 18 Risk Assessment....................................................................................................................44

Table 19 Summary of Key Parameters.................................................................................................48

Table 20 Results of display testing.......................................................................................................49

v

Page 6: Design Project

1 IntroductionMotor control is very important in industry especially for the automation of processes. For this

design project it is required that one design and build a DC motor controller using PI control. This

simple circuit can be implemented in industry of example on a conveyor (ACS 2013), where it is

required for the conveyor to move at a constant speed irrespective of how much product is on top of

it. Therefore the circuit/conveyor should be able to monitor/measure its speed. If the speed drops or

increases above a threshold value, parameters must be adjusted so that the speed of the conveyor/

dc motor returns to its set speed. Finally, protection systems must be implemented to prevent

expensive damage to the circuit in the event of:

Over voltage and high currents for example during short circuit conditions.

High temperature conditions

1

Page 7: Design Project

2 Background Theory

2.1 DC motor OperationThis project is centred on the DC motor. More specifically a 6V brushed DC motor. In this section the

operation of this motor shall be explored by disassembling a DC motor from a Team Orion Racing RC

car.

Figure 1 Components of a DC motor

From the above diagram we can see two distinct parts, the stator and the rotor. The stator

comprises of two magnets, positioned opposite in polarity, whilst the rotor is metallic structure upon

which enamel coated copper wire is wound. The DC motor operates on the principle of

electromagnetism and is based on the following laws:

Lenz Law

This law states that an induced electromotive force or voltage in a conductor will produce a current

such that its direction will oppose the change which causes it. (McGraw-Hill 2010) From this law,

Flemings Left Hand rule was developed.

Fleming Left Hand Rule

His rule states that, the force which is produced due the Lenz’s law and the associated magnetic

field, will be at right angles to each other (Fleming 1902) as can be seen from the diagram below:

2

Stator Rotor

Brushes

Commutator

Armature Winding

DC MotorShaft

Permanent Magnets

Page 8: Design Project

Figure 2 Fleming's Left Hand Rule (TeacherTube 2010)

Therefore when a voltage is applied to the rotor this sets up a magnetic field. This magnetic field will

interact with the fixed magnets located on the stator. This reaction is such that the forces produced

will result in rotational motion.

Design features such as the DC motor’s brushes, along with split ring commutators feeding individual

armatures around the rotor which are shown below, allow for the switching of the direction current

flow so as to ensure the magnetic force which is produced is always opposite to the magnetic force

of the fixed magnets located in the stator. This therefore produces smooth rotational motion along

with increased torque.

Mathematical Analysis of DC motor

The DC motor operation can be represented using two main equations the first being:

F=BILsinθ Equation 1

Where:

F : Force

B : Magnetic Field Strength

I : Current

L : Length of Conductor

θ : Angle of conductor with respect to magnetic field

3

Page 9: Design Project

From the above equation, we can see that for the DC motor the Force is proportional to the,

magnetic field strength and by extension the current in the armature. In addition the length and

position of the conductor influences the magnitude of the force. From the above equation it can be

clearly seen that maximum force will be experienced when the conductor is positioned at right

angles to the magnetic field.

The second equation which can be used to investigate the DC motor is:

T=KT I Aϕ Equation 2

Where:

T : Torque

KT : Motor constant

IA : Armature current

ϕ : magnetic Flux

From Equation 2 we can infer that the motor of the DC motor is directly proportional to the current

and magnetic flux produced by the armature windings.

2.2 Existing Control Schemes for a DC motor and their Advantages and Disadvantages

Control schemes can be divided into two basic categories, open loop and closed loop systems. (Kuo

1991) These first two systems shall be examined using real life existing examples which utilised DC

motors.

Open Loop Control – The Electric Toothbrush

The electric toothbrush is a device which is used to brush one’s teeth and it utilises a DC motor in its

operation along with control circuitry. The function of the control circuitry within the tooth brush is

to decrease the speed of the bristles to provide a gentler brushing experience. (Oral-B 2013) It must

be noted that is control system does not use a feedback to determine if its output has being

achieved. Therefore if excessive force is applied to the toothbrush bristles causing decrease of

speed, control system within the tooth brush does not compensate for this by increasing the torque

of the DC motor.

From this example we can clearly see that with an open loop controller, output errors cannot be

corrected, therefore the system cannot compensate for disturbances in the system. This control

scheme is only used to simplify and reduce the cost of the toothbrush.

4

Page 10: Design Project

Table 1 Advantages and Disadvantages of Open Loop Control

Advantages Disadvantages

Control Circuitry only affects/filters the input.

Therefore simpler circuitry

Output is not monitored.

Low cost easy to implement circuit. Input cannot be adjusted based on output

No set point control

(Bucknell n.d.)

Closed Loop Control – Laptop Central Processing Unit Fan

The function is this system is cool the central processing unit of the laptop computer, CPU so as to

prevent overheating. (Erik Steel 2009) With closed loop systems, the output of the system, the

temperature of the CPU is continuously monitored so as to maintain a set point temperature. If at

any instant of time, the temperature increases above the threshold value, the output will be feed to

the input via a comparator which will increase the speed of the DC motor/fan until the temperature

returns to its set point value.

From the above example we can see that with closed loop control, verification of the output result is

achieved and maintained irrespective of disturbances. The table below outlines the advantages and

disadvantages of closed loop control. (Kuo 1991)

Table 2 Advantages and Disadvantages of closed loop control

Advantages Disadvantages

Maintenance of steady output can be achieved Complex to design

Careful tuning of output will result in an output

which can be easily predicted

More expensive to implement than open loop

control systems

Modelling and errors due to external sources

can be reduced

(Bucknell n.d.)

5

Page 11: Design Project

Open and Closed Loop can be further integrated with the following Control Schemes:

Table 3 Summary of Control Schemes

(Copeland 2013)

Proportional, Integral, Derivative Control and a combination of each are most commonly used in

industry especially for the control of the DC motor. As a result in the each of these control schemes

shall be investigated mathematically and their advantages and disadvantages outlined in the below.

6

For example Water pump using pressure switchWhen water pressure falls below a set point value electric motor is swtiched on

On/Off Control

Used in control systems in industry where it may be required for the DC motor to be activated based on some external logic input.

Logic Control/Fuzzy Logic Control

Used in electric conveyor systems where a constant speed is required. The torque and speed of the DC motor is adjusted based on the offset from the setpont value.This adjustment is made proportionally to the error.

Proportional Control

Used with DC motor systems with variable loads.The sum of the erros is fed back to the comparator.Produces zero steady state errorSlower responce time

Integral Control

Uses extrapolation to predict error.this error is then feed back to comparartorFaster than intergral Control

Derivative Control

Page 12: Design Project

Proportional Control

This form of control can be represented mathematically:

Pout=K pE (t) Equation 3

Where:

Pout = Proportional Term of Output

Kp = Proportion Gain

E(t) = Error: Output – Set Point

Laplace Domain transformation of Equation 3:

Gp(s) = Kp Equation 4

The above can be further represented using the block diagram below:

Figure 3 Block Diagram showing Proportional Control

From the above diagram it can be seen that the output of the system, Y(s) is fed back to the input,

U(s), where the difference between the set point and the output is calculated and multiplied by the

proportional gain, Kp which is then transmitted to the system to adjust the output.

If the value of Kp is large, system instability may occur due to the fact that a large error has to be

corrected. If the value of Kp is very small, then the system may take a long period of time to stabilise.

(Copeland 2013) These observations, along with others are presented in the table below:

Table 4 Advantages and Disadvantages of Proportional Control

Advantages Disadvantages

Accurate Analytical model need not be

designed so as to control system.

Does not reduce eliminated state error.

Simple to implement Oscillation of system may be experienced

Suitable for systems which do not require exact

overshoot, peak response and settling time.

Not suitable for systems requiring a set

overshoot and/or peak response and/or settling

time.

(Copeland 2013)

7

Page 13: Design Project

Integral Control

This form of control can be represented mathematically by:

I out=K i∫0

t

E (τ )dτ Equation 5

Where:

Iout = Integral of output

Ki = Tuning parameter of Integral Gain

E(t) = Error: Output – Set Point

Laplace Domain transformation of Equation 5:

Gi (s )=K i

s Equation 6

The above can be further represented using the block diagram below:

Figure 4 Block Diagram showing Integral Control

From the above block diagram we it can be seen that the integral or sum of the error over a time

interval is fed back to the input, where it is multiplied to the integral gain. After which it is fed back

into the system. If implement to a system which utilises a DC motor where a set point speed needs

to be maintained, the speed shall be adjusted based on how much time has passed and the

magnitude of the difference between the set point and output value. The table below outlines

further features of this system. (Copeland 2013)

Table 5 Advantages and Disadvantages of Integral Control

Advantages Disadvantages

Capable of reducing steady state error to zero Slow response time

Due to slow response time, large variation of

output may occur at the instant at which the

error occurs

(Bucknell n.d.) (Copeland 2013)

8

Page 14: Design Project

9

Page 15: Design Project

Derivative Control

This form of control can be represented mathematically by:

Dout=KD

dE( t)dt

Equation 7

Where:

Dout = Derivative of the Outputs

KD = Derivative gain of System

E(t) == Error: Output – Set Point

Laplace Domain transformation of Equation 7:

GP(s) = KD s Equation 8

The above can be further represented using the block diagram below:

Figure 5 Block Diagram showing Derivative Control

From the above diagram the characteristics of derivative control can be observed. This control

scheme finds the product of the rate of change of error over a period of time and multiples this error

by the KD or the derivative gain. (Smuts 2010) Advantages and disadvantages of this scheme shall be

explored in the table below:

Table 6 Advantages and disadvantages of derivative control

Advantages Disadvantages

Capable of reducing steady state error to zero Slow response time

Due to slow response time, large variation of

output may occur at the instant at which the

error occurs

(Smuts 2010)

10

Page 16: Design Project

Proportional Integral Control

This control scheme can be described as a mixture of both the proportional and integral control

systems as a result when implement with industrial DC motor systems, steady state error will be

reduced and set point control is also improved due to the introduction of a pole and zero into the

open loop of the transfer function. It must be noted however that PI control should be used in

situations where it is required that the system tolerates significant overshoot. (Wang 2001)

Proportional Integral Derivative Control

This control scheme incorporates all the features of Proportional Integral Control mentioned above,

with the addition of a faster response time. As previously mentioned one of the main disadvantages

of Integral Control is its slow response time. (Copeland 2013) It must be noted however that the

addition of derivative control not only increases the response time but also introduces inaccuracies

in the system due to the its tendency to magnify noise within the system. (Smuts 2010)

11

Page 17: Design Project

2.3 Existing Motor Protection and Current Sensing TechnologyIndustry DC motors are vital to many operations, as a result their failure will is significant downtime

and losses. The windings of the DC motor are most susceptible to damage as a result of:

Mechanical abuse – caused mechanical vibrations, lack of lubrication and lack of

maintenance

High temperature – this will result in the degradation of insulation leading to burn outs. The

temperature of a DC motor may rise dude to:

o High operational temperature

o High amperage in armature – may be due to over load of DC motor, a locked rotor or

short circuit condition along line.

o Lack of maintenance – Blockage of ventilation and lack of lubrication will increase

frictional forces within DC motor

Electrical Faults – this will result in a high current flow in windings resulting in burning of

insulation. Several factors can produce electrical faults:

o Internal Faults – this is causes by improper wiring and failure of insulation with in

the DC motor.

o Under voltage – this will result is high currents in the windings, which will produce

high temperatures due to I2R causing degradation of insulation leading to fault

conditions.

o Improper Operation – Over-speed, high duty cycle, and continue disconnection and

reconnection to voltage source produce overcurrent and overload conditions which

result is high temperatures, degradation of insulation and fault conditions.

(Blackburn 1998)

From the above we can see that it is imperative that systems be put in place to prevent overcurrent

and over-temperature conditions with the DC Motor. The table below lists some methods used in

industry for DC motor protection and Current and Temperature Sensing:

12

Page 18: Design Project

Table 7 Methods used for DC motor protection

(Miller and Miller 2008)

From the above we can clearly see that most of these protection systems rely on its ability to

measure/sense current. In this section, exactly how this is done in industry shall be explored.

13

Bi-Metal Switches - this deform as temperature increase. If set point is exceeded, a switch is tripped, diconnecting motor.Thermistors - incoperated with current sensing circuit. As temperature increases, resistance decrease, therefore current rises to a set point which will disconnect DC motor using a relay

Thermal Overlad Relays

In the event of a short circuit condition and rating of fuse is exceeded, filament with file will burn out resulting is isolation of DC motor

Fuses

In the event of the loss of a winding, dangerous overspeed conditions may occure. Relays incoperated with current sensing circuitry will isolated DC motor.

Loss of Field Relays

Locked rotor conditions which can result in excessive heating and over current conitions are prevented using this device.When power is applied the control system aticipates a responce from the zero speed switch. If the the switch does not swtich state within a set time, the DC motor is isolated.

Zero Speed Switch

This protects the DC Motor from surges, harmonics and transients from source.This is achieved by simply using an isolation transformer along with filters/line conditioning circuitry.

Source Protection

Page 19: Design Project

Current Sensing Techniques

Table 8 Summary of current sensing techniques

(Microchip 2010) (NKT n.d.)

14

This a comprised of a calibrated resistor place in the current path. It produces a voltage drop which is proportional to the current flow according to Ohm's Law. This voltage drop is then amplified by an operation amplifier for easy measuring or operation of cut off componentsThis circuit can be configured for either Unidirectional Low Side current sensing or High Side current sensing.

Resistive Shunt

This non contact form of current sensing is based on the prinicple of induction, where for a given current flow, a proprtional magnetic filed will be produced.This magnetic field produces an EMF due to Faraday's law, which is amplifed and measured.This design and safer and more accurate due to its non contact design, no insertion impedance is introduced.

Hall Effect Sensor

This system is made up of a wire which is wound around the current carrying conductor.Due to Faraday's law a voltage is inducted in the the wire.Conditioning circuitry along with an operational amplifier work together to create an accurate and isolated form of current sensing.

Inductive Sensors

Page 20: Design Project

2.4 Existing Approaches to Implementation of Control AlgorithmThe table below outlines some approaches used for the implementation of control algorithms:

Table 9 Control Algorithm Implementation

(KronoTech n.d.) (Xilinx 2012) (Microchip 2010)

15

Algorithm can be implemented using C based code or assembly language.Uses Pluse Width Modulation, PWM which sets a fixed frequency and variable duty cycle.Normally integrated with electronics such as Transistors, Thyristors and H-Bridges to provide the required motor driving wattage.H-Bridges utilises Sign Mgnitude bits whose primary function is to not only vary the power but to switch the rotation of the motor.Locked Anitphase is another version motor control implemented through a H-Bridge and Microcontroller set up. Its function is very similar to that of the Sign Magnitude however only one line is needed to completely control the H-Bridge.

Microcontrollers

Used to execute complex motor control algorithms with increased efficiency.Algorithm implemented using code such as VHSIC hardware description language, VHDL.Capable of implementing algorithms which common micorprocessors can't due to its capability to be implemented with peripherals such as Ethernet, PowerLink and PCI Express.Similar DC motor integration to the Microcontroller. That is utilising solid state electronics.

Field Programmable Gate Array

This is most commonly used in industry as it is the most flexible. It is also very easy to program, therefore control algorithms can be implemented using logic symbols and easy to use graphical software supplied by the manufacturer.

Programmable Logic Control

Page 21: Design Project

2.5 Existing Approaches for the Measurement of Motor SpeedThe table below lists the different methods used for the measurement of DC Motor Speed in

industry:

(Opto22 2013) (Fairchild 2001)

16

These are physically mounted onto the shaft. The rotational motion of the DC motor generates pulses. Encodes has a high no of pulses per revolution, this therefore results in a better resolution. Since the enoder is physically attached to the shaft, it introduces errors in the measurement.

Encoders

Normally mounted close to a gear or bolt on the shaft of the DC motor.As the motor rotates, the promity will vary generating pulses, as the bolt/gear teeth move back and forth from the sensor.Contact less in design, therefore does not introduce errors in the measurement.Number of pulses per revolution is dependant on number of gear teeth/bolts. Normally resolution is very low.

Proximity Sensor

Reflective target is placed on DC motor shaft. When light is shone on this reflective taget, the reflection is captured using an optical transitor which generates pulses.This method is contactless, and number of pulses per revolution is dependant on the number of reflective targets placed onto the shaft.Resolution is therefore low, however no resistance is added to the shaft.

Photoelectric Sensors

This utilises a Phototransistor Interrupter Switch along with an Interrupter Disc.The Interrupter Disc is attached to the shaft, as the DC motor spins, light from the emitter end of the Phototransistor Interrupter Switch is interrupted by the holes found the on the surfance of the Interrupter Disc.Therefore, light reaches the base of the optical transistor in pluses, thus creating a plused signal.The resolution id dependant on the number of holes in the interrupter disc. In addition the Interrupter disc adds a load and by extension an error to the measured speed.

Optical Isolator

Page 22: Design Project

3 Design Approach and Methodology

3.1 Design Brief

Project Objectives

The main objective of this project is to design and build a DC motor controller, which utilises a PI

control strategy. This objective must be undertaken with the following considerations:

Development of a design which incorporates:

o Industrial Standards for an inherently safer and efficient design

o Business Principles and Practise for efficient time and resource management

This design must be implemented observing:

o Laboratory and Safety Protocols though conducting Risk Analysis

o Engineering Code of Ethics

Project Plan

These objectives where divided into 12 tasks and undertaken over a 7 week period as showing in the

table below:

Table 10 Task description

Task Duration

(days)

1 Background Research of DC motor control systems’ implementation and design 7

2 Development of conceptual hardware design of Display based on Industrial

Standards and Best Business Practise

1

3 Development of algorithm for multiplexing of Display 1

4 Mathematical Modelling of Motor 2

5 Development of PI control algorithm 3

6 Development of conceptual code of PI control algorithm 3

7 Development of conceptual motor driving and protection circuitry taking into

consideration Industrial Standards and Best Business Practise

2

8 Familiarise myself with lab protocols. Conduct risk analysis. Apply appropriated

safety measures.

1

9 Phased Circuit Construction and Code Development. Circuit will be built in

modules. Each module will be tested before another module is built and added

10

17

Page 23: Design Project

to the design:

Module 1 – 5V Regulator

Module 2 – PIC16F877 support circuitry

Module 3 – Multiplexing of 4 Seven Segment Displays

Module 4 – Current Limiter and Overcurrent Isolation

Module 5 – Temperature Monitoring and Isolation of Voltage Regulator

Module 6 – Temperature Monitoring and isolation of DC motor.

Module 7 – DC motor driver

Module 8 – Integration of Optical Isolator

10 Testing of system accuracy, and modifications 3

11 Recording of results and observations. 3

12 Compilation of final report 13

18

Page 24: Design Project

The Gantt chart below graphically represents the above data, along with the start and end dates.

Task 1

Task 2

Task 3

Task 4

Task 5

Task 6

Task 7

Task 8

Task 9

Task 10

Task 11

Task 12

3/1/

2013

3/8/

2013

3/15

/201

3

3/22

/201

3

3/29

/201

3

4/5/

2013

4/12

/201

3

4/19

/201

3

Figure 6 Gantt chart

19

Page 25: Design Project

3.2 Product Design SpecificationThe specific design specifications of this project bearing in mind performance, environment and

product life cycle are detailed below. This table will refer to the different modules for which the

project was divided. Industrial standards by which each module adheres to will be included.

Module 1 – 5V Regulator

Performance Factors - This regulator must be able to accept a voltage range between 6V to

12V, and output a constant 5V. In addition the output must be free of noise and ripples.

Operational Environment Considerations – This regulator will be used to power the PIC

16F877. Apart from the output being a steady DC at a constant 5V, this circuit will be

handled by students. Accommodations must be made.

Product Life Cycle – Excessive heat has the potential to destroy and diminish the life span of

electronics. Regulators tend to get hot especially at high input voltages. Accommodations

must be made.

Module 2 – PIC16F877 Microcontroller and Circuitry

Performance Factors – Requires a voltage of nominally 5V for operation. Exceeding 5.5V will

cause damage to the device. PI control algorithm will be implemented on this

microcontroller. (Microchip, PIC16F87X Data Sheet 2001)

Operational Environmental Considerations – apart from insulation and proper circuit

design. This device will be integrated with many other modules. Design must effectively

utilises PIC16F877 pins.

Product Life Cycle – Destroyed by excessive voltage and current conditions.

Module 3 – Multiplexing of 4 Seven Segment Displays

Performance Factors – This device is required to display the speed of the DC motor clearly.

They are common cathode displays, with seven control lines each. Each segment of the

display operates at 2.0V each. (Jameco n.d.)

Operational Environmental Considerations – These displays will be operated in bright

laboratory environments. Display must be bright enough to be read. These displays will be

interconnected and powered by the PIC 16F877. They should not disrupt the operation or

the PIC 16F877.

Product Life Cycle – Easily destroyed by excessive voltage and current conditions.

Module 4 – Current Limiter and Current Isolation

20

Page 26: Design Project

Performance Factors – The current limiter will limited the current to the motor. The current

isolation will protect the entire circuit especially the PIC16F877 from short circuit conditions.

Immediate and reliable reaction is required of this circuit.

Operational Environmental Considerations – this circuit will be supplied with 12V. There is

also be a high power demand.

Product Life Cycle – Lifespan will decrease as a result of high temperatures.

Accommodations must be made.

Module 7 – DC Motor Driver

Performance Factors – This driver circuit is required to be integrated with the PIC16F877,

where it is required to be able to vary the supply voltage to the DC motor from 3V to 12V

whilst not exceeding the maximum rated current of the DC motor of 0.57 A (NICHIBO 2002)

Operational Environmental Considerations – this circuit must not negatively affect the

operation of the PIC16F877.

Product Life Cycle – Lifespan is negatively affected by, current overload in the windings as

well as excessive heat. Necessary accommodations must be made.

Module 8 – Optical Isolator

Performance Factors – must be able to accurately measure the DC motor speed in

revolutions per minute in real time. And must communicate this information effectively with

the PIC16F877. Emitter voltage must not exceed 1.7V whilst sensor’s emitter to collector

voltage must not exceed 4.5V (Fairchild 2001)

Operational Environmental Considerations – this circuit must not negatively affect the

operation of the PIC16F877.

Product Life Cycle – negatively affected by high voltages and currents.

21

Page 27: Design Project

3.3 Concept design and EvaluationHaving outlined the design specifications for each module, the process of conceptualising the design

can now begin. Each module has an associated hardware requirement, whilst some modules require

both hardware and software design.

The conceptualisation of each module will all exhibit a similar theme, which is one of Simple

Intelligent Design.

Module 1 – 5V Regulator

Performance Factors – Design will utilise L7805CV regulator, which gives a 5V output and

accepts a voltage range of 6V to 16V. Output will be conditioned using appropriate

capacitors.

Operational Environment Considerations – Appropriated colour codes to distinguish, 5V

and 12V output, positive and negative. LED will be used to indicate that circuit has power. A

switch will also be installed.

Product Life Cycle – Heat sinks and over-temperature circuitry shall be implemented on

regulator.

Module 2 – PIC16F877 Microcontroller and Circuitry

Performance Factors – Both power sources of PIC16F877 to be connected to ensure reliable

power supply. Oscillator output wire to PIC16F877 will be kept short as possible to prevent

noise from distorting the signal.

Operational Environmental Considerations – wiring will be done again following colour

codes.

Product Life Cycle – All wiring was done flat, cut to exact lengths to avoid loss of connection

and short circuits.

Module 3 – Multiplexing of 4 Seven Segment Displays

Performance Factors – Multiplexing of signal lines to optimise the use of PIC16F877 pins.

Due to rapid switching using transistors, power drawn from pins was reduced.

Operational Environmental Considerations – Grey automotive tint was applied to the

displays to improve visibility. The grey tint will improve the contrast of the display.

Product Life Cycle – Resistor pack was chosen so as allow maximum illumination without

exceeding rated current. Resistors were also implement on the base of the NPN transistors.

Module 4 – Current Limiter and Current Isolation

22

Page 28: Design Project

Performance Factors – Ensures that current supplied to the DC motor will not exceed rating

stipulated in datasheet. A relay will be used along with a current sensing circuit to isolated

entire circuit in the event of a short circuit.

Operational Environmental Considerations – in the event of a short circuit condition, apart

from the relay tripping, a red LED will be triggered along with an audible alarm, the form of a

piezo buzzer.

Product Life Cycle – a LM350T will be used in this design. This component doesn’t generate

much heat, however a heat sink will be installed to prolong lifespan.

Module 7 – DC Motor Driver

Performance Factors – TIP31C configured in a Darlington Pair will be used for the control

and driving of the DC motor.

Operational Environmental Considerations – Due to the fact that they high powered

transistors and their configuration, the switching/control of the DC motor can be

accomplished without drawing too much power from the PIC15F877.

Product Life Cycle – two TIP31C will be used in this design. This component doesn’t

generate much heat, however a heat sink will be installed to prolong lifespan.

Module 8 – Optical Isolator

Performance Factors – Resistors will be installed in series with the emitter and the senor to

achieve optimal working conditions outlined in the datasheet.

Operational Environmental Considerations – will be integrated with PIC16F877, resistor will

limit sinking current to less than 25mA.

It must be noted that all power supplied to each module will be regulated and protected by

overcurrent isolation circuitry.

The above can be represented using a block diagram which can be used to distinguish the skill

sets required for the production of the entire system.

23

Page 29: Design Project

Figure 7 Block diagram of System

From the above diagram one can see that the two min skill sets need in this design project is control

systems and microprocessor programming. All of the modules previously mentioned will work

together to achieve the project’s objectives, a detailed explanation of this process will listed below.

Operation Detail

Set point seed will be determined by a potentiometer which will be interfaced with the PIC16F877.

The output of the potentiometer will be analogue voltage, which will be fed into the PIC16F877,

where it will be converted to a digital 10 bit binary format. This conversion process will ignore the

two lowest bits, whilst the remaining 8 bits will be used to as the set point speed of the DC motor.

The PI control algorithm employs a feedback loop. This therefore requires the output measured

speed to be fed back to the PIC16F877. The speed measuring process will be achieved via, Module 8

along with an interrupter disc. The hardware design of this process was introduced previously. When

properly interfaced with the PIC16F877, the phototransistor along with the interrupter disc, will

convert the rotational motion the DC motor, to a series of pulses which are fed to the PIC16F877,

where it will be counted for a specific period of time.

The counted value, is then stored in a register with in the PIC16F877, this 8 bit value, is then

compared to the set point value, set by the potentiometer. From this comparison an error value is

determined, which will be integrated and scaled so that the output voltage can be adjusted to the

set point value if need be. Therefore under no load conditions the error value will be minimal, little

or no adjustments will have to be made to the output.

24

Page 30: Design Project

However if a load was added to the DC motor, its RPM will decease below the set point value.

Module 8 will measure this drop in speed, transfer this information to the PIC16F877, where it will

be processed, stored and compared to the set point. The error value will be determined.

Proportional and integral operations will be performed on this value, which will then be used to

adjust the PWM output to Module 7 – DC motor driver.

25

Page 31: Design Project

3.4 Motor & Controller design In this section mathematical modelling along with the determination of parameters and

performance characteristics of design will be undertaken.

Mathematical model of the Motor and Load

The following table outlines the DC motor parameters which will be used:

Table 11 Motor Parameters

Product Number Pc-280-16210

Voltage Range 3VDC – 12VDC

Nominal Voltage 6VDC

Current 0.28A

Stall Current 0.98A

Torque 18gcm

Speed 4260RPM

Efficiency 47.6%

Length of Shaft 11 mm

Diameter of Shaft 2 mm

From these parameters we can develop an equivalent circuit, which is shown below:

Figure 8 DC motor equivalent Circuit

Other Parameters which will be used, not shown in the diagram above, are listed in the table below:

Table 12 Model parameters

Parameter Description Units

Jm Motor moment of Inertia kgm2

Ji Load moment of Inertia kgm2

Jeq Inertia of Motor and Load Equivalent Moment kgm2

26

Page 32: Design Project

bm Motor Friction Co-efficient kgm2

beq Motor and Load equivalent friction co-efficient Nm/A

bl Load Friction Co-efficient kgm2

Ka Motor Torque Constant Nm/A

Kb Back EMF constant Vs

Having outlined all the parameters of the system we can now convert the equivalent circuit to the

Laplace domain. From examination of the equivalent circuit we can infer the following:

When a voltage, Ea(t) is applied to the armature of the DC motor, a current Ia(t) will follow

due to the resistive, Ra and inductive Ia components.

Due to Lenz’s Law, and the permanent magnets in the stator, the current in the armature

will produce a torque in the motor, which will produce a turning motion.

This motion will result in the creation of a back EMF.

The table below summarizes the conversion of parameters to the Laplace Domain:

27

Page 33: Design Project

Table 13 Conversion of Parameters to Laplace Domain

Operation Process and Reasoning Result

Conversion of Voltage to

Current in Laplace Domain

Applying Kirchhoff’s Voltage Law to equivalent circuitEa( t)=La

d I a(t)dt

+Eb(t )+Ra I a( t)

Laplace Transformation of expression for Ea( t) Ea(s)=s La I a(s)+Eb(s)+Ra I a(s )

Ea ( s)−Eb(s)=Ra I a(s)+s La I a(s)

Making Current, I a (s ) the subject of the formula. From this expression

we can infer that the current can be found by dividing the difference of

between of the applied voltage and the back EMF.

I a (s )= 1La s+Ra

[−Eb ( s)+Ea ( s ) ]

Therefore block diagram should include 1La s+Ra

Conversion of Current to

Torque in Laplace Domain

A force is experienced in the armature, due to the application of a

voltage, thus inducing a current. This force can be represented by:

F=BI a l

This force also generates a torque, where r is the distance between the

axis of rotation and the winding.

T=Fr

Substituting the expression for Force, F into the expression for Torque,

T gives

T=LrB I a

Therefore the Armature Torque Constant, Ka can be represented Ka=LrB

Substituting for Ka reveals that a Ka block may be used to represent the

system Torque

T=Ka I a

Conversion of Torque to Moment of inertia of motor with load Jeq=1

n2J L+Jm

28

Page 34: Design Project

Speed in Laplace Domain Co-efficient of motor with load beq=1

n2bL+bm

Since no gears were used in this design n = 1. Appling Newton’s Laws.

Where:

θ is the Angular Acceleration

θ is the Angular Velocity

Jeq θ=−beqθ+T

Laplace transform of T=Ka I a gives θ ( s)=T (s) 1

sbeq+s2 J eq

Substituting for ω ( s )=sθ (s ) gives ω ( s )=T (s) 1beq+s Jeq

Therefore the following block is needed 1beq+s J eq

Conversion of Speed to Back

E.M.F in Laplace Domain

From Lenz’s Law, where:

ϕ is Magnetic FluxEb=

dϕdt

Total/Net Magnetic Flux, where:

A is Area passed through by the armature winding.

∆ ϕ=B ∆ A

This Area can be represented by, where:

∆ l is the distance passed through by winding

∆θ is the corresponding angle traversed

∆ A=L∆ l=Lr ∆θ

Substituting the expression for Area traversed, ∆ A into the expression

for Lenz’s Law, Eb

Eb=LrωB

29

Page 35: Design Project

Taking Kb=LrB and substituting into Eb Ka=Kb=LrB

Therefore a Kb block may be used to relate Eb(s) to w(s)

Based on these calculations the block diagram for the signal flow of the DC motor used in this design project is shown below:

Figure 9 DC Motor Signal Flow

Transfer Function of Block diagram: T ω, Ea=Ka

J eq La s2+Rabeq+K aK b+ (J eq Ra+beq La ) s

Equation 9

30

Page 36: Design Project

Assuming:

Armature Coil inductance = 0

Therefore beq = 0

Block diagram can be simplified:

Figure 10 Simplified DC Motor block diagram

Simplified transfer function: T w , Ec=Ka

KaKb+J eq Ra s Equation 10

Having developed the simplified transfer function, determination of the key motor parameters must

be done.

Determination of Key DC Motor parameters

This analysis will be shown in the table below:

Operation Process and Reasoning Result

Value of Jeq The moment of inertia of the motor and load,

where: Jm=J load+J shaft

Jeq=J L+Jm

Equation for the moment of inertiaJ= r

2m2

Calculating moment of inertia of shaft, where:

r is the diameter of shaft = 2mm

m is mass of shaft ≈ 0.02 kg

¿0.02×(2mm)2

2

J=4×10−8 kgm2

Calculating moment of inertia of load/ rim, where:

r is the diameter of rim = 30mm

m is the mass of rim ≈ 0.005 kg

¿0.005×(30mm)2

2

J=2.25×10−6 kgm2

Therefore moment of inertia of DC motor Jm=J shaft+J disc

¿4×10−8+2.25×10−6

¿2.29×10−6 kgm2

31

Page 37: Design Project

The equivalent moment of inertia is found using,

where J L is the Load/Rim componentJeq=

1

n2J L+Jm

As a result, Jeq=Jm, therefore Jm=9.04×10−6 kgm2

Value of Ka Expressing Ka as a function of Torque and Armature

Current. From this equation, a linear characteristic

between Torque and Armature Current is indicated.

T=Ka I a

The gradient of the linear line in Characteristic

Curve for DC motor graph, see Figure 11 can be

used to determine Ka

m=T 2−T1I 2−I1

=Ka

Using the points (0.5, 40) & (0,0), Ka was

determined. Final answer was multiplied by

9.81gcm to take in consideration gravitational field

strength.

Ka=(40−0)10−5×9.81

0.5−0=7.85×10−3Nm/ A

Value of Kb Ka is equal to Kb due to the fact that they both have

the same base units. It must be noted however that

the units of Kb are Vs /rad

Ka=Kb

Kb=7.85×10−3Vs/rad

Value of Ra Armature resistance was measured using an

Inductance Capacitance meter.

Ra=20.01Ω

Figure 11 Characteristic Graphs of DC Motor (Jameco n.d.)

32

Page 38: Design Project

Having determined the key parameters of the motor, this values can be substituted into the transfer

function, Equation 10.

Simplified transfer function:

G(s)= 7.85×10−3NmA−1

7.85×10−3Nm A−1∗7.85×10−3Vsrad−1+¿2.29× 10−6kgm2∗20.01Ω¿

Equation 11

Further simplification:

G(s)= 171.31s+1.34 Equation 12

Determination of Suitable Performance Characteristics

Having determined the transfer function of the DC motor, the block diagram can be modified to suit:

Figure 12 Block diagram of system

The transfer function of the above block diagram and by extension the entire system:

G (s )=171.31(s K p+K i)

s2+(1.34+171.31K p ) s+171.31K i

Equation 13

General transfer function of system:

TF=ωn

2

s2+2ζ ωn s+ωn2 Equation 14

Comparing Equation 13 to Equation 14, so as to determine suitable values for K I and Kp. This process

will outlined in the table below:

Table 14 Calculation of Ki and Kp

Operation and Reasoning Eq.

noResult

33

Page 39: Design Project

Setting the s K p term to zero, to simply operations i 171.31K i

s2+ (1.34+171.31K p ) s+171.31K i

Let General representation equation be ii q ( s )=s2+2 ζ ωn s+ωn2

Comparing the denominator and simplifying Eq (i)

and Eq (ii)

iii 171.31K p+1.34=2ωn

171.31K i=ωn2

Using Peak Overshoot Mp = 0.05, Settling time, t2% =

0.15s

iv MP=e−πcotβ

Taking ln of both sides and simplifying for β vβ=tan−1( π

ln 0.05 )=46.36oωn expression for vi ωn=

4t sζ

Where ζ is equal to vii ζ=cos (β )

ζ=0.69

Substituting for ζand ts into Eq (vi) viii ωn=11.59rad /s

Substituting for ωnin Eq (ii) ix K p=15.99−1.34171.31

=0.0855

K i=134.33171.31

=0.7841

Having determined a Kp and Ki, they can be added to the block diagram:

Figure 13 Complete block diagram

Transfer function of entire system can be found by substituting into Equation 13:

14.647 s+134.324s2+15.987 s+134.324

Justification of Controller Choice

34

Page 40: Design Project

Testing using Equation 10, T w , Ec=Ka

KaKb+J eq Ra s was done using Matlab to prove that transfer

function, meets the system specifications, that is:

Peak Overshoot Mp = 0.05,

Settling time, t2% = 0.15

35

Page 41: Design Project

Figure 14 Step response of system transfer function

Figure 15 Step response with compensator

36

Transfer function for the entire system step response

was plotted in Matlab. The Overshoot was 18.1% whilst

the settling time was 0.424 seconds. These values were

very of, from the system specifications. As a result,

sisotool in Matlab was used to determine the

compensator.

Modification of the Transfer Function resulted, in an

Overshoot of 4.02% and a settling time of 0.122

seconds. Both of these values were within the

specifications of the system design. The compensator

used to achieve these values was 10. As a results the

new values of Ki and Kp are, 0.855 and 7.841

respectively

Page 42: Design Project

3.5 Implementation of PI Controller and Data Processing

Algorithm/Flow chart

The diagram below shows a basic flow chart of the system operation:

Figure 16 Simple Flow Diagram of System

In this section, focus shall be placed on the implementation of the PI controller. The following

diagram illustrates the flow process:

Figure 17 PI control Flow Chart

Implementation of Algorithm on PIC16F877

The operation which is required to be performed is Proportional and Integral control, from the

above block diagram we can see the error signal first need to multiplied by a proportional gain.

37

Page 43: Design Project

This is done using an 8 x 8 multiplication routine which is shown above. The integral operation of the

PI control, will be implemented, using summation, where the total of all errors will be added to a

particular register. This contents of this register will be added to the contents for the register,

containing the results of the proportional process. The diagram below outlines the 16 bit addition

routine:

Figure 18 Sixteen bit addition Routine

Considerations for Appropriate Scaling Values

The values of Ki = 0.9and Kp = 7.8 to one decimal place, is too small of a value to be interpreted by

the PIC16F877. As a result the 8 x 8 multiplication routine above had to be implemented to increase

their values, by a factor of 10, before they are implemented in the PI control routine.

The result from the PI controller routine will be a sixteen bit value. In order for this value to be

process by the PWM module, it must first be converted to an 8 bit value. This is done using a sixteen

by eight division routine which is shown below:

38

Page 44: Design Project

Figure 19 Sixteen by Eight Division Routine.

39

Page 45: Design Project

Choice of PIC16F877 Peripherals

Table 15 Microprocessor Peripherals

Peripheral Reason

RC2/CCP1 This pin was configured as a PWM output. This output voltage varies from 0-5VDC.

When integrated with the DC motor driver circuitry, provides speed variation.

TIMER1 This was configured in the count mode. When integrated with the

phototransistor/Speed measuring module, it is used to count the pulses

generated.

RC1/T10SI This pin was configured as the input from the Speed measuring module to the

PIC16F877, and works along will TIMER1 to count the pulses generated.

RD0 – RD7 These were used as output pins for the display, done by configuring TRISD. PORTD

was chosen to perform this function mainly for ease of wiring.

RA1 – RA4 There were used as output pins for the switching of the display transistors to

enable multiplexing. These pins were chosen again, for ease of wiring.

RA0 This pin was configured to be used as the analogue input for the set point value.

CLKIN This pin was configured with the 4MHz oscillator. This examples the timing of the

circuit.

Hardware Justification

The follow table is a list of all the hardware components used in this design project along with their

purpose.

Table 16 Hardware Components

Component Justification

PIC16F877 X1 Flexible high performance RISC CPU, with Interrupt, PWM and Timer

features and peripherals

L780CV X1 5VDC regulator will 6-16VDC input range

10uF & 1uF X1 Filter 5V regulator output

TIP31C X2 High power transistor, capable to switching high loads

LM350T X1 Configured to be used as a current limiter for DC Motor

4MHz

Oscillator

X1 Used to enable PIC16F877 time keeping capabilities

H21A1 X1 Optical interrupted switch. Can be configured to give a digital output

40

Page 46: Design Project

which can be interpreted by PIC16F877

2N3904 X1 Cost effective, fast switching solution for multiplexing of display.

GNS-3011Cx X4 Operates with 2VDC, therefore can be easily integrated with PIC16F877,

without drawing too much power from its pins.

Diode X1 To prevent Back EMF

Relay X2 To isolate circuit

LM324AN X2 Current amplification for Cut off

LM35DZ X1 Temperature Sensing

LEDs X3 Used as warning and notification lights to indicate circuit is on, or

overcurrent relay has tripped

41

Page 47: Design Project

3.6 Other Design Considerations

DC Motor speed Output

The PWM feature of the PIC16F877 was used to vary the DC motor speed output and was

implemented by configuring the TIMER2 and CCP1 modules. A duty cycle of 500 Hz causes the motor

to spin, and this frequency is adjusted using the following equations:

PWM Fequency= Fosc4∗(PR2+1 )∗(TMR 2Prescalar)

Equation 15

PWM Period= 1PWM Fequency

Equation 16

If the T2CON register is configured to a prescalar of 1:16 and the TMR2 register is configured to zero

and the PR2 register is configured to 255, a PWM output of 500Hz would be generated. It must be

noted that the value of the duty cycle was varied by changing the value of the CCP1L register.

Display Output

As part of the design specification for this project, it is required that the RPM be displayed on the

four seven segment displays. As stated earlier, these displays will be connected to Port D, and since

they are common cathode, their part to ground will be controlled by four transistors each, which will

be connected to pins RA1 to RA4. This configuration allows for a process of multiplexing to occur.

Multiplexing allows multiple signals to be sent along the same line, in our case, four different digits

logics will be sent along the same set of lines periodically. Each display is switched on and the others

are switched off, exactly when that particular display information is being transmitted. This process

of switching each display on occurs at a rate of 20ms, which is too fast for the human eye to detect.

Benefits of this system are, a reduction of power, wiring and smarter utilization of the PIC16F877

resources.

42

Page 48: Design Project

Figure 20 Display Output Flowchart

43

Page 49: Design Project

Speed Input Routine

In order to determine the speed of the DC motor a phototransistor optical interrupter switch was

integrated with the PIC 16F877 as shown in the diagram below. When the interrupter disc, which is

attached to the shaft of the DC motor is spun, the phototransistor generates a pulsed output signal,

due the fact that the light from the emitter of the device is being continuously blocked and revealed

to the base of the transistor.

This output waveform is fed to pin RC1, which was configured as a TIMER1 peripheral in count

mode. The count will be interrupted every time the pulse transitions from high to low. The speed is

measured every 0.5 seconds where the measured value is stored in a register. This stored value to

output to the display and is used for comparison against the set point value for PI control.

Figure 21 Phototransistor optical interrupter switch

Improvement of Resolution of the Speed Sensor

This can be done, by increasing the number of holes or interrupts in the interrupter disc. In

computer mice, the scroll wheel utilises this technology, however, a greater resolution is required

due to precision required from this device. As a result the no of interrupts in the interrupter disc

found on a computer mouse is close to 200. Desktop printers require an extremely high resolution.

Thousands of minute opaque lines are drawn on a clear plastic to create, this particular high

resolution interrupter disc. (BiPOM 2002)

Design of circuitry to meet current and voltage requirements of the displays

The Seven Segment displays, require 2VDC at 150mA for optimum operation. (Jameco n.d.) However

the PIC16F877, sources 5VDC. In addition, LEDs have a very low resistance, therefore connecting

across a source without a load, can cause a dangerous high current flow due to ohms law.

44

Page 50: Design Project

In order for the seven segment displays to be safely integrated with the PIC16F877, they must be

connected in series with a resistor pack. This will not only reduce the voltage, to the display but will

also limited the circuit current. Calculation for the value of this resistor is shown below:

R=Vsupply−VledI

= 5−2150mA

=200Ω

Equation 17

Figure 22 Display wiring (Best-Micocontroller-Projects 2013)

Justification for Choice of Oscillator

An Oscillator is need so as to provide an accurate and stable periodic clock signal to the microcontroller. (Microchip, PIC16F87X Data Sheet 2001) There are different oscillator modes which are outlines in the table below:

Table 17 Different Oscillator modes

Mode Description HS High power consumptionXT Designed for use with Crystals and Resonator of 1 to 4 MHz, with moderate power

consumption, accurate and fast clock rate.LP Low power consumption. Slowest clock rateRC Used in applications where precision is not necessary

Examination of the above table reveals that the XT oscillator is the best choice for this design project, because it is the most accurate, energy efficient and has a fast clock rate.

45

Page 51: Design Project

Justification of Component values for Current Sensing, DC Motor Protection and Diver Circuit

Figure 23 External hardware design

46

5V regulator

Current Limiting Resistor for CKT on LED

Current Limiter Ckt

Current Sensing Ckt

Motor Driving Ckt

Diode to blk back EMF

Optical Transistor

Relay

Page 52: Design Project

Determination of R3:

V 0=1.25(1+ RaR3 )+ IaRa Equation 18

where Iais amature currnet∧Rais armature resistance

12=1.25 (1+20.01R3 )+5.60 R3=¿ 4.85Ω (PS the value in the diagram above was just included for simulation and is not

actual value used)

For complete hardware justification see Table 16.

Laboratory Protocol

General Rules

Students should not be allowed to enter the laboratory without wearing proper shoes and

clothing. Proper shoes can be described as close toed shoes whist proper clothes can be

describe as clothing which covers one’s body appropriately. Therefore knee high pants and

skirts are not allowed. Excessively loose clothing should not be worn.

Students should not wear long hanging jewellery nor should persons with long hair style

have it loose. This is to prevent personal injury as a result of items being caught in

apparatus.

Bags, food stuff or liquids should not be brought into the laboratory. Desk space is valuable.

Bags clutter equipment and can become a fire hazard. Liquids and food stuff have the

potential to damage equipment if they are spilled onto it. This may also result in personal

injury or loss of life.

Equipment Use

When using the soldering iron please switch off after use. Also switch on the vacuum fan

whist soldering. Long term inhalation of solder fumes can be harmful to one’s health.

When using voltage supply, do not cover ventilation holes. This can be a fire hazard.

When using multi-meter do not tug on leads. Neatly wrap leads after use and place back into

the storage compartment. The leads should never be cut or altered.

When using your bread board, please be aware that the maximum current rating of the

board is 0.5 A. Also one should not use resistors specified to be greater than 0.5 Watts.

47

Page 53: Design Project

Never alter, modify or move equipment from its original location. Ask the laboratory

assistant for assistance or permission. Never should network cables be unplugged or altered.

48

Page 54: Design Project

Risk Assessment

Table 18 Risk Assessment

Hazards Persons

Affected

Possible Effect of Hazard Likelihoo

d of the

Hazard

Severity

of the

Hazard

Level

of the

risk

Precautions

Burns

from

Soldering

Students

Teaching-

Assistants

Soldering involves the use of a soldering iron, which is

required to be at very high temperatures in order to

melt solder. If the soldering iron gets in contact with an

individual’s body this could lead to severe burns, but

rarely death. Damage to personal and university

equipment is also probable

5 5 E It is recommended that students

wear heat resistant soldering gloves

whist soldering. In addition if pays to

be careful and alert whilst performing

this task

Inhalation

of Solder

Fumes

Students

Teaching-

Assistants

Lab Staff

Whist soldering especially at high temperatures, lead

from the solder atomize, therefore becoming air borne.

Lead is poisonous. Prolonged exposure to solder fumes

can lead to the development of asthma.

2 5 E It is therefore recommend that

students switch on the vacuum fan

when soldering. This will prevent the

inhalation of the fumes.

Chafing

and Injury

to Hands

whist

stripping

wire

Students

Teaching-

Assistants

Due to improper use or poor quality of wire cutters and

strippers, students can damage their hands trying to

strip wire.

3 3 M In order to mitigate this risk, pre-cut

and pre stripped wire can be used.

Automatic wire stripping tools can

also be used. Wearing gloves can be

beneficial.

Burns due Students The transistors which are used in the voltage regulator 3 3 M Students should be aware of

49

Page 55: Design Project

to hot

compone

nts

Teaching-

Assistants

are capable of producing a significant amount of heat.

As a result, bodily contact with these particular

components can lead to personal injury.

components that have the potential

of reaching high temperatures. These

components should be identified and

labelled. Wearing gloves whilst

operation is also recommended

Electrical

shock

Students

Teaching-

Assistants

The voltage regulator being designed has a considerable

amount of voltage and current associated with the

design. If a student gets in contact with an un-insulated

conductor that is powered, he runs the risk of

experiencing an electric shock.

3 3 M Students show check circuit before

powering on for exposed conductors.

Teaching Assistants should also

double check the circuit s before

being powered.

Fire

Hazard

Students

Teaching-

Assistants

Lab Staff

Combustible objects may get into contact with hot

components or apparatus such as the soldering iron.

3 5 E Students are to place the soldering

iron back into its holder after use.

Also ventilation holes of equipment

should never be blocked.

Figure 24 Risk Assessment Key

50

Page 56: Design Project

Occupational Safety

In this section we will examine the Occupation Safety and Health Act of Trinidad and Tobago 2004 as

it relates to this design project

It is stated is the act in Section 22 that no young person should be allowed to operate

equipment unless he or she is fully trained to do so.

In Section 23 it is stated that persons working in an industrial environment, in our case a

laboratory environment, should wear protective clothing. Students are required to wear

clothing that is conducive to a laboratory environment as described previously. A

Subsection states that signs should be placed outside of the laboratory, warning laboratory

users of the rules and guides especially concerning protective wear. This can be found on the

door on the Electronics Lab.

Section 24 deals with the production of dust and fumes. Fumes which are produced in this

design are due to the soldering process. A vacuum fan can be found at the soldering station

hence complying with the act which states that the production of harmful dust and fumes

should be dealt with so as to prevent inhalation.

Code of Practise

The following is a summary of the codes of practice for engineers as stipulated by the Registered

Professional Engineers in Queensland. It is subdivided into three categories.

Obligations to Society

Engineers should be informed of the environmental, social and economic consequences of

their actions or decisions.

They should act honestly, with integrity and fairness.

They should always perform steps to protect the health and welfare of the community.

They should have a special regard to and try to reduce the effects on the environment.

Obligations to Clients or Employers

Engineers should be truthful and honest. Never should their intention be to mislead or

misrepresent their organisation.

They should always warn clients or users of the consequence of disregarding advice.

They must be open to their employers and disclose any conflict of interest.

They must always keep private information confidential.

General Professional Obligations

51

Page 57: Design Project

Engineers must bring their knowledge, expertise and care to any task.

They should not engage in fraudulent behaviour.

They should never promise, accept or receive bribes.

They should continue to develop their skill and expertise.

Industrial Standards

The following are Industrial Standards by which, this project abides:

Trinidad and Tobago bureau of standards wire colour code.

NFPA 70E – Standard for electrical Safety in the work place.

ANSI/NEMA ICS 61800-1 – standard for low voltage adjustable speed electric motors.

52

Page 58: Design Project

4 Results and Analysis

4.1 Presentation of Results

Table 19 Summary of Key Parameters

Parameter Calculated Value

Ra 20.01Ω

La -

Ka 7.85 x 10-3

Kb 7.85 x 10-3

Jeq 9.04 x 10-6 kgm2

Beq -

Kp 0.0855

Ki 0.7841

Tests Performed for Evaluation

Figure 25 Step Response of closed Loop control System

53

Page 59: Design Project

Figure 26 Step Response with Compensator

Accuracy of Speed Displayed

This test was performed using a hand held tachometer.

Table 20 Results of display testing

Measured Speed Displayed Speed

510 540

625 678

853 953

1401 2031

Protection Module Test

Current Cut off

The protection module was simulated using a 1kΩ pot across input the resistance was varied and

current measured so as to stimulate a short circuit condition. PIC16F877 and DC motor were

54

Page 60: Design Project

removed from the circuit. At a current exceeding an average of three tests, 0.30 A, relay opened

disconnecting circuit.

Voltage Regulation

Input voltage was varied from 6VDC to 16VDC, output remained at steady 5.1VDC. When connected

to oscillator minimal ripple was observed.

Current Limiter

Again a short circuit condition was simulated using a pot. Current value never exceeded 0.30 A

System Response to difference Input Conditions

Difference loads was added to the system, whilst an oscilloscope was positioned across DC motor

input. The speed was monitored both by the display and the tachometer. Upon addition of the load

an increase in voltage was observed and an increase in speed when then averaged to the set point

value.

55

Page 61: Design Project

4.2 DiscussionFrom the results in the previous section it was observed that the different modules operated as they

should, when compared to the calculated or measured values.

The display module

This was fairly accurate for small rpms. However there was large inaccuracies at larger values. It

must be noted however that a large about a vibration occurs at these higher rpms does due to the

imbalance of the interrupter disc. This may contribute to the error.

The Protection Module

This module was very successful. This was verified using measurements using the oscilloscope,

voltmeter and ammeter. In addition fault conditions was simulated to see the protection, the

response time in action.

The PI Controller

This module was also successful, however it was notices that the settling time that is for the system

to reach back to its set point after the over shoot was long, approximately 2 seconds. I believe this is

an error with my code, and will be correct before the oral presentation.

56

Page 62: Design Project

4.3 ConclusionThis design project was indeed a rewarding experience as it may be aware if the importance of

control systems and microprocessors in the world today. There are countless example where this

simple project is used in our everyday lives and I believe that is paramount that especially electrical

and computer engineers understand this design project. In addition this project also made me aware

of the different protection systems, which can be applied not only to my circuit but to real life DC

motors in industry.

57

Page 63: Design Project

5 ReferencesACS. 2013. http://www.automatedconveyors.com/. Accessed March 13, 2013.

http://www.automatedconveyors.com/.

Best-Micocontroller-Projects. 2013. A PIC microcontroller frequency counter using TMR1. Accessed

April 10. http://www.best-microcontroller-projects.com/frequency-counter.html.

BiPOM. 2002. “BiPOM Electronics.” Accessed April 5, 2013.

http://educypedia.karadimov.info/library/encoder.pdf.

Blackburn, J.Lewis. 1998. “Protective relaying: principles and applications.” 358. CRC Press.

Bucknell. n.d. “An Introduction to Control Systems.” Accessed March 9, 2013.

http://www.facstaff.bucknell.edu/mastascu/econtrolhtml/Intro/Intro1.html.

Copeland, Brain. 2013. “ECNG 2009.” myelearning. Accessed April 8, 2013.

http://myelearning.sta.uwi.edu/course/view.php?id=16600.

Engineering, Department of Electrical & Computer. 2013. “ECNG 2005 Course Page.” myelearning.

25 February . Accessed March 16, 2013.

http://myelearning.sta.uwi.edu/mod/resource/view.php?id=267581.

Erik Steel. 2009. “eHow tech.” Accessed March 13, 2013. http://www.ehow.com/how-

does_4927808_laptop-cooling-fan-work.html.

Fairchild. 2001. “H21A1 Phototransistor Optical Interrupter Switch.” Fairchild Semiconductor

Corporation.

Fleming, John Ambrose. 1902. “Magnets and Electric Currents.” 173-174. London: E&F Spon.

Jameco. n.d. “GND-3011Cx Data Sheet.” Jameco Electronics.

KronoTech. n.d. PLC Adavantages and Disadvantages. Accessed April 2, 2013.

http://www.kronotech.com/PLC/Advantages.htm.

Kuo, Benjamin. 1991. Automatic Control Systems. New Jersey: Prentice Hall.

McGraw-Hill. 2010. McGraw-Hill Science & Technology Dictionary. McGraw-Hill.

Microchip. 2001. “PIC16F87X Data Sheet.” Microchip Technology Inc.

—. 2010. “techonline.” Accessed April 10, 2013.

http://www.techonline.com/education-training/education-training/tech-papers/4204475/

Current-Sensing-Circuit-Concepts-and-Fundamentals/viewpdf.

58

Page 64: Design Project

Miller, Rex, and Mark Miller. 2008. “Industrial Electricity and Motor Controls.” 384. McGraw-Hill.

NICHIBO. 2002. Jameco. Accessed April 2, 2013.

http://www.jameco.com/Jameco/Products/ProdDS/231829.pdf.

NKT. n.d. NK Technologies - Current Sensing . Accessed April 10, 2013.

http://nktechnologies.com/current-sensing.html.

Opto22. 2013. “Rpm Measurement Techniques.” Accessed April 4, 2013.

http://www.opto22.com/documents/1784_RPM_Measurement_Techniques_Technical_Not

e.pdf.

Oral-B. 2013. “Power Brushes.” Accessed April 2, 2013. http://www.oralb.com/products/electric-

toothbrush/.

Smuts, Jacques. 2010. “Derivative Control.” Control Notes. 3 May. Accessed April 1, 2013.

http://blog.opticontrols.com/archives/153.

TeacherTube. 2010. “teacherTube.” designmate. 06 February. Accessed March 03, 2013.

http://www.teachertube.com/view_item.php?item=CD2915E69546904E&type=photos.

Wang, Xiaoyan. 2001. Modeling and Implementation of Controller for Switched Reluctance Motor.

Master of Science Thesis, Virginia: Virginia Polytechnic Institute and State University.

Xilinx. 2012. avnet. 11 December. Accessed April 3, 2013.

http://www.em.avnet.com/en-us/design/drc/Pages/Xilinx-Spartan-6-FPGA-Motor-Control-

Development-Kit.aspx.

59