Learning digital control systems with a low-cost educational platform

Learning digital control systems with a low-cost educational platform Learning digital control systems with a low-cost educational platform

ie.ksu.edu.tw
from ie.ksu.edu.tw More from this publisher
12.07.2015 Views

Proceedings of 2005 CACS Automatic Control ConferenceTainan, Taiwan, Nov 18-19, 2005table 1 for cost analysis). It consists of anATmega128 RISC CPU, an RS232 port tocommunicate with a PC, an in system programming(ISP) port for downloading programs from a PC to the128K byte flash memory, 6 pulse width modulation(PWM) output channels to drive power switches, 8A/D ports for accessing physical signals, an encoderinput port with resolutions being increased 4 times viaa programmable logic device (PLD), and severaldigital I/O ports. The reasons to choose an 8-bitmicroprocessor whose price is comparable to a digitalsignal processor (TMS320C24x) are threefold: 1)internal flash ROM size (128Kbyte) is larger, and canbe easily accessed via the ISP port; 2) softwaredeveloping environment can be constructed withoutany additional cost, and 3) the undergraduate studentsare more familiar with 8-bit micro-controllers thandigital signal processors (TMS320C24x). Thedrawback for this choice is that the computationalspeed is slower for multiplication and division,although this does not create too much trouble in ourexperiments.To download programs into the microprocessorby using the ISP port of ATmega128, a simple andcheap hardware interface circuit connected to theprinter port of a PC is necessary(www.lancos.com/e2p/avrisp-stk200.gif). Thecorresponding software, PonyProg2000, which runs atthe PC side can also be freely downloaded from theweb page www.lancos.com/ppwin95.html. Theencoder input circuit which is capable of increasingthe resolution 4 times of the original signals comingfrom an encoder is shown in figure 2. The idea isfrom an application note [10] by Microchiptechnology, Inc., and the programming equations ofthe PLD are listed in the following table:Table 1: Programming equations of the PLD forresolution enhancementPLD programming equations;---------------------------------------MODULE ENCODEDECLARATIONSIA , IB ,CLK,Mode PIN 2,3,1,4;UP,DOWN,U_D,DIR PIN 16,17,15,14;S1 ,S3, S2, S4,X1 NODE;EQUATIONSS2 := S1;S4 := S3;S1 := IA;S3 := IB;UP =(!S1 & S2 & S3 & S4+S1 & S2 & S3 & !S4 & Mode+S1 & !S2 & !S3 & !S4 & Mode+!S1 & !S2 & !S3 & S4 & Mode );DOWN =(S1 & S2 & !S3 & S4 & Mode+!S1 & S2 & !S3 & !S4 & Mode+!S1 & !S2 & S3 & !S4+S1 & !S2 & S3 & S4 & Mode );U_D := UP + DOWN;X1:=DIR;DIR=(UP # X1) &!DOWN;ENDThe resolution enhancement circuit can not onlygenerate two separate 4 times resolution up and downcount signals, it can also give an up/down countingsignal and a direction signal to meet different needs.The entire hardware circuit is shown in figure 3.Sensor Circuits:Temperature orcurrent ...Download program via ISP 8 A/D portsPersonal computer:communication &controlFigure 1.Figure 2.RS2322.2 Software moduleMicro‐controller:AVR mega128downEncoder counter:PLD for resolutionenhancement (4x)up6 PWMchannelsPhysical variablesΦ 1Φ 2Driver Circuits:for Motor or RelayThe hardware configuration of theeducational platformThe encoder interface circuit that provides4 times resolutionThe programming language used in theeducational platform is C, because of its portabilityand easy readability when compared with theassembly language.Thanks to the GNU project (www.gnu.org), theGNU C compiler for ATmega128 can be freelydownloaded from the web site www.avrfreaks.net, tohelp us construct the programming environment at nocost. The communication program shown in figure 4is written by using visual basic and provides functionsof loading control parameters into the microprocessor,receiving data of controlled variables from themicroprocessor through the serial RS232 bus,graphical representation of data, and saving data asMATLAB m-file format. Sample software codes aregiven to students such that more sophisticated analysistools could be implemented on top of them.3. ExperimentsTwo basic control problems are devised to helpstudents turn digital control theories into workingalgorithms in the educational platform, such that all

Proceedings of 2005 CACS Automatic Control ConferenceTainan, Taiwan, Nov 18-19, 2005the theories, the practical implementation issues, andproblem solving skills can be more efficiently learnedduring the course. The first one is digital servocontrol of DC motors, and the second one is digitaltemperature control of a water tank. They are simplesingle input single output (SISO) systems, and yetprovide enough theoretical and practical issues forstudents to learn.AVR mega128LM18200 H-bridge motor driverwith current sensingDC motor[3]. The mathematical models are then transformedto zero-order-hold sampled-data models [4]. Oncethe students are familiar with the modeling process,the coefficients of the corresponding discrete-timemodel for a DC motor can then be obtained by usingthe least-square estimation method [4, p.511], and thecoefficients of the corresponding analog model forheat transfer of a water tank can be found by using theon-line method proposed in [5], or the offline methodsin [9].RS232 portISP portFigure 3.PWM, ADC, and I/O portsencoder signalresolution enhancementencoder signal inputThe photograph of the entire hardwarecircuitFigure 4. The operation window of thecommunication programIn these two experiments, the H-bridge driverfrom the National semiconductor Corporation(www.national.com/pf/LM/LMD18200.html) is usedas a DC motor driver, and a solid-state relay is used todrive the heater in the digital temperature control of awater tank. The entire setup of the target systems areshown in figure 5. Both experiments consist of threeparts to lead students step by step to learn thenecessary digital control theories and to implement thecorresponding software codes. They are: 1)modeling and identification of physical systems, 2)performance and stability requirements of feedbackcontrolled systems, and 3) design of PID controllerswith anti-windup function, and tuning of controlparameters.3.1 Modeling and identification of physical systemsModeling of DC motors and heat transfer of awater tank can be found in text book by Franklin et al.3.2 Stability and performance requirements forfeedback controlled systemsStability and performance analysis of a feedbackcontrolled system are very important skills forstudents to make sure they will not destroy thehardware circuits and implement a usable controlalgorithm. Closed-loop stability assured by applyingthe Routh’s and Jury’s stability criterion [3-4], theNyquist criterion, and Bode’s gain-phase relationshipare concepts that students should keep in mind duringthe course. Time-domain specifications forperformance requirements of a step response are alsointroduced such that students will try to fine tune thecontrol parameters to meet the requirements. It isbecause our objective is to lead students to solvepractical digital control problems by using theeducational platform in a semester that those moreadvanced stability theory and frequency-domainspecifications for performance requirements are notincluded in our course.Table 1. Cost analysis of the educational platformPrice,Components and subsystemsNTD$ATmega128_16MHz 300Resolution enhancement circuit for75encoder signalsRS232 communication circuit 30In system programming circuit 60PCB board 150LMD18200 H-bridge driver circuit fordc motors500Solid-state Relay (12A) and temperaturesensor circuits300Total 14153.3 Design of PID controllers with anti-windupfunction and tuning of control parametersWhen the model parameters are at hand, themethods in [6, 8] about PID controller design and itsdigital implementation [4, p.306] and implementationof anti-windup functions [7, 4 p. 310] are used astheoretical background for digital feedback controllerdesign. This is because PID controllers are mostoften used in industrial control. After discussions ofthese theories, an initial software example code of the

Proceedings of 2005 CACS Automatic Control ConferenceTainan, Taiwan, Nov 18-19, 2005the theories, the practical implementation issues, andproblem solving skills can be more efficiently learnedduring the course. The first one is <strong>digital</strong> servo<strong>control</strong> of DC motors, and the second one is <strong>digital</strong>temperature <strong>control</strong> of a water tank. They are simplesingle input single output (SISO) <strong>systems</strong>, and yetprovide enough theoretical and practical issues forstudents to learn.AVR mega128LM18200 H-bridge motor driver<strong>with</strong> current sensingDC motor[3]. The mathematical models are then transformedto zero-order-hold sampled-data models [4]. Oncethe students are familiar <strong>with</strong> the modeling process,the coefficients of the corresponding discrete-timemodel for a DC motor can then be obtained by usingthe least-square estimation method [4, p.511], and thecoefficients of the corresponding analog model forheat transfer of a water tank can be found by using theon-line method proposed in [5], or the offline methodsin [9].RS232 portISP portFigure 3.PWM, ADC, and I/O portsencoder signalresolution enhancementencoder signal inputThe photograph of the entire hardwarecircuitFigure 4. The operation window of thecommunication programIn these two experiments, the H-bridge driverfrom the National semiconductor Corporation(www.national.com/pf/LM/LMD18200.html) is usedas a DC motor driver, and a solid-state relay is used todrive the heater in the <strong>digital</strong> temperature <strong>control</strong> of awater tank. The entire setup of the target <strong>systems</strong> areshown in figure 5. Both experiments consist of threeparts to lead students step by step to learn thenecessary <strong>digital</strong> <strong>control</strong> theories and to implement thecorresponding software codes. They are: 1)modeling and identification of physical <strong>systems</strong>, 2)performance and stability requirements of feedback<strong>control</strong>led <strong>systems</strong>, and 3) design of PID <strong>control</strong>lers<strong>with</strong> anti-windup function, and tuning of <strong>control</strong>parameters.3.1 Modeling and identification of physical <strong>systems</strong>Modeling of DC motors and heat transfer of awater tank can be found in text book by Franklin et al.3.2 Stability and performance requirements forfeedback <strong>control</strong>led <strong>systems</strong>Stability and performance analysis of a feedback<strong>control</strong>led system are very important skills forstudents to make sure they will not destroy thehardware circuits and implement a usable <strong>control</strong>algorithm. Closed-loop stability assured by applyingthe Routh’s and Jury’s stability criterion [3-4], theNyquist criterion, and Bode’s gain-phase relationshipare concepts that students should keep in mind duringthe course. Time-domain specifications forperformance requirements of a step response are alsointroduced such that students will try to fine tune the<strong>control</strong> parameters to meet the requirements. It isbecause our objective is to lead students to solvepractical <strong>digital</strong> <strong>control</strong> problems by using the<strong>educational</strong> <strong>platform</strong> in a semester that those moreadvanced stability theory and frequency-domainspecifications for performance requirements are notincluded in our course.Table 1. Cost analysis of the <strong>educational</strong> <strong>platform</strong>Price,Components and sub<strong>systems</strong>NTD$ATmega128_16MHz 300Resolution enhancement circuit for75encoder signalsRS232 communication circuit 30In system programming circuit 60PCB board 150LMD18200 H-bridge driver circuit fordc motors500Solid-state Relay (12A) and temperaturesensor circuits300Total 14153.3 Design of PID <strong>control</strong>lers <strong>with</strong> anti-windupfunction and tuning of <strong>control</strong> parametersWhen the model parameters are at hand, themethods in [6, 8] about PID <strong>control</strong>ler design and its<strong>digital</strong> implementation [4, p.306] and implementationof anti-windup functions [7, 4 p. 310] are used astheoretical background for <strong>digital</strong> feedback <strong>control</strong>lerdesign. This is because PID <strong>control</strong>lers are mostoften used in industrial <strong>control</strong>. After discussions ofthese theories, an initial software example code of the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!