A PID Controller for Real-Time DC Motor Speed Control using the C505C Microcontroller

Similar documents
Four Quadrant Speed Control of DC Motor with the Help of AT89S52 Microcontroller

CHAPTER 4 CONTROL ALGORITHM FOR PROPOSED H-BRIDGE MULTILEVEL INVERTER

Design of stepper motor position control system based on DSP. Guan Fang Liu a, Hua Wei Li b

CHAPTER 4 FUZZY LOGIC CONTROLLER

AutoBench 1.1. software benchmark data book.

DC Motor Speed Control using PID Controllers

Using Magnetic Sensors for Absolute Position Detection and Feedback. Kevin Claycomb University of Evansville

Development of a MATLAB Data Acquisition and Control Toolbox for BASIC Stamp Microcontrollers

Design of double loop-locked system for brush-less DC motor based on DSP

Wireless Sensor Network for Intra-Venous Fluid Level Indicator Application

Job Sheet 2 Servo Control

6. HARDWARE PROTOTYPE AND EXPERIMENTAL RESULTS

CHAPTER 6 DEVELOPMENT OF A CONTROL ALGORITHM FOR BUCK AND BOOST DC-DC CONVERTERS USING DSP

2.017 DESIGN OF ELECTROMECHANICAL ROBOTIC SYSTEMS Fall 2009 Lab 4: Motor Control. October 5, 2009 Dr. Harrison H. Chin

Control of Electrical Lights and Fans using TV Remote

DC motor control using arduino

Citrus Circuits Fall Workshop Series. Roborio and Sensors. Paul Ngo and Ellie Hass

CHAPTER 7 HARDWARE IMPLEMENTATION

SERVO MOTOR CONTROL TRAINER

Effective Teaching Learning Process for PID Controller Based on Experimental Setup with LabVIEW

Jaguar Motor Controller (Stellaris Brushed DC Motor Control Module with CAN)

EECE494: Computer Bus and SoC Interfacing. Serial Communication: RS-232. Dr. Charles Kim Electrical and Computer Engineering Howard University

Lab 23 Microcomputer-Based Motor Controller

Design and Implementation of AT Mega 328 microcontroller based firing control for a tri-phase thyristor control rectifier

International Journal of Research In Science & Engineering e-issn: Volume: 3 Issue: 2 March-April 2017 p-issn:

IGBT based Multiport Bidirectional DC-DC Converter with Renewable Energy Source

Project Proposal. Low-Cost Motor Speed Controller for Bradley ECE Department Robots L.C.M.S.C. By Ben Lorentzen

Hydraulic Actuator Control Using an Multi-Purpose Electronic Interface Card

Design Of Low-Power Wireless Communication System Based On MSP430 Introduction:

Microcontroller Based Closed Loop Speed and Position Control of DC Motor

A HARDWARE DC MOTOR EMULATOR VAGNER S. ROSA 1, VITOR I. GERVINI 2, SEBASTIÃO C. P. GOMES 3, SERGIO BAMPI 4

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

Design and implementation of GSM based and PID assisted speed control of DC motor

PWM, ALT, HALT, HAST.

Observer-based Engine Cooling Control System (OBCOOL) Project Proposal. Students: Andrew Fouts & Kurtis Liggett. Advisor: Dr.

CSE 3215 Embedded Systems Laboratory Lab 5 Digital Control System

A Simple Microcontroller-Based 4-20 ma Current Loop Receiver for Sensors with Current Transmitters

Using Z8 Encore! XP MCU for RMS Calculation

Brushed DC Motor Microcontroller PWM Speed Control with Optical Encoder and H-Bridge

REAL-TIME LINEAR QUADRATIC CONTROL USING DIGITAL SIGNAL PROCESSOR

Digital-to-Analog Converter. Lab 3 Final Report

RX23T inverter ref. kit

Separately Excited DC Motor for Electric Vehicle Controller Design Yulan Qi

Speed Control of Three Phase Induction Motor Using Fuzzy-PID Controller

DESIGN OF INTELLIGENT PID CONTROLLER BASED ON PARTICLE SWARM OPTIMIZATION IN FPGA

Brushed DC Motor Control. Module with CAN (MDL-BDC24)

OVEN INDUSTRIES, INC. Model 5C7-362

Electric Bike BLDC Hub Motor Control Using the Z8FMC1600 MCU

Figure 1.1: Quanser Driving Simulator

RS-232 Electrical Specifications and a Typical Connection

EMBEDDED SYSTEM DESIGN FOR A DIGITAL MULTIMETER USING MOTOROLA HCS12 MICROCONTROLLER

Negative Output Multiple Lift-Push-Pull Switched Capacitor for Automotive Applications by Using Soft Switching Technique

A PID Controlled Real Time Analysis of DC Motor

Motor Control using NXP s LPC2900

A COMPARISON STUDY OF THE COMMUTATION METHODS FOR THE THREE-PHASE PERMANENT MAGNET BRUSHLESS DC MOTOR

Based on the ARM and PID Control Free Pendulum Balance System

Modulating control valve

Digital Controller Chip Set for Isolated DC Power Supplies

Design of a Simulink-Based Control Workstation for Mobile Wheeled Vehicles with Variable-Velocity Differential Motor Drives

Performance Evaluation of Negative Output Multiple Lift-Push-Pull Switched Capacitor Luo Converter

CHAPTER 2 PID CONTROLLER BASED CLOSED LOOP CONTROL OF DC DRIVE

Programming and Interfacing

CHAPTER 5 CONTROL SYSTEM DESIGN FOR UPFC

UNIT 2: DC MOTOR POSITION CONTROL

CHAPTER-III MODELING AND IMPLEMENTATION OF PMBLDC MOTOR DRIVE

CHAPTER 2 VSI FED INDUCTION MOTOR DRIVE

Electronics Design Laboratory Lecture #4. ECEN 2270 Electronics Design Laboratory

CHAPTER 6 CURRENT REGULATED PWM SCHEME BASED FOUR- SWITCH THREE-PHASE BRUSHLESS DC MOTOR DRIVE

III. MATERIAL AND COMPONENTS USED

CHAPTER 4 MULTI-LEVEL INVERTER BASED DVR SYSTEM

Final Report. Project #26 Magnetic Levitation Control

CHAPTER 4 HARDWARE DEVELOPMENT OF STATCOM

AN IMPLEMENTATION OF MULTI-DSP SYSTEM ARCHITECTURE FOR PROCESSING VARIANT LENGTH FRAME FOR WEATHER RADAR

Design of Different Controller for Cruise Control System

Prototyping Unit for Modelbased Applications

Speed Control of Single Phase Induction Motor Using Infrared Receiver Module

Digital Control of MS-150 Modular Position Servo System

MODEL BASED DESIGN OF PID CONTROLLER FOR BLDC MOTOR WITH IMPLEMENTATION OF EMBEDDED ARDUINO MEGA CONTROLLER

Total Hours Registration through Website or for further details please visit (Refer Upcoming Events Section)

Module 5. DC to AC Converters. Version 2 EE IIT, Kharagpur 1

Peripheral Link Driver for ADSP In Embedded Control Application

Design of intelligent vehicle control system based on machine visual

Hardware Platforms and Sensors

ANGULAR POSITION CONTROL OF DC MOTOR USING SHORTEST PATH ALGORITHM

ENGG4420 END OF CHAPTER 1 QUESTIONS AND PROBLEMS

Design and Simulation of PID Controller using FPGA

Ver. 4/5/2002, 1:11 PM 1

Training Schedule. Robotic System Design using Arduino Platform

Matlab Data Acquisition and Control Toolbox for Basic Stamp Microcontrollers

Powering Automotive Cockpit Electronics

Project Final Report: Directional Remote Control

A Model-Based Development Environment and Its Application in Engine Control

Design of Vehicle Lamp Control System based on LIN bus Wen Jian-yue1, a, Luo Feng1, b

Sensors and Sensing Motors, Encoders and Motor Control

DIGITAL SIGNAL PROCESSING LABORATORY

SIMULATION AND IMPLEMENTATION OF PID-ANN CONTROLLER FOR CHOPPER FED EMBEDDED PMDC MOTOR

RAPID PROTOTYPING OF CONTROL SYSTEMS FROM ELECTROMAGNETIC TRANSIENT SIMULATOR PROGRAM

Introduction to Digital Control

νµθωερτψυιοπασδφγηϕκλζξχϖβνµθωερτ ψυιοπασδφγηϕκλζξχϖβνµθωερτψυιοπα σδφγηϕκλζξχϖβνµθωερτψυιοπασδφγηϕκ χϖβνµθωερτψυιοπασδφγηϕκλζξχϖβνµθ

Automotive Control Solution for Brushless DC Motors

Transcription:

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 Motor speed controller design using a microcontroller-based network system. The design architecture was developed using two Phytec evaluation boards each having an Infineon eightbit C505C-L microcontroller. The system detects the realtime speed of the motor using the sensor device and then transfers data to the first Phytec board s microcontroller using serial communication. This data is processed and transferred to the second Phytec board s microcontroller using a Controller Area Network (CAN) communication scheme. The second microcontroller uses the received data to calculate the real-time control value to monitor and keep the motor speed constant based on a command signal. Data is then transferred back to the first Phytec board s microcontroller using CAN and is utilized to change the motor voltage such that its speed is constant. The importance of the proposed design architecture is its ability in controlling precisely the motor speed and/or direction especially when used in modern automobiles where the CAN protocol is quite popular. Moreover, the proposed real-time controller approach is based on the closed loop feedback error principle unlike the existing open loop designs. The paper details the system design and the experimental results that were obtained. Key Words: Real-time DC motor speed control, C505C microcontroller, Controller Area Network 1. Introduction Rapid progress in microelectronics and microcontrollers in recent years has made it possible to apply modern control technology to automobiles that need real-time control. Automotive technology uses several electronic control units (ECU) to control efficient and reliable operation of key components namely, the engine, transmission, anti-lock braking system (ABS), cruise, steering, vehicle traction, and entertainment [1]. DC motors control, many of these operations and therefore there is a need for implementing effective control strategies for digital control of these motors. Currently, auto manufacturers use multiplex buses for integrating all their vehicle electronics and instead of using the proprietary buses for the transfer of data within the vehicle, the Controller Area Network (CAN) proposed by Robert Bosch [6] is becoming an industry standard. Therefore, it is quite important to develop real-time DC motor control strategies such that these devices are effectively integrated with their control electronics using the CAN network protocol. Realizing the fact that large number of motors are utilized in modern vehicles and there is especially a need to control these small motors using a common bus with interrupt priorities, such realtime control is extremely essential. Several research efforts have shown the ability of using digital signal processing (DSP) kits for real-time motor control such as a proportional-integral-derivative (PID) controller using the TMS320c31 DSK kit [2]. Subsequently it also addressed some steps into adaptive control using the same DSP kit [3]. However, many such processing kits do not have the ability of high-speed networking and use open loop control strategies. As opposed to those research directions, the proposed system makes use of the high speed CAN protocol that has builtin error management and therefore reduces the effect of electromagnetic interference (EMI) [6]. The system uses the Infineon eight-bit C505C-L microcontroller that has several peripherals including three timer/counter units, an analog-to-digital (A/D) converter, a serial communication interface (USART), and supports the CAN protocol [4,5]. This paper proposes a real-time DC motor control design approach using the CAN protocol to communicate between a local microcontroller that senses motor speed and controls a motor driver circuit, and a remote microcontroller that contains an embedded closed loop digital controller for the motor speed correction. At first, a PID Controller is designed using MATLAB and Simulink with a practical motor model. The transfer function model of the motor is then used to design the digital controller. Subsequently, this developed design is used to generate the sensor architecture and software program, which is loaded to the first microcontroller. This microcontroller acts as the integrator between the motor and the digital controller. The motor speed is then transferred to the second microcontroller (using a CAN bus) that is loaded with the controller architecture

software program. Based on changes in the motor speed, which is recorded using the first microcontroller, the control value is generated which in turn is used to correct any speed deviation. The whole process including the network bus monitoring is carried out in real-time. The paper is organized as follows. In section 2, a generic control schematic using two microcontrollers communicating through a CAN bus is discussed. This section also details the DC motor speed control strategy using pulse width modulation (PWM). In section 3, the digital PID controller design concepts and the simulation test results of the PID controller on the DC motor model using the MATLAB environment is discussed. Section 4 details the flowchart for each microcontroller and their communication using the CAN bus, while section 5 shows the test results observed. Lastly, section 6 points out the conclusions inferred from the project. Figure 1 shows the scheme used for controlling the motor speed using two microcontrollers communicating with each other through a CAN bus. As can be seen, the motor speed is sensed and transmitted to the CAN bus by M 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 the driver circuitry which normally changes the voltage to stabilize the speed uses this information. The CAN bus monitor maintains the priority of different motor control operations and schedules the interrupt level for the specific operation domain. Control of DC motors by PWM is very well known [7]. In the process of varying the pulse by controlling the switching 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 pulse with 50% duty cycle. 2. Motor speed control using CAN Controller Area Network (CAN) CAN Bus Monitor Microcontroller (M 1 ) CAN Node 1 CAN Node 2 Microcontroller (M 2 ) Driver Circuit Motor Sensor Digital Controller Figure 1: Generic schematic diagram of the real-time DC motor control V in Period (T) Vavg Figure 2: Square wave with 50% duty cycle

As shown, if the input voltage V in can be switched on and off frequently at the uniform rate then the total period T will be: T T on + T off (1) where: T on ON time and T off OFF time. The average output voltage in this case is 0.5 * V in. In general, the output voltage will be: V T V V D V (2) on avg in Ton + T avg ( ) in off 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 on the output or the speed of the motor, whereas in closed loop control in which the control value is dependent on the speed of the motor. In the proposed approach a closed loop speed control with a digital PID controller is designed. A potentiometer was used as the reference command signal to set the input voltage at various levels as required. Further, the control value obtained from microcontroller M 2 is utilized to generate the average output voltage for adjusting the duty cycle (D) in order to maintain constant motor speed. 3. Digital controller design and simulation Figure 3 shows the block diagram of the proposed digital PID controller, where R(s) is the reference input, y(s) is the system output, C(s) is the controller transfer function, and H(s) is the feedback loop (sensor) transfer function. The digital PID Controller has the following form [8], T z + 1 z + 1 C( K + K + K (3) P I D 2 z Tz where: K P, K I and K D are the proportional, integral and derivative parameters of the controller and T the sampling time. The discrete form of the controller transfer function C( can also be written as: where: K1T a0 K + 2 a + a Z 2 0 1 2 C ( (4) p + KP, a T 1 z + a Z K1T 2K P K p + and a 2 T 1 2 K T In the Z domain the above mentioned second order polynomial will be: 1 2 Y( a + a Z + a Z * C( ) and 0 1 2 z X ( (1 Z ) * C( (5-6) where: X( is the input to the controller and Y( the output of the controller. Taking the inverse z-transformation, the following expressions are obtained: ( k) a0 g( k) + a1g( k ) + a2 g( k Y and g(k)x(k)+g(k-1) (7-8) where: k is the time constant. This gives a relation between the output of the plant and the controller. The DC motor is modeled using the following transfer function: 22s G DC ( s) (9) ( s + 4) In the digital domain this is translated with respect to a sampling time (T) of 250 msec as, 2) P R(s) D/A Controller C(s) A/D Plant G(s) y(s) Sensor H(s) Figure 3: Discrete PID controller structure

22 G ( Z ) [1 Z ] (10) DC 1 0.368Z Combining the motor model and the controller equation the closed loop system will be, y ( Z ) C ( Z ) * G ( z ) S ( z ) R ( Z ) 1 + C ( Z ) G ( Z ) (11) with the characteristic equation as 1 + C ( z ) G ( z ). The controller parameters are designed such that the steady state error e( Z ) R( [1 S( ] asymptotically tends to zero i.e. 1 0 for a unit step input. Combining 1+ C( G( equations (3) and (10), 1 2 1 + C ( z ) G ( z ) 1+ 22a0 + (22a1 0.368) Z + 22a2Z or 2 1 + 22a 0 + (22a1 0.368) Z + 22a2Z (12) The developed DC motor model and the closed loop system are then used to generate the coefficients of the digital PID controller using MATLAB. Figure 4 shows the settling time for the model for a motor input set point of 15 revolutions per second (rps). Considering this settling time for the practical DC motor model, the coefficients of the discrete PID constants are formulated for the closed loop system. Further, using these coefficients from (8), the following coefficient matrices are 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 span desired) 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 was done using the Digital Application Engineer (DAvE) software from Infineon Technologies [9] and the µvision2 software package from Keil software Inc. [10]. Initialize variables for Error, Reference, Potentiometer Voltage and Speed Develop the Transfer Function for Motor and PID Controller Initialize the Motor Output and the Controller Output Start the A/D Converter and check the sampling time Check the Time Ts and BSY 1 Yes Read the A/D Conversion value Calculate the Controller Output with the current Error No Find the System Output by using the Controller Output and the System Characteristics Find the Change in the Speed Find the new System Output from change in the speed Find the new current Error Set the time as zero Figure 4: Step response of the DC motor model Figure 5: Algorithmic flowchart

While DAvE was used to set the peripheral registers of the microcontroller, µvision2 was used for writing and compiling the 'C' code. Figure 5 shows the flowchart of the algorithm that was developed. The controller equations were loaded into the flash memory of the microcontroller M 2. For simulation purposes, the transfer function equations of the motor were loaded into the flash memory of the microcontroller M 1. At first, the system output from the transfer function was utilized to generate the controller value from the microcontroller M 2. The motor speed was read at 250 msec intervals using the A/D converter of M 1, and the digital inputs were converted into a CAN data frame for two bytes. The object consists of these two bytes and an 11-bit identifier 0x111. This data is then transferred to the CAN bus which is identified by the CAN bus monitor as the system output. Microcontroller M 2 waits for a CAN message with identifier 0x111. Therefore, as soon as the above object with identifier 0x111 appears on the CAN bus, it is captured by M 2. M 2 uses this received data to generate the controller value. The controller value is calculated using the difference between the reference speed (based on the potentiometer setting) and the actual speed measured by M 1. This error is then used to generate the PID constants, which in turn develops the duty cycle (D) equivalent for the discrete closed loop control. The required duty cycle is then transferred back to the CAN bus using another 11-bit identifier (0x222) and two bytes of data from CAN Node 2 (refer Figure 1). Every second, the CAN nodes (both Node 1 and 2) identifies their object and subsequently the data, and interact with each other to develop the required motor driver voltage and in turn, the required motor speed. This overall process of feedback control is done in real-time such that the motor speed stays at the same set value. 5. Practical implementation requirements In order to implement the proposed scheme with a practical DC motor instead of reading the speed from the output of the modeled equation, the recorded speed was taken from the motor sensor. Further, the output of microcontroller M 2 is utilized to generate the average voltage with the help of a driver circuit. The following subsections discuss the process. Feedback sensor: The feedback sensor senses the speed from the practical motor. There are various types of sensors that can be used for sensing the speed accurately during the desired time. One such sensor is an optical infrared interrupter switch as explained in [11]. It is an open collector buffered digital output that is compatible with transistor-transistor logic (TTL). A key advantage of this type of sensor is that it is not connected physically to the motor shaft and therefore does not bear any additional load to the motor. However, an optical sensor will be an ideal choice if it needs to be used in an oil-laden environment. Input driver circuit: The input driver can be directly developed from the microcontroller port. One important factor is the load current requirement of the motor. It is quite obvious that the requirements of any practical motor are higher than any microcontroller can supply. Thus, the current amplification procedure is essential even though the digital value of the motor voltage can be derived from the output port. Transistors or integrated circuit (IC) chips can carry out the amplification procedure. One such implementation is done in [11] using an L293D driver. This device can supply up to 600 ma current per channel. The output port of the microcontroller can be directly connected to this device for driving the motor. 6. Simulation and test results To test the system, the reference speed was set to about 4.5V (about 50% D). The motor speed was then displayed on a desktop computer using the HyperTerminal software, and transferred to microcontroller M 2. The controller software embedded within M 2 calculates the necessary duty cycle required for maintaining the motor speed at the required constant value. Figure 6 shows the actual output voltage waveform and the input set point. The codes were generated using the DAvE and µvision2 software programs. The software was written in C language. The proposed design uses a Dearborn Protocol Adapter II (DPA-II) to monitor the CAN system bus and uses a practical DC motor model. Figures 7 and 8 show the simulation results for a change in the speed value and the motor speed corresponding to the above change. As can be seen from Figure 7, a speed change of around 1.5 1.7 rps is continuously fed using a potentiometer. The remote controller has been applied in the forward loop based on the DC motor model and the updated value of the controller is used each time as the motor input using the CAN bus. The speed variation at each instant along with the controller action is observed. It was noted that the motor output is within the range of set point speed, which is 14.5-15.5 rps. Thus, the controller action is effective as the actual speed without the controller should drop to 13.3 13.5 rps during the snap-shot time span of 1 second. Figure 8 also shows the controller response during this period.

Figure 6: Output and input voltage changes information between a local microcontroller that senses the motor speed and a remote microcontroller that contains the logic of the digital controller. The proposed scheme works as a remote controller, which communicates with a local DC motor or its model using the CAN protocol. The main investigation focused on developing a system that corrects changes in motor speed due to extraneous disturbances in an extremely rapid fashion. Therefore, microcontrollers that had full duplex CAN communication capability were chosen. The output results have shown that a 5% change in speed is brought back to zero, and the motor speed settles to its constant value of 15 rps within 1 second using the proposed controller scheme. These observations clearly show the ability of the real-time controller to constantly keep the output variable within limits when there is a change or disturbance in the output, and in turn maintain the speed of the motor at a constant value. The most critical aspect that requires close consideration is the sampling time. References 7. Conclusions Figure 7: Motor speed changes Figure 8: Controller response A real-time PID digital controller has been developed that controls the speed of a DC motor in a closed loop manner. A CAN differential bus is used for transferring [1] W.B.Ribbens, Understanding Automotive Electronics, SAE Publications, 1998. [2] J.Tang and R.Chassaing, PID Controller Using the TMS320C31 DSK for Real-Time DC Motor Control Proceedings of the 1999 Texas Instruments DSPS Fest, Houston, Texas, August 1999. [3] J.Tang et. al., Real-Time Adaptive PID Controller Using the TMS320C31 DSK, http://www.integrateddsp.com/software/publications/fest2k.pdf, November 2002. [4] C505C 8-Bit CMOS Microcontroller User s Manual 08.97, Siemens, August 1997. [5] KitCON Hardware-Manual Version 3.0, PHYTEC Inc., June 1997. [6] CAN Specification, Version 2.0, Robert Bosch GmbH, Postfach 300240, D-7000, Stuttgart, September 1991. [7] P.C.Sen, Principles of Electric Machines and Power Electronics, Second Edition. John Wiley & Sons Inc., 1997. [8] G.F.Franklin, J.D.Powell, and M.L.Workman, Digital Control of Dynamic Systems, Addison- Wesley, 1998. [9] Digital Application Engineer DAvE, Infineon Technologies,http://www.infineon.com/cgi/ecrm.dll/e crm/scripts/search/prom_page_dispatcher.jsp?oid29 504&search_stringDavE, 2004. [10] µvision2 IDE and Debugger, Keil Software Inc., www.keil.com/uvision2, 2004. [11] M.M.Jamali et. al., A CAN based Real-Time Embedded System for DC Motor Control, SAE 2002 World Congress, Detroit, Michigan, March 4-7, 2002.