INTERNATIONAL JOURNAL OF ELECTRONICS AND   International Journal of Electronics and Communication Engineering & Technology...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 097...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 097...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 097...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 097...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 097...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN 0976 – 6464(Print), ISSN 09...
International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN 0976 – 6464(Print), ISSN 09...
Upcoming SlideShare
Loading in …5
×

Arm7 microcontroller based fuzzy logic controller for liquid level control system

847 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
847
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
34
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Arm7 microcontroller based fuzzy logic controller for liquid level control system

  1. 1. INTERNATIONAL JOURNAL OF ELECTRONICS AND International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN 0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEMECOMMUNICATION ENGINEERING & TECHNOLOGY (IJECET)ISSN 0976 – 6464(Print)ISSN 0976 – 6472(Online)Volume 4, Issue 2, March – April, 2013, pp. 217-224 IJECET© IAEME: www.iaeme.com/ijecet.aspJournal Impact Factor (2013): 5.8896 (Calculated by GISI) ©IAEMEwww.jifactor.com ARM7 MICROCONTROLLER BASED FUZZY LOGIC CONTROLLER FOR LIQUID LEVEL CONTROL SYSTEM L. Shrimanth Sudheer, Immanuel J., P. Bhaskar, and Parvathi C. S. Department of Instrumentation Technology, Gulbarga University Post Graduate Centre, RAICHUR –584133, Karnataka, INDIA, ABSTRACT Design and construction of a microcontroller based liquid level control system is presented in this paper. ARM7 (Philips LPC2129) microcontroller based system for the real time liquid level control is developed using the fuzzy logic controller (FLC). This controller has been applied to the water-in-tank level control of a continuous process. The controller is implemented in embedded C language to control the liquid level to the desired value. The performance of the proposed controller is compared with conventional PID controller. An accuracy of ±.1% is achieved in the control of liquid level over the range of 0 to 100cm. It is observed that the proposed scheme controls the tank level effectively not only in the steady state but also in the transient state. Keywords: ARM7, FLC, Liquid Level, Microcontroller. 1. INTRODUCTION The nonlinear systems are frequently encountered in the process industries. Level of liquid being an important process parameter has to be maintained at the desired level for smooth running of the process and for better quality products. There have been many papers reported on the subject of controlling and monitoring liquid level in different industrial processes. M. Wang and F. Crusca [1] designed and implemented a gain scheduling controller for water level control in a tank. It was observed that the system achieved a better performance over the conventional controllers like P, PI, and PID. W. Zhang et al [2] proposed a new two-degree-of-freedom level control scheme for processes with dead time T. Heckenthaler and S. Engell [3] developed level controller for a nonlinear two-tank system based on fuzzy control. Similarly, application of fuzzy logic for water level control of small- 217
  2. 2. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEMEscale hydro-generating units was reported by T. Niimura and R. Yokoyama [4]. The recent workby W. Chatrattanawuth et al [5] reported a level control system using a fuzzy I-PD controller.Their simulation results shown that fuzzy I-PD controller performed better over conventionalcontroller. C. Li and J. Lian [6] reported the application of genetic algorithm in PID parameteroptimization for level control system. They simulated the proposed strategy on MATLAB andlater tested using LabVIEW. Another LabVIEW based water level control is also reported by L.Gao and J. Lin [7]. The DCS based water level control of boiler drum is reported by Y. Qiliang etal [8]. A similar work is also reported by H-M Chen et al [9]. They designed a sliding modecontroller for a water tank liquid level control system. Few authors reported various schemes and their implementation on different platformssuch as PC/uP/DSP. Some of the reports were also based on simulation. But an attempt is madehere to implement a fuzzy logic control algorithm on a microcontroller for real time level controlof a water-in-tank system. This approach will reduce the cost and space of the system. We willaddress this issue by employing an advanced ARM7TDMI (PHILIPS LPC2129) processor.2. DESIGN OF FUZZY LOGIC CONTROLLER As the name itself suggests, a fuzzy logic controller incorporates fuzzy logic for decisionmaking or rather to produce control action as required by the plant or process [10]. FLCs areknowledge based controllers consisting of linguistic “IF-THEN” rules that can be constructedusing the knowledge of experts in the given field of interest. A two input and one output fuzzylogic controller is designed as shown in the Fig. 1. The error (e) and change-in-error (ce) are thetwo inputs, and control action (ca) is the corresponding output of the FLC. A triangularmembership function with seven members (linguistic variables) termed as negative large (NL),negative medium (NM), negative small (NS), zero error (ZE), positive small (PS), positivemedium (PM), and positive large (PL) are used to map the crisp input to universe of discourse (-1to +1). The universe of discourse is the range over which the fuzzy variables are defined. Thecontrol rules are constructed to achieve the best performance of the FLC. With seven members,we obtain 49 rules. Mamdani inference engine is used [11]. The e input to the controller is obtained by subtracting measured value/process variable(y) from the reference (r), and the ce is difference between present and previous errors. Theoutput of the controller i.e., change in control action (ca) is applied to the process. The r, which isalso the desired value, is entered by the operator in the beginning. This is a closed loop controlwhere the process variable is continuously monitored to maintain the error to zero. FLC y r + e=r-y ca Process/ Defuzzifier - Plant Fuzzifier Rule Base z-1 + Inference - ce Engine Fig 1: Fuzzy logic control system 218
  3. 3. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME3. ARM7 MICROCONTROLLER BASED LEVEL CONTROL SYSTEM The block diagram of proposed fuzzy logic controller scheme for liquid level controlsystem is illustrated in Fig. 2. A cylindrical tank of 100cmX20cmX20cm dimension isconsidered. Level of the liquid (water) contained in a tank is measured and controlled at thedesired value. The level is measured in terms of pressure developed in the capillary attachedto the tank at the bottom. As the liquid level in tank increases the pressure developed insidethe capillary also increases. Hence, the pressure, directly proportional to the liquid level, issensed and converted into equivalent voltage by the integrated circuit differential pressuretransducer (DPT) placed on the top of the tank. The microcontroller measures the liquid levelthrough this sensor, signal conditioner, and on-chip analog to digital converter (ADC) anddisplays it on LCD in terms of cm. The inlet flow of water from a pump (motor) to the tank iscontrolled by a pneumatic control valve (PCV) which in turn controlled by themicrocontroller through on-chip PWM unit, PWM to voltage converter, V/I converter, andcurrent to pressure converter (IPC). The PWM technique is employed to precisely move thepneumatic valve. ARM7 Microcontroller Desired Controlled Value e Fuzzy PWM Output Signal Process +- Value Logic Unit Conditioner PCV Tank Controller Measured Pump Reservoir Value A/D Input Signal DPT Converter Conditioner Fig 2: Block diagram of microcontroller based FLC for liquid level control system4. HARDWARE DETAILS The actual hardware used to study the proposed control system is discussed here. Thehardware consists of process-tank, reservoir tank, pump, level sensor, pneumatic actuator,compressor, input and output signal conditioning circuits, ARM7 microcontroller, and LCD.The photograph of complete hardware is shown in Fig. 3.4.1 ARM7 Microcontroller The LPC2129 from Philips Semiconductor [12] 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; 16KB on-chip SRAM, 256KB Flash, 4-channel 10-bit ADC, 32-bittimers with PWM units and RTC, 46 GPIO ports, I2C bus interface, and on-chip crystaloscillator. This microcontroller is best suited for designing single-chip instruments. 219
  4. 4. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME Level Sensor Process Tank Regulator IPC PCV Reservoir Pump Fig 3: Photograph of level process4.2 Level Sensor The level sensor SX05DN from SenSym [13] is used. It is basically an integratedcircuit differential pressure transducer (DPT) consists of four strain gauges connected inWheatstone bridge and are pasted on a diaphragm. The bridge is excited with a stable +5VDC. The sensor is provided with two input ports for applying either single ended ordifferential pressure. In this application, one port is closed, and another is connected to thebottom of the tank for single ended measurement. The input change in pressure, exerted onthe diaphragm, is converted into corresponding change in resistance which is furtherconverted to change in voltage.4.3 Excitation Source In order to convert the change in resistance of the sensor to the corresponding changein voltage, a precise and constant excitation voltage of +5V is generated using LM329,LM308, and 2N2222 as shown in Fig. 4. LM329, a precision voltage source, produces 6.9Vwhich is dropped down to +5V and connected to non-inverting terminal of op-amp LM308.An op-amp with npn-transistor 2N2222 at the output provides the enough current to thebridge. With a +5V excitation voltage, the sensor will produce an output of 1.5mV/cm. Anoffset-nullify circuit, using a potentiometer, is connected to bridge output to nullify the offsetand make zero adjust in initial condition.4.4 Instrumentation Amplifier Sensor produces a small differential output voltage of 1.5mV/cm liquid height. So aninstrumentation amplifier, AD620 [14] from Analog Devices, is used to pick, amplify, andconvert it to single ended voltage compatible to be sampled by the on-chip ADC of LPC2129microcontroller. A gain of 10 is set for the instrumentation amplifier to get 15mV/cm whichis more than the resolution of ADC. 220
  5. 5. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME4.5 Analog to Digital Converter The output of instrumentation amplifier is acquired by on-chip ADC and convertedinto 10-bit binary word under program control. The resolution of ADC is 2.5mV at Vref=2.56V and conversion time is 2.44 µSec.4.6 LCD LCD provides better readability, reduced power consumption, and backlight duringlow light vision. A 16x2 line LCD [15] is used to display the measured level. It is interfacedto the microcontroller in nibble-mode with upper 4-bits (D3-D7) on the LCD to transfer thedata with MSB first and LSB next mode. The data lines, D3 to D7, are connected to P0.4 toP0.7, and control lines RS (register select), and E (enable) are connected to P0.2 and P0.10ports of microcontroller respectively as shown in Fig. 4. Fig 4: Circuit schematic of the complete system5. SOFTWARE DETAILS The complete algorithm for data acquisition, measurement, display, and control ofliquid level is developed in embedded C under KEIL’s integrated development environment(µVision 4.0). The flowchart of the complete routine is shown in Fig. 5. All the variables ofcontroller and on-chip peripherals are initialized in the beginning. A serial program is alsodeveloped to transfer the data to PC through UART1 for further analysis of the data. 221
  6. 6. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME Start Call ADC and LCD subroutine to display current level in cm Declare & Initialize LCD, ADC, PWM, & FLC subroutines, local variables & Find the error and substitute it in FLC algorithm Initialize hardware (LCD, on-chip ADC, PWM, and Scale FLC output & load in PWM register to generate control Send valve-open & motor-on commands and display the initial level on LCD Update FLC variables Read set point level and display Store and send the control it on LCD action to PC through UART1 Fig 5: Flowchart of level control system6. RESULTS The real time implementation of FLC for liquid level control is tested for standardstep input of 15 cm. A step input from initial value of 0 cm is applied to the controller. Theperformance of FLC is compared with the conventional PID controller for the same step of15 cm. The plots in Fig. 6 show step input response of FLC and PIDC. It is evident from theplot that FLC performs superior over PIDC in terms of sharp rise time, and quick settlingtime. The comparison of both the controllers is made and the corresponding performanceindices are tabulated in Table 1. 15 12 FL PID 9 Level in Cm 6 3 1 0 50 100 150 200 250 300 Time in Sec Fig 6: Step input response for 15 222
  7. 7. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN 0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME Table 1: Performance comparison of controllers for a step of 15 cm Performance Indices→ tr (Sec) ts (Sec) ess (cm) MP (cm) Controller Type↓ PIDC 65.37 108.4 0.2 0 FLC 59.55 101.91 0 0 7. CONCLUSION In this paper we have successfully designed and implemented a fuzzy logic controller on ARM7 microcontroller for a real-time liquid level control. The real time experimental results show that the proposed control scheme provides better transient as well as steady state response. More remarkably, the error response seems to be excellent in contrast to most available linear PID controller. Besides, the incorporation of ARM7 microcontroller made the system very compact and low cost. REFERENCES [1] M. Wang and F. Crusca, “Design and implementation of a gain scheduling controller for a water level control system,” ISA Transactions, vol.41, no.3, pp.323-331 2002. [2] W. Zhang, X. Xu, and Y. Xi, “A new two-degree-of-freedom level control scheme,” ISA Transactions, vol.41, no.3, pp.333-342, 2002. [3] T. Heckenthaler and S. Engell, “Approximately time-optimal fuzzy control of a two-tank system,” IEEE Control Systems, pp. 24-30, 1994. [4] T. Niimura and R. Yokoyama, “Water level control of small-scale hydro-generating units by fuzzy logic,” IEEE, pp. 2483-2487, 1995. [5] W. Chatrattanawuth et al, “Fuzzy I-PD controller for level control,” SICE-ICASE International Joint Conference 2006, Bexco, Busan, Korea, pp. 5649-5652, 2006. [6] C. Li and J. Lian, “The application of immune genetic algorithm in PID parameter optimization for level control system,” Proc. of the IEEE Int. Conf. On Automation and Logistics, Jinan, China, pp. 782-786, 2007. [7] L. Gao and J. Lin, “LabVIEW and internet based remote water level control laboratory,” IEEE, pp. 187-188, 2007. [8] Y. Qiliang et al, “Water level control of boiler drum using one IEC61131-3 based DCS,” Proc. of the 26th Chinese Control Conference, Zhangjiajie, Hunan, China, pp-252-255, 2007. [9] H-M Chen et al, “Design of a sliding mode controller for a water tank liquid level control system,” IEEE, pp. 234-240, 2007.[10] John Yen, Reza Langari, “Fuzzy Logic: Intelligence, Control and Information”, Prentice Hall, Englewood Cliffs, NJ, 1999.[11] R. M. Manjunath and S. Janaki Raman, “Fuzzy adaptive PID for flow control system based on OPC,” IJCA Special Issue on “Computational Science –New Dimensions & Perspectives” NCCSE, 2011, pp. 5-8.[12] Philips LPC2129 user manual, 2004 at http://www.semiconductors.philips.com[13] SenSym SX05DN -ICPT Datasheet at http://www.sensortechnics.com 223
  8. 8. International Journal of Electronics and Communication Engineering & Technology (IJECET), ISSN 0976 – 6464(Print), ISSN 0976 – 6472(Online) Volume 4, Issue 2, March – April (2013), © IAEME[14] Analog Devices AD620 Datasheet at http://www.analog.com[15] Oriole LCD Module User Guide[16] Jadhav Sumedh Damodhar and Phatale Aruna Prashant, “Microcontroller Based Photovoltaic Battery Charging System With Buck Converter” International Journal of Electrical Engineering & Technology (IJEET), Volume 3, Issue 1, 2012, pp. 123 - 130, ISSN Print: 0976-6545, ISSN Online: 0976 – 0976-6553.[17] VenkataRamesh.Edara, B.Amarendra Reddy, Srikanth Monangi and M.Vimala, “Analytical Structures for Fuzzy PID Controllers and Applications”, International Journal of Electrical Engineering & Technology (IJEET), Volume 1, Issue 1, 2010, pp. 1 - 17, ISSN Print: 0976-6545, ISSN Online: 0976 – 0976-6553.[18] T.Balamurugan, Dr.S.Manoharan , P.Sheeba and M.Savithri, “Design a Photovolatic Array with Boost Converter Using Fuzzy Logic Controller”, International Journal of Electrical Engineering & Technology (IJEET), Volume 3, Issue 2, 2012, pp. 444 - 456, ISSN Print: 0976-6545, ISSN Online: 0976 – 0976-6553. 224

×