Upload
truongque
View
247
Download
9
Embed Size (px)
Citation preview
i
TEMPERATURE BASED DC MOTOR SPEED CONTROL
GARY ROYSTON GEORGE
This thesis is submitted as partial fulfillment of the requirements for the award of the
Bachelor of Electrical Engineering (Electronics)
Faculty of Electrical & Electronics Engineering
Universiti Malaysia Pahang
NOVEMBER, 2010
ii
AUTHOR’S DECLARATION
I declare that this thesis entitled “TEMPERATURE BASED DC MOTOR SPEED
CONTROL” is the result of my own research except as cited in the references. The
thesis has not been accepted for any degree and is not concurrently submitted in
candidature of any other degree.
Signature : __________________
Name : GARY ROYSTON GEORGE
Date : 28th NOVEMBER 2010
iv
ACKNOWLEDGEMENT
First and foremost, I want to express my great deepest gratitude for my
supervisor, Miss Nor Laili Binti Ismail for her continued support, encouragement,
and guidance in overseeing the progress of my project from initial phase until it is
complete. Without her valuable advices and comments, this project would not have
been possible to finish.
My fellow postgraduate students should also be recognised for their support.
My sincere appreciation also extends to all my colleagues and others who have
provided assistance at various occasions. Unfortunately, it is not possible to list all of
them in this limited space.
Last but definitely not the least to my parent and my family, I would never
thank enough for their endless support and encouragement throughout my studies in
University Malaysia Pahang (UMP).
v
ABSTRAK
Kelajuan motor DC boleh dikawal dengan mengubah bekalan voltan antara
dua terminal motor DC dan ini boleh dilakukan melalui pelbagai cara. Projek ini
menggunakan kawalan kelajuan motor DC brushless melalui bacaan suhu daripada
sensor suhu analog. Microcontroller akan mengeluarkan isyarat pulse-width
modulation (PWM) dengan variasi duty cycle yang ditetapkan berdasarkan bacaan
suhu untuk mengawal kelajuan motor DC melalui MOSFET yang bertindak sebagai
suis yang hidup dan mati mengikut frekuensi PWM sebagai pacuan motor.
Microcontroller yang mengandungi pengubah analog kepada digital (ADC) dan
fungsi PWM akan digunakan dalam projek ini untuk berfungsi dengan sensor suhu
analog dan mengawal kelajuan motor DC brushless.
vi
ABSTRACT
The speed of a DC motor can be controlled by varying the supply voltage
across the two terminals of DC motor and there are many ways of doing so. This
project uses control logic for the brushless DC (BLDC) motor speed control which is
based on the ambient temperature readings of an analog temperature sensor. The
microcontroller will produce a pulse-width modulation (PWM) signal with variable
duty cycle based on the temperature data obtained to regulate the motor speed
through a MOSFET as switching component to turn ON and OFF at PWM frequency
which act as the motor drive. A microcontroller with analog to digital converter
(ADC) interface and PWM peripheral will be used in this project to communicate
with an analog temperature sensor and to regulate a brushless DC motor speed.
vii
TABLE OF CONTENTS
CHAPTER ELEMENTS PAGE
DECLARATION ii
DEDICATION iii
ACKNOWLEDGEMENT iv
ABSTRACT v
TABLE OF CONTENTS vii
LIST OF FIGURES x
LIST OF APPENDICES xii
LIST O LIST OF ABBREVIATION xiii
CHAPTER 1 INTRODUCTION
1.1 Background of Study 1
1.2 Problem Statement 2
1.3 Project Objective 2
1.4 Project Scope 3
1.5 Thesis outline 4
viii
CHAPTER 2 LITERATURE REVIEW
2.1 Analog to Digital Converter (ADC) 5
2.2 Pulse Width Modulation (PWM) 5
2.3 PIC 16F877 Microcontroller 7
2.4 MOSFET switching applications 8
2.4.1 Turn-On procedure 9
2.4.2 Turn-Off procedure 11
2.5 MOSFET Driver 14
2.6 LM35 precision centigrade temperature sensor 16
2.7 DC-DC boost converter 16
CHAPTER 3 METHODOLOGY
3.1 Theory of operation 19
3.2 System Operation Flowchart 21
3.3 Design hardware 22
3.4 Sensor and microcontroller interfacing 22
3.5 Principle of operation for controlling
DC motor speed using PWM 27
3.6 DC motor speed control and LED
signal behavior by PIC 27
3.7 DC motor speed control by a power MOSFET 33
ix
3.8 PWM control using transistor at low side drive 33
3.9 DC-DC Boost Converter simulation 34
3.9.1 Pulse-width modulation simulation setting 36
3.9.2 Voltage output simulation setting 37
CHAPTER 4 RESULTS AND DISCUSSIONS
4.1 PROTEUS ISIS Professional v7.6 SP4
simulation for PIC16F877 interfacing with
LM35 temperature sensor and 14-pins LCD display 38
4.2 DC motor speed control and LED simulation 39
4.3 DC-DC Boost Converter simulation by
PSpice OrCAD Capture v9.1 41
4.4 Hardware 44
4.4.1 Hardware overview 44
4.4.2 Oscillator result on output PWM signal
for motor control 47
CHAPTER 5 CONCLUSION AND RECOMMENDATIONS
5.0 Conclusion 52
5.1 Future Recommendation 53
x
REFERENCES 54
APPENDICES A: INSTRUCTION SOURCE CODE 57
B: DATASHEET 61
xi
LIST OF FIGURES
FIGURE TITLE PAGE
1 Examples of PWM duty cycle square waves 6
2 Pin diagram for PIC16F877A microcontroller 8
3 Simplified clamped inductive switching model 9
4a MOSFET turn-on diagram 9
4b MOSFET turn-on time intervals 10
5a MOSFET turn-off diagram 12
5b MOSFET turn-off time intervals 12
6 Direct gate drive circuit 15
7 Typical DC-DC boost converter 17
8 Design flowchart 21
9 Circuit design for the hardware 22
10 Schematic circuit for sensor, lcd and microcontroller
interface 23
11a Source code 24
11b Source code (continued) 24
12 LM35, PIC16F877 and external crystal, LCD display,
LED, MOSFET and 12V DC motor interface
simulation. 28
13 Definition and variables for PWM and LED
xii
output program 29
14 PWM duty cycle and LED behavior program 30
15 Low side drive circuit 34
16 DC-DC boost converter schematic by PSpice OrCAD
Capture v9.1 software 34
17 A running simulation with a voltage/level marker at
the generated PWM signal 36
18 Simulation setting; Transient analysis, runtime
until 1ms 36
19 A running simulation with a voltage/level marker at the
output voltage 37
20 Simulation setting; Transient analysis, runtime
until 0.1s 37
21 A running simulation at temperature of 28°C set on
LM35 38
22 LM35, PIC16F877 and external crystal, LCD display,
LED, MOSFET and 12V DC motor interface
simulation 39
23 A running simulation at a temperature below 25°C.
The output LED is low and DC motor is not running
(duty cycle = 0) 40
24 Simulation at temperature between 25°C and 41°C.
The motor is running at 65.5% motor speed and the
LED is blinking. 40
25 Simulation at temperature higher than 41°C.
Duty cycle is 100%, drive DC motor to a full speed.
The output LED is high. 41
26 Graph of transient analysis for PWM simulation between
0s to 1ms (PWM duty cycle is 25%) 41
27 Graph of transient analysis between 50ms until 100ms 42
28 PW of VPULSE is reduced to 8µs 42
29 Graph of transient analysis between 50ms until 100ms 43
xiii
30 Simulation using a larger capacitor (2.2mF) and PW is
adjusted to 8.5µs 43
31 Graph of transient analysis between 0s to 100ms 44
32 Hardware circuit 45
33 DC-DC boost converter circuit 46
34 LCD display 30°C temperature reading and the motor
is running 46
35 PWM input into IRF 540N MOSFET at 26°C 47
36 PWM input into IRF 540N MOSFET at 28°C 47
37 PWM input into IRF 540N MOSFET at 30°C 48
38 PWM input into IRF 540N MOSFET at 32°C 48
39 PWM input into IRF 540N MOSFET at 34°C 49
40 PWM input into IRF 540N MOSFET at 36°C 49
41 PWM input into IRF 540N MOSFET at 38°C 50
42 PWM input into IRF 540N MOSFET at 40°C 50
43 PWM input into IRF 540N MOSFET at 42°C 51
LIST OF TABLES
TABLE TITLE PAGE
1 Temperature reading and calculated PWM duty cycle,DC motor speed and LED signal behavior. 32
2 Hardware label 45
3 Temperature reading with theoretical calculated PWM
duty cycle and oscillator result on hardware testing
duty cycle. 51
xiv
LIST OF APPENDICES
APPENDIX TITLE PAGE
A Instruction Source Code 57
B1 Datasheet for PIC 16F877 62
B2 Datasheet for LM 35 66
B3 Datasheet for LM 7805 72
B4 Datasheet for TO-220 package 77
B5 Datasheet for IRF540N 78
LIST OF ABBREVIATION
DC Direct Current
PIC Programmable Interface Controller
PWM Pulse Width Modulation
ADC Analog to Digital Converter
RPM Revolutions per Minute
LCD Liquid Crystal Display
xv
MOSFET Metal–Oxide–Semiconductor Field-Effect Transistor
PCB Printed Circuit Board
CICM Continuous Inductor Current Mode
DICM Discontinuous Inductor Current Mode
PFC Power Factor Correction
EMI Electromagnetic Interference
CHAPTER 1
INTRODUCTION
1.1 Background of study
The speed of a DC motor can be varied by many methods and one of them
is by using Programmable Interface Controller (PIC) to produce Pulse Width
Modulation (PWM) signal with variable duty cycle. But, in terms of varying a DC
motor speed, there are options of doing it manually or automatically. By manually
means that the input data that is to be sent to the microcontroller to determine output
voltage supply to the motor by PWM method is determined by the user. But in
automatic control to vary a DC motor speed, the input data is not based on online
data input from the user, but from programmed code to control the output voltage
supply to the motor through PWM by variable input data obtained by sensor
interfacing.
This project uses control logic for the DC motor speed control which is
based on the ambient temperature readings of an analogue temperature sensor. The
microcontroller will produce a PWM signal with variable duty cycle based on the
temperature data obtained to regulate the motor speed. A PIC with analogue input
2
and PWM peripheral will be used in this project to communicate with an analogue
temperature sensor and to regulate a brushless DC motor (BLDC motor) speed.
1.2 Problem Statement
Generally, temperature controlled DC motor speed is applicable in cooling
fan speed control. It is necessary to control the fan speed to reduce noise produced by
the fan and improving the fan reliability. The noise levels produced by a cooling fan
are in fact can reach 70 dB. Since fan noise increases exponentially to the fan
rotation speed, reducing revolutions per minute (RPM) by a small amount potentially
means a reduction in fan noise. This must be done cautiously, as excessive reduction
in speed may cause components to overheat and be damaged. If done properly fan
noise can be drastically reduced. The control of the fan speed is obtained by a closed-
loop system, which is using temperature sensor as a feedback of the system. A
controlled fan speed in accordance to temperature does as well reduce the power
consumption of the fan itself.
1.3 Project Objective
i. Build the hardware that consists of PIC microcontroller, an analogue
temperature sensor, N-Channel MOSFET, a 12V BLDC motor, an LCD
display to display ambient temperature, and a DC-DC boost converter to
boost 9Vdc to 12Vdc to supply the BLDC motor.
3
ii. Design source code for the PIC programming to interface with the analogue
temperature sensor and the LCD display to display ambient temperature
reading and such that it meet the required conditions for the BLDC motor
speed control based on ambient temperature reading. Another PWM program
also required to drive an N-channel MOSFET of the boost converter.
1.4 Project Scope
i. Use PROTEUS ISIS Professional v7.6 SP4 software to design and simulate
hardware schematic of PIC microcontroller interfacing with an analogue
temperature sensor, LCD display, an N-channel MOSFET and a BLDC
motor. Simulation must be done with a complete function of .hex file for the
microcontroller.
ii. Use PSpice OrCAD Capture v9.1 software to design and simulate a DC-DC
boost converter to boost a 9Vdc supply to 12Vdc.
iii. Use MicroCode Studio 4.0.0 PICBASIC PRO v2.6 to design source code for
the PIC and converting the .pbp file to .hex file.
iv. Build the hardware that consists of PIC microcontroller, an analogue
temperature sensor, N-Channel MOSFET, a 12V BLDC motor, an LCD
display to display ambient temperature, and a DC-DC boost converter to
boost 9Vdc supply to 12Vdc.
4
1.4 Thesis Outline
This thesis contains 5 chapters that include Chapter 1: Introduction, Chapter 2:
Literature reviews, Chapter 3: Methodology, Chapter 4: Results and discussions,
Chapter5: Conclusion and recommendations. Each chapter will contribute to explain
different focus and discussion relating with the corresponding chapter’s heading.
Chapter 1 contains introduction which presents the overviews of the project
that is constructed. It consists of project background, objective, problem statement
and project scope.
Chapter 2 contains literature review which discuss about the reference taken
for this project completion.
Chapter 3 discuss about the methodology in this project which consists of
method used to undertake simulations, experiments, hardware development and
testing.
Chapter 4 contains result and discussions focused on the analysis of the result
acquired and discussed the outcome obtained.
Chapter 5 contain conclusion and recommendations for this project.
CHAPTER 2
LITERATURE REVIEW
2.1 Analog to Digital Converter (ADC)
Analog to digital converter converts a continuous quantity to a discrete
digital/binary-coded number [1]. An ADC is an electronic device that converts an
input analog voltage (or current) to a digital number proportional to the magnitude of
the voltage or current [1]. In this project, variable voltage output from an analog
temperature sensor is converted to a digital value through an ADC pin of the PIC.
The ADC is by means of interfacing the analog temperature sensor with PIC.
Definition of port and bit needed for the operation must first be included in PIC
program to enable the function of the ADC.
2.2 Pulse Width Modulation (PWM)
6
Pulse width modulation (PWM) is a technique for controlling analog
circuits with a processor's digital outputs [2]. PWM is a way of digitally encoding
analog signal levels. Through the use of high-resolution counters, the duty cycle of a
square wave is modulated to encode a specific analog signal level. The PWM signal
is still digital because, at any given instant of time, the full DC supply is either fully
on or fully off. The voltage or current source is supplied to the analog load by means
of a repeating series of on and off pulses. The on-time is the time during which the
DC supply is applied to the load, and the off-time is the periods during which that
supply is switched off. Given a sufficient bandwidth, any analog value can be
encoded with PWM [2]. For fully off the duty cycle used will be 0% and 100% for
fully on. The duty cycle is independent of the frequency of the PWM signal and the
same type of waveform will be observed for a specific duty cycle [3].
Figure 1: Examples of PWM duty cycle square waves [3].
From Figure 1, the digital signal (solid line) is at a constant frequency while
the pulse width is changed (modulated). The dotted line represents the average
signal (if the digital signal is converted to an average). The duty cycle represents the
amount of time that the signal is high compared to the amount of time that the signal
is low [3].
7
2.3 PIC 16F877 Microcontroller
All single cycle instructions except for program branches which are two
cycle, the operating speed is 20 MHz and clock input is 200 ns instruction cycle It is
having up to 8K x 14 words of FLASH Program Memory, up to 368 x 8 bytes of
Data Memory (RAM) and up to 256 x 8 bytes of EEPROM Data Memory [4].
PIC is a family of RISC (Reduced Instruction Set Computer)
microcontroller manufactured exclusively by Microchip. PICs are faster, more
reliable (high noise immunity) and code-efficient than 8051s. PIC is having an
internal memory and it can be extended by using I2C protocol. PIC will operate with
50 nano-Amps in sleep mode, and has a variety of sleep modes to further conserve
power. Atmel’s ATmega165P AVR controller Consumes 100nano-Amps in Power
Down mode PIC to be fully operable with any supply rated between 2V to 5.5V. For
battery-powered projects PICs are most suitable [4].
Many microcontrollers include on-chip PWM units. PIC 16F877 has two,
each of which has a selectable on-time and period. The duty cycle is the ratio of the
on-time to the period while the modulating frequency is the inverse of the period. To
start PWM operation, the data sheet suggests the software should [5]:
Set the period in the on-chip timer/ counter that provides the modulating
square wave.
Set the on-time in the PWM control register.
Set the direction of the PWM output, which is one of the general-purpose I/O
pins.
Start the timer.
Enable the PWM controller.
This 40-pin PIC microcontroller unit is chosen for its suitability for this
project. It has what are needed for this project; support ADC which is to be use to
receive analog voltage value from the analog temperature sensor and the PWM
8
peripheral that produces PWM signal with various duty cycle determined by the PIC
source code [5].
Figure 2: Pin diagram for PIC16F877 microcontroller [5].
The PIC microcontrollers are very easy to use with PWM as they have built
in PWM generators. What need to be done is to set up the relevant control registers
[5].
2.4 MOSFET switching applications
To investigate the actual switching behavior of the MOSFET transistors, the
parasitic inductances of the circuit will be neglected. The following descriptions
relate to clamped inductive switching because most MOSFET transistors and high
9
speed gate drive circuits used in switch mode power supplies work in that operating
mode [7].
Figure 3: Simplified clamped inductive switching model [7].
2.4.1 Turn-On procedure
The turn-on event of the MOSFET transistor can be divided into four
intervals as depicted in Figure 4a and Figure 4b.
Figure 4a: MOSFET turn-on diagram [7].
10
Figure 4b: MOSFET turn-on time intervals [7].
For the first step the input capacitance of the device is charged from 0V to
VTH. During this interval most of the gate current is charging the CGS capacitor. A
small current is flowing through the CGD capacitor too. As the voltage increases at
the gate terminal and the CGD capacitor’s voltage has to be slightly reduced [7]. This
period is called the turn-on delay, because both the drain current and the drain
voltage of the device remain unchanged. Once the gate is charged to the threshold
level, the MOSFET is ready to carry current. In the second interval the gate is rising
from VTH to the Miller plateau level, VGS,Miller. This is the linear operation of the
device when current is proportional to the gate voltage. On the gate side, current is
flowing into the CGS and CGD capacitors just like in the first time interval and the VGS
voltage is increasing. On the output side of the device, the drain current is increasing,
while the drain-to-source voltage stays at the previous level (VDS, OFF). Until all the
current is transferred into the MOSFET and the diode is turned-off completely to be