Step variation studies of arm7 microcontroller based fuzzy logic


Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Step variation studies of arm7 microcontroller based fuzzy logic

  1. 1. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME405STEP VARIATION STUDIES OF ARM7 MICROCONTROLLERBASED FUZZY LOGIC CONTROLLER FOR WATER-IN-TANKLEVEL CONTROLL. Shrimanth Sudheer, P. Bhaskar and Parvathi C. S.Department of Instrumentation Technology, Gulbarga University Post Graduate Centre,RAICHUR –584133, Karnataka, INDIA,ABSTRACTDesign and development of ARM7 microcontroller based fuzzy logic controller(FLC) for water-in-tank level system is presented in this paper. A continuous tank of 100cmX 20cm X 20cm dimension with one inlet and one outlet is considered. The outlet flow ofwater is let open continuously to a reservoir and inlet flow is controlled by a pneumaticactuated valve. The valve opening is controlled according to the water level in the tank inorder to make the deviation zero. The necessary hardware and software is developedindigenously. FLC algorithm is written in embedded C in KEIL µV4 integrated developmentenvironment. The main objective of the experimental work is to improve the performance ofthe conventional PID controller by replacing it with modern FLC. The proposed controller issubjected to both step and step-variation (stair-case) inputs. The performance is comparedwith PIDC and necessary performance indices are found from the plots and tabulated. It isobserved that FLC outperforms the conventional PID in terms of quicker rise-time and bettertracking of the input.Keywords: ARM7, Microcontroller, Water-Level, PIDC, FLC.1. INTRODUCTIONThe liquid level control systems play an important role in industries, for example, theraw materials stock of the chemical works, the mixture raw materials process of thelithification works, and the output products reaction of biochemical and petrochemical plants,liquid level control of a steam generator in power plants, and pulp level control in paper andINTERNATIONAL JOURNAL OF ELECTRICAL ENGINEERING& TECHNOLOGY (IJEET)ISSN 0976 – 6545(Print)ISSN 0976 – 6553(Online)Volume 4, Issue 2, March – April (2013), pp. 405-415© IAEME: Impact Factor (2013): 5.5028 (Calculated by GISI)www.jifactor.comIJEET© I A E M E
  2. 2. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME406pulp industry. Typically, many works using liquid tank level systems are using on-off loopcontrol scheme, which contain only the relay device and the limit switch. For precisioncontrol, performance is limited by using this control; it is difficult to achieve accurate levelcontrol for improving manufacturing quality of the products.The recent development in the microcontroller, as single chip solution for many ofindustrial control applications, has made the author to select and implement the controlalgorithm on ARM7 microcontroller for liquid level control. The fuzzy logic control isemerged over the years and become one of the most active and fruitful areas of research inthe intelligent control applications in industries as well as home appliances. Fuzzy logiccontroller is a non linear controller and based on intuition and experience about the plant tobe controlled. Therefore it does not require the precise mathematical model of the plant.Level of liquid being an important process parameter has to be maintained at thedesired level for smooth running of the process and for better quality products. There havebeen many books/papers reported on the subject of controlling and monitoring liquid level indifferent industrial processes [1-5]. Miao Wang and Francesco Crusca [6] designed andimplemented a gain scheduling controller for water level control in a tank. It was observedthat the system achieved a better performance over the conventional controller like P, PI, andPID. Weidong Zhang, et al [7] proposed a new two-degree-of-freedom level control schemefor processes with dead time. T. Heckenthaler and S. Engell [8] developed level controller fora nonlinear two-tank system based on fuzzy control. Similarly, application of fuzzy logic forwater level control of small-scale hydro-generating units was reported by T. Niimura and R.Yokoyama [9], for water level control of steam generator was reported by X. Liu, and T. Chai[10], and a fuzzy sliding mode controller for two cascaded tanks level control was reportedby N. Waurajitti, et al [11]. The recent work by W. Chatrattanawuth, et al [12] reported alevel control system using a fuzzy I-PD controller. Their simulation results showed that theproposed fuzzy I-PD controller performed better over the conventional. C. Li and J. Lian [13]reported the application of genetic algorithm in PID parameter optimization for level controlsystem. They simulated the proposed strategy on MATLAB and later tested using LabVIEW.Another LabVIEW based water level control is also reported by L. Gao and J. Lin [14]. ADCS based water level control of boiler drum is reported by Y. Qiliang, et al [15]. A similarwork is also reported by H-M Chen, et al [16]. They designed a sliding mode controller for awater tank liquid level control system.In most of the research work reported earlier and recently, the studies have been eithersimulation, based on MATLAB, or implementation using LabVIEW with PC as the platform.The use of a single chip, advanced microcontroller with fuzzy logic control algorithms forliquid level control is rather scarce and nowhere found in the papers reported. So this is anovel approach and motivated us to employ an advanced, industry standard, ARM7microcontroller based control system for liquid level control. The proposed work is not onlyadvanced, but achieves low cost and high efficiency in terms of size, speed, performance, anddevelopment time.2. WATER-IN-TANK SYSTEMA continuous linear tank made of stain less steel with external dimensions of 100cmX 20cm X 20cm is considered. The process tank has one inlet and one outlet. The outlet flowof water is let open to a reservoir and inlet flow is controlled by a pneumatic actuated valve(PCV). A differential pressure transducer, placed at the bottom of the process tank, senses the
  3. 3. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME407liquid level in terms of pressure and converts into proportional voltage. The valve opening iscontrolled according the water level in the process tank in order to maintain the measuredvalue as close to set point as possible i.e., to make the deviation zero. The water fromreservoir is pumped to process tank by means of a pump through a PCV which in turncontrolled by the fuzzy logic algorithm run by the microcontroller to maintain the water levelof tank at the set-point. The set-point of the tank can be changed by user through hostcomputer connected to ARM7 microcontroller. The water-in-tank system is shown in Fig. 1.3. METHODOLOGYThe principle and block diagram of ARM7 microcontroller based water-in-tank levelcontrol system is shown in Fig. 2. Level of water in process tank is measured in terms ofpressure-head developed in the capillary attached to the tank at the bottom. The other end ofthe capillary is attached to a level sensor which is basically a differential pressure transducer(DPT). As the water level increases in the tank, the pressure due to air trapped inside thecapillary also increases. Hence, the pressure, directly proportional to the water level, issensed and converted into equivalent voltage by the sensor. The microcontroller measures thevoltage proportional to level through the transducer, instrumentation amplifier (IN-AMP),and on-chip analog to digital converter (ADC), converts into actual level in cm and displays iton LCD. ARM7 based microcontroller LPC2129 from Philips is used. The inlet flow of waterFig. 1. Water-in-tank systemDPTProcess TankReservoirLevelWater underProcessPumpHV2HV1PCVExcitationActuator1 mtr0LevelIndicator
  4. 4. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME408from reservoir to the process tank through a pump is controlled by a pneumatic valve whichin turn controlled by the microcontroller through on-chip PWM unit, PWM to voltageconverter, voltage to current and a current to air (I/P) converter connected to PCV. The I/Pconverter is supplied with a pressurized air (through air regulator) with the help of aircompressor.The LPC2129 from Philips Semiconductor [17] consists of an ARM7TDMI-S CPUwith real-time emulation and 256KB of embedded high speed flash memory available incompact 64 pin package. The ARM7TDMI-S is a general purpose 32-bit microprocessor,which offers high performance and low power consumption. Its architecture is based on RISCprinciple. It includes the following components: 16KB on-chip SRAM, 256KB Flash, 2-channel CAN interface, 4-channel 10-bit ADC, 32-bit timers with PWM units and RTC, 46GPIO ports, I2C bus interface, and on-chip crystal oscillator. The technical specifications ofequipment used in the experimental setup are given in Table 1.Table 1: Technical specifications of experimental setupPart Name SpecificationsProcess Tank(Rectangular/cylindrical)Material: Stainless SteelDimension: 100x20x20 cmReservoir Material: Stainless SteelVolume: 100 LitersPump Centrifugal (Single-Phase, ¼ HP)Control Valve Size ¼”, Pneumatic ActuatedType: Air to openInput: 3-15 psiAir Regulator Input: 400 psi (max)Output: 2-150 psiI/P Converter Input: 4-20 mAOutput: 3-15 psiPressure Gauge Range: 0-30 psi, 0-100 psiCompressor Output: 200 psi (max)Differential PressureTransducerType: DiaphragmRange:0-5 psiOutput: 3mV/V/psidFig. 2. Block diagram of proposed water-in-tank level control systemARM7 MicrocontrollerUART1FLCAlgorithOn-chipPWM1PumpProcessTankIN-AMPOn-chipADCReservoirPCVDPTPWM to VConverterV to IConverterI to PConverterLCDLiquidLevel
  5. 5. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME4093.1 Design of Fuzzy Logic ControllerA fuzzy logic controller (FLC) incorporates fuzzy logic for decision making, or ratherto produce control action, as required by the process or plant. FLCs are knowledge basedcontrollers consisting of linguistic “IF-THEN” rules that can be constructed using theknowledge of experts in the given field of interest [18-19]. The fuzzy inference engine is theheart of the FLC comprises both the knowledge base and decision-making logic. Theknowledge base consists of data base with necessary linguistic variables (rule set) anddecision-making logic used to decide what control action to be taken. The outputs ofinference engine, which are fuzzy linguistic terms, are converted into real (crisp) numbers inthe defuzzification stage [20-21].A two input and one output fuzzy logic controller is designed as shown in the Fig. 3.The error (e) and change-in-error (ce) are the two inputs, and control action (ca) is thecorresponding output of the FLC. A triangular membership function with nine members(linguistic variables) termed as negative large (NL), negative medium (NM), negative small(NS), negative zero (NZ), zero error (ZE), positive zero (PZ), positive small (PS), positivemedium (PM), and positive large (PL) are used to map the crisp input to universe ofdiscourse (-1 to +1). The universe of discourse is the range over which the fuzzy variables aredefined. The nine-member triangular functions of error, change-in error, and control actionare shown in Fig. 4. The control rules are constructed to achieve the best performance ofFLC. With nine members, we obtain 81 rules. The max-min method is used for inferenceengine. The defuzzification is done using centre of gravity (COG) method.The e input to the FLC is obtained by subtracting measured value/process variable (y)from the reference (r), and the ce which is the difference between present and previous errors.The output of the controller i.e., change in control action (ca) is applied to the process. Thereference input r, which is also the desired value, is entered by the operator in the beginning.This is a closed loop control where the process variable is being continuously monitored tomaintain the error zero.Fig. 3 Fuzzy logic control systemFLCFuzzifierInferenceEngineRule BaseDefuzzifierz-1r ++--e=r-y ycecaLevelProcess
  6. 6. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME4103.2 Software DetailsThe complete software for data acquisition, display, processing, and controlling theliquid level is developed in embedded C language using KEIL’s µV4 IntegratedDevelopment Environment. After compiling and debugging the code in PC, the output .hexfile is downloaded to LPC2129 microcontroller through serial port (COM1). The stored datain on-chip flash of microcontroller is sent back to PC for storing, plotting and furtheranalysis. The flowchart of the complete program is shown in Fig. 5. The program consists offive major subroutines of data acquisition (A/D conversion), LCD update, FLC algorithm,PWM generation, and serial communication.Fig. 4. Nine-member triangular functions of error (e),change-in-error (ce), and control action (ca)MembershipGradeµ(e)NL0. +1.0-1.0error (e)0.5-0.5NM NS NZ ZE PZ PS PM PLMembershipGradeµ(ce)NL0. +1.0-1.0change-in-error (ce)0.5-0.5NM NS NZ ZE PZ PS PM PLMembershipGradeµ(ca)NL0. +1.0-1.0Control action (ca)0.5-0.5NM NS NZ ZE PZ PS PM PL
  7. 7. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME411Fig. 5. The complete flowchart of level control programInitialize hardware(LCD, on-chip ADC, PWM1, and UART1)StartDeclare & Initialize LCD, ADC, PWM, & FLCvariables, members, & functionsSend valve-open & motor-on commandsCall ADC and LCD subroutine to displaypresent level in cmRead reference command (step/staircase) from the userCompute the error, change-in error andapply to FLC algorithmScale FLC o/p & load in PWM1 register togenerate control actionStore and send the control action to PCthrough UART1Update FLC variablesCall ADC & LCD subroutine to measureand display the initial level on LCD
  8. 8. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME4124. RESULTSThe liquid level control system is subjected to step and step variation inputs. Beforesubjecting the system to various test commands, the system initial conditions are met. Underinitial conditions, the process tank outlet is let open at a fixed (constant) flow rate. The supplyair to I/P converter is provided by an air regulator at a pressure of 30psi from a compressor.For a step input, a desired level command of 15cm is applied. The correspondingresponses of the controllers are plotted as shown in Fig. 6. The rise time and settling time ofFLC are found to be respectively 52.77 sec and 65.56 sec as shown in Table 2. The steadystate error is found to be zero. FLC achieves superior performance when compare to thetraditional PIDC (best tuned with KP=390.0, KI=0.45, KD=0.1, & T=1).In case of step variation studies, a stair-case command is applied to the controller. Theinput command is varied for three values, in a step of 15cm from 0 to 15cm, 15 to 30cm, and30 to 45cm. The corresponding output responses of both PIDC and FLC are plotted as shownin Fig. 7. It is evident from the plot that FLC performs better than PIDC in tracking the stepvariation of the input. PIDC performs sluggishly to the input. The standard performanceindices of PIDC and FLC at different liquid levels are tabulated in Table 3.In both the cases fuzzy logic controller outperformed the PID controller. Hence, wesay that FLC is a robust controller when compare to PIDC and can be easily implementedreplacing the existing PIDC.Table 2. Performance comparison for a step input of 15 cmPerformance Indices→Controller Type↓Risetime (tr)Settlingtime (ts)Steady stateerror (ess)Overshoot (MP)PIDC 67.39 sec 120.50 sec 0.4 cm 4%FLC 52.77 65.56 sec 0 0.6%Table 3. Performance comparison for stair-case inputLiquid Level→Performance Indices↓15 cm 30 cm 45 cmRise time (sec) PIDC 67.39 67.60 68.00FLC 52.77 53.10 51.80Settling time (sec) PIDC 120.5 134.6 111.5FLC 65.56 65.80 64.40Overshoot (%) PIDC 4 0.6 0.6FLC 0.6 0.6 0.6
  9. 9. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME413Fig. 6. Step response of PIDC and FLC (from 0 to 15 cm)0 50 100 150 200 250 30013691215Time in SecLevelinCmFLCPIDCFig. 7. Staircase response of PIDC and FLC (from 0 to 45cmin a step of 15 cm)0 100 200 300 400 500 600 700 800 90005101520253035404550Time in secLevelincmREF FLCPIDC
  10. 10. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME4145. CONCLUSIONSThe real time implementation of fuzzy logic controller on an advanced ARM7 basedLPC2129 microcontroller for liquid level control is discussed. The performance comparisonbetween conventional PIDC and proposed FLC is made for a standard step, and step variationinputs. It is observed that FLC performed better than the conventional PIDC. FLC was foundto be quick in reaching the set point, and settling, besides robust for step variations. So, it canbe concluded with the present work that FLC is superior over PIDC. Also, incorporation ofARM7 microcontroller has increased the performance and greatly reduced the cost and spacein terms of few interfacing circuits.REFERENCES[1] Lipták, Béla G., Process Control: Instrumentation Engineers’ Handbook, 3rd ed.,Butterworth-Heinemann, Oxford, 1999.[2] Considine, Douglas M., Process/Industrial Instruments & Controls Handbook, 4th ed.McGraw-Hill, International Editions 1993.[3] Levine, William S., The Control Handbook, CRC Press, 1996.[4] Hamilton, J. A., and Guy, P. J., “Pulp level control for floatation-options and a csirolaboratory perspective,” Minerals Eng, vol. 14, pp.77-86, 2001.[5] G. Sakthivel, T. S. Anandhi, S. P. Natarajan, “Design of fuzzy logic controller for aspherical tank system and its real time implementation,” International Journal ofEngineering Research and Applications, vol. 1, issue 3, pp. 934-940.[6] Miao Wang and Francesco Crusca, “Design and implementation of a gain schedulingcontroller for a water level control system,” ISA Transactions, vol.41, no.3, pp.323-331,2002.[7] Weidong Zhang, Xiaoming Xu, and Yugeng Xi, “A new two-degree-of-freedom levelcontrol scheme,” ISA Transactions, vol.41, no.3, pp.333-342, 2002.[8] Thomas Heckenthaler and Sebastian Engell, “Approximately time-optimal fuzzy controlof a two-tank system,” IEEE Control Systems, pp. 24-30, 1994.[9] Takahide Niimura and Ryuichi Yokoyama, “Water level control of small-scale hydro-generating units by fuzzy logic,” IEEE, pp. 2483-2487, 1995.[10] Xiangjie Liu and Tianyou Chai, “A weighted algorithm of fuzzy logic strategy on waterlevel control of steam generator,” Proc. of the 36thConference on Decision and Control,pp. 3357-3362, San Diego, USA, 1997.[11] Nawaporn Waurajitti et al, “Adaptive fuzzy sliding mode controller for two cascadedtanks level control,” IEEE, pp. II-592- II-597, 2000.[12] Wicharn Chatrattanawuth et al, “Fuzzy I-PD controller for level control,” SICE-ICASEInternational Joint Conference 2006, Bexco, Busan, Korea, pp. 5649-5652, 2006.[13] Chengwei Li and Jiandong Lian, “The application of immune genetic algorithm in PIDparameter optimization for level control system,” Proc. of the IEEE Int. Conf. OnAutomation and Logistics, Jinan, China, pp. 782-786, 2007.[14] Ling Gao and Jianqun Lin, “LabVIEW and internet based remote water level controllaboratory,” IEEE, pp. 187-188, 2007.[15] Yang Qiliang et al, “Water level control of boiler drum using one IEC61131-3 basedDCS,” Proc. of the 26thChinese Control Conference, Zhangjiajie, Hunan, China, pp-252-255, 2007.
  11. 11. International Journal of Electrical Engineering and Technology (IJEET), ISSN 0976 –6545(Print), ISSN 0976 – 6553(Online) Volume 4, Issue 2, March – April (2013), © IAEME415[16] Hong-Ming Chen, Zi-Yi Chen, and Juhng Perng Su, “Design of a sliding mode controllerfor a water tank liquid level control system”, Proc. 2nd Int. Conf. on InnovativeComputing, Information & Control, ICICIC ’07, Vol. 4, No. 12, pp. 3149-3159, Dec2008.[17] Philips LPC2129 User Guide[18] John Yen, Reza Langari, “Fuzzy Logic: Intelligence, Control and Information”, PrenticeHall, Englewood Cliffs, NJ, 1999.[19] E. Cox, Fuzzy Fundamentals, IEEE Spectrum, vol. 29, no.10, pp. 58-61, 1992.[20] Chun Chen Lee, “Fuzzy logic in control systems: Fuzzy logic controller – Part I, II,”IEEE Transactions on Systems, Man and Cybernetics, vol. 20, no.2, 1990.[21] Li Zheng, “A practical guide to tune of PI like fuzzy controllers,” IEEE Int. Conf. onFuzzy Systems, pp.633-640, 1992.[22] L. Shrimanth Sudheer, Immanuel J., P. Bhaskar and Parvathi C. S., “Arm7Microcontroller Based Fuzzy Logic Controller for Liquid Level Control System”,International Journal of Electronics and Communication Engineering & Technology(IJECET), Volume 4, Issue 2, 2013, pp. 217 - 224, ISSN Print: 0976- 6464, ISSN Online:0976 –6472.[23] Dr Amged S. El-Wakeel, Dr A.E. Elawa and Y.S. Eng. El-Koteshy, “Position Control ofa Single ARM Manipulator Using Ga-Pid Controller”, International Journal of ElectricalEngineering & Technology (IJEET), Volume 4, Issue 2, 2013, pp. 120 - 135, ISSN Print :0976-6545, ISSN Online: 0976-6553.[24] VenkataRamesh.Edara, B.Amarendra Reddy, Srikanth Monangi and M.Vimala,“Analytical Structures for Fuzzy Pid Controllers and Applications”, International Journalof Electrical Engineering & Technology (IJEET), Volume 1, Issue 1, 2010, pp. 1 - 17,ISSN Print : 0976-6545, ISSN Online: 0976-6553.