Description

A PID Controller for Real-Time DC Motor Speed Control using the C505C Microcontroller
Sukumar Kamalasadan Division of Engineering and Computer Technology University of West Florida, Pensacola, FL, 32513 Phone: (850) 857-6451, Fax: (850) 474-2804 Email: skamalasadan@uwf.edu Abhiman Hande Electrical and Computer Engineering Department Lake Superior State University, S.S. Marie, MI 49783 Phone: (906) 635-2598, Fax: (906) 635-6663 Email: ahande@lssu.edu
Abstract This paper presents a real-time DC M

All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Related Documents

Share

Transcript

A PID Controller for Real-Time DC Motor Speed Control using the C505C Microcontroller
Sukumar KamalasadanDivision of Engineering and Computer TechnologyUniversity of West Florida, Pensacola, FL, 32513Phone: (850) 857-6451, Fax: (850) 474-2804Email:skamalasadan@uwf.eduAbhiman HandeElectrical and Computer Engineering DepartmentLake Superior State University, S.S. Marie, MI 49783Phone: (906) 635-2598, Fax: (906) 635-6663Email:ahande@lssu.eduAbstract
This paper presents a real-time DC Motor speedcontroller design using a microcontroller-based network system. The design architecture was developed using twoPhytec evaluation boards each having an Infineon eight-bit C505C-L microcontroller. The system detects the real-time speed of the motor using the sensor device and thentransfers data to the first Phytec board’s microcontrollerusing serial communication. This data is processed andtransferred to the second Phytec board’s microcontrollerusing a Controller Area Network (CAN) communicationscheme. The second microcontroller uses the receiveddata to calculate the real-time control value to monitor andkeep the motor speed constant based on a commandsignal. Data is then transferred back to the first Phytecboard’s microcontroller using CAN and is utilized tochange the motor voltage such that its speed is constant.The importance of the proposed design architecture is itsability in controlling precisely the motor speed and/ordirection especially when used in modern automobileswhere the CAN protocol is quite popular. Moreover, theproposed real-time controller approach is based on theclosed loop feedback error principle unlike the existingopen loop designs. The paper details the system designand the experimental results that were obtained.
Key Words
: Real-time DC motor speed control, C505Cmicrocontroller, Controller Area Network
1. Introduction
Rapid progress in microelectronics andmicrocontrollers in recent years has made it possible toapply modern control technology to automobiles that needreal-time control. Automotive technology uses severalelectronic control units (ECU) to control efficient andreliable operation of key components namely, the engine,transmission, anti-lock braking system (ABS), cruise,steering, vehicle traction, and entertainment [1]. DCmotors control, many of these operations and thereforethere is a need for implementing effective controlstrategies for digital control of these motors. Currently,auto manufacturers use multiplex buses for integrating alltheir vehicle electronics and instead of using theproprietary buses for the transfer of data within thevehicle, the Controller Area Network (CAN) proposed byRobert Bosch [6] is becoming an industry standard.Therefore, it is quite important to develop real-time DCmotor control strategies such that these devices areeffectively integrated with their control electronics usingthe CAN network protocol. Realizing the fact that largenumber of motors are utilized in modern vehicles andthere is especially a need to control these small motorsusing a common bus with interrupt priorities, such real-time control is extremely essential.Several research efforts have shown the ability of using digital signal processing (DSP) kits for real-timemotor control such as a proportional-integral-derivative(PID) controller using the TMS320c31 DSK kit [2].Subsequently it also addressed some steps into adaptivecontrol using the same DSP kit [3]. However, many suchprocessing kits do not have the ability of high-speednetworking and use open loop control strategies. Asopposed to those research directions, the proposed systemmakes use of the high speed CAN protocol that has built-in error management and therefore reduces the effect of electromagnetic interference (EMI) [6]. The system usesthe Infineon eight-bit C505C-L microcontroller that hasseveral peripherals including three timer/counter units, ananalog-to-digital (A/D) converter, a serial communicationinterface (USART), and supports the CAN protocol [4,5].This paper proposes a real-time DC motor controldesign approach using the CAN protocol to communicatebetween a local microcontroller that senses motor speedand controls a motor driver circuit, and a remotemicrocontroller that contains an embedded closed loopdigital controller for the motor speed correction. At first, aPID Controller is designed using MATLAB
®
andSimulink
®
with a practical motor model. The transferfunction model of the motor is then used to design thedigital controller. Subsequently, this developed design isused to generate the sensor architecture and softwareprogram, which is loaded to the first microcontroller. Thismicrocontroller acts as the integrator between the motorand the digital controller. The motor speed is thentransferred to the second microcontroller (using a CANbus) that is loaded with the controller architecture
34
software program. Based on changes in the motor speed,which is recorded using the first microcontroller, thecontrol value is generated which in turn is used to correctany speed deviation. The whole process including thenetwork bus monitoring is carried out in real-time.The paper is organized as follows. In section 2, ageneric control schematic using two microcontrollerscommunicating through a CAN bus is discussed. Thissection also details the DC motor speed control strategyusing pulse width modulation (PWM). In section 3, thedigital PID controller design concepts and the simulationtest results of the PID controller on the DC motor modelusing the MATLAB environment is discussed. Section 4details the flowchart for each microcontroller and theircommunication using the CAN bus, while section 5 showsthe test results observed. Lastly, section 6 points out theconclusions inferred from the project.
2. Motor speed control using CAN
Figure 1 shows the scheme used for controlling themotor speed using two microcontrollers communicatingwith each other through a CAN bus. As can be seen, themotor speed is sensed and transmitted to the CAN bus byM
1
. M
2
which generates the control value in real-time,aided by the digital controller utilizes this information.This is then transferred to M
1
via the CAN bus, and thedriver circuitry which normally changes the voltage tostabilize the speed uses this information. The CAN busmonitor maintains the priority of different motor controloperations and schedules the interrupt level for thespecific operation domain.Control of DC motors by PWM is very well known[7]. In the process of varying the pulse by controlling theswitching of the input voltage for the off and on duration,a time dependent varying output voltage can be achieved.For example, Figure 2 shows a square wave PWM pulsewith 50% duty cycle.
Figure 1: Generic schematic diagram of the real-time DC motor controlFigure 2: Square wave with 50% duty cycle
Controller Area Network (CAN)
Microcontroller (M
2
)CANNode 2
DigitalController
Microcontroller (M
1
)CANNode 1
MotorSensorDriverCircuitCAN Bus MonitorV
in
V
avg
Period(T)
35
As shown, if the input voltage ‘V
in
’ can be switched onand off frequently at the uniform rate then the total period‘T’ will be:
off on
T T T
+=
(1)where: T
on
= ON time and T
off
= OFF time.The average output voltage in this case is 0.5 * V
in
. Ingeneral, the output voltage will be:
inoff ononavg
V T T T V
+=
¡
( )
inavg
V DV
=
(2)where: Vavg = average output voltage and D= duty cycle.There are two possible ways to control the speed of the motor viz. open loop control and closed loop control.In open loop control, the control value is not dependent onthe output or the speed of the motor, whereas in closedloop control in which the control value is dependent onthe speed of the motor. In the proposed approach a closedloop speed control with a digital PID controller isdesigned. A potentiometer was used as the referencecommand signal to set the input voltage at various levelsas required. Further, the control value obtained frommicrocontroller M
2
is utilized to generate the averageoutput voltage for adjusting the duty cycle (D) in order tomaintain constant motor speed.
3.Digital controller design and simulation
Figure 3 shows the block diagram of the proposeddigital PID controller, where R(s) is the reference input,y(s) is the system output, C(s) is the controller transferfunction, and H(s) is the feedback loop (sensor) transferfunction.The digital PID Controller has the following form [8],
++−++=
Tz zK z zT K K zC
D I P
1112)(
(3)where:‘K
P
’, ‘K
I
’ and ‘K
D
’ are the proportional, integral andderivative parameters of the controller and ‘T’ thesampling time.The discrete form of the controller transfer function‘C(z)’ can also be written as:
122110
1)(
−−−
−++=
z Z a Z aa
zC
(4)where:
T K T K K a
P p
++=
2
10
,
T K T K K a
P p
22
11
−+−=
and
T K a
P
=
2
In the ‘Z’ domain the above mentioned second orderpolynomial will be:)(*)(
22110
zC Z a Z aa zY
−−
++=
and)(*)1()(
1
zC Z z X
−
−=
(5-6)where: X(z) is the input to the controller and Y(z) theoutput of the controller.Taking the inverse z-transformation, the followingexpressions are obtained:
)2()1()()(
210
−+−+=
k gak gak gak Y
andg(k)=X(k)+g(k-1)
(7-8)where: ‘k’ is the time constant. This gives a relationbetween the output of the plant and the controller.The DC motor is modeled using the following transferfunction:
)4(22)(
+=
sssG
DC
(9)In the digital domain this is translated with respect to asampling time (T) of 250 msec as,
Figure 3: Discrete PID controller structureR(s)
ControllerC(s)PlantG(s)
A/DD/A
∑
SensorH(s)y(s)
36
−−=
−−
11
368.01
22]1[)(
Z Z Z G
DC
(10)Combining the motor model and the controller equationthe closed loop system will be,
)()()(1
)(*)(
)()(
zS Z G Z C
zG Z C
Z R Z y
=+=
(11)with the characteristic equation as
)()(1
zG zC
+
. Thecontroller parameters are designed such that the steadystate error
)](1)[()(
zS z R Z e
−=
asymptotically tends to zeroi.e.
)()(1
1
zG zC
+
= 0 for a unit step input. Combiningequations (3) and (10),
)()(1
zG zC
+
=
22110
22)368.022(221
−−
+−++
Z a Z aa
or
22110
22)368.022(221
−−
+−++
Z a Z aa
(12)The developed DC motor model and the closed loopsystem are then used to generate the coefficients of thedigital PID controller using MATLAB
®
. Figure 4 showsthe settling time for the model for a motor input set pointof 15 revolutions per second (rps). Considering thissettling time for the practical DC motor model, thecoefficients of the discrete PID constants are formulatedfor the closed loop system. Further, using thesecoefficients from (8), the following coefficient matricesare also obtained for the DC motor equation.
PID_Controller
=
{1.001, -0.996, 0, 0, 0} / {1, -1, 0, 0, 0}
;
(which shows the PID Controller value for the time spandesired)
Figure 4: Step response of the DC motor model
DC Motor Equation = {0, 1.8151, -1.8060, 0, 0}/{1, -1.6703, 0.6703, 0, 0}; (which shows the motor characteristic that needs to be controlled)
4.
Software development and implementation
The actual implementation of the PID controller wasdone using the Digital Application Engineer (DAvE)software from Infineon Technologies [9] and the
µ
Vision2software package from Keil software Inc. [10].
Figure 5: Algorithmic flowchart
YesInitialize variables for Error,Reference, PotentiometerVoltage and SpeedDevelop the Transfer Functionfor Motor and PID ControllerCheck the Time = Ts==Read the A/D Conversion valueNoInitialize the Motor Output andthe Controller OutputStart the A/D Converter andcheck the sampling timeCalculate the Controller Outputwith the current ErrorFind the Change in the Speed
Find the System Output by using the Controller Outputand the System Characteristics
Find the new System Output fromchange in the speedFind the new current ErrorSet the time as zero
37

Search

Similar documents

Tags

Related Search

Dc motor speed control with chopperA novel comprehensive method for real time ViSystem architecture for real-time wireless coHoare logic for real-time systemsA map matching method for GPS based real timeReal Time Ultrasound for the examination of sElectronics to design pid controller for optiCalculation of PID Controller Parameters for Real-time Optimal Control for Online TrajectoEMBEDDED SYSTEM(REAL TIME DESIGN) ,ROBOTICS a

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks