Sie sind auf Seite 1von 8

INTERNATIONAL JOURNAL OF ELECTRONICS AND COMMUNICATION ENGINEERING & TECHNOLOGY (IJECET)

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

ISSN 0976 6464(Print) ISSN 0976 6472(Online) Volume 4, Issue 2, March April, 2013, pp. 217-224 IAEME: www.iaeme.com/ijecet.asp Journal Impact Factor (2013): 5.8896 (Calculated by GISI) www.jifactor.com

IJECET
IAEME

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 small217

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

scale hydro-generating units was reported by T. Niimura and R. Yokoyama [4]. The recent work by 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 conventional controller. C. Li and J. Lian [6] reported the application of genetic algorithm in PID parameter optimization for level control system. 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 [7]. The DCS based water level control of boiler drum is reported by Y. Qiliang et al [8]. A similar work is also reported by H-M Chen et al [9]. They designed a sliding mode controller for a water tank liquid level control system. Few authors reported various schemes and their implementation on different platforms such as PC/uP/DSP. Some of the reports were also based on simulation. But an attempt is made here to implement a fuzzy logic control algorithm on a microcontroller for real time level control of a water-in-tank system. This approach will reduce the cost and space of the system. We will address 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 decision making or rather to produce control action as required by the plant or process [10]. FLCs are knowledge based controllers consisting of linguistic IF-THEN rules that can be constructed using the knowledge of experts in the given field of interest. A two input and one output fuzzy logic controller is designed as shown in the Fig. 1. The error (e) and change-in-error (ce) are the two inputs, and control action (ca) is the corresponding output of the FLC. A triangular membership function with seven members (linguistic variables) termed as negative large (NL), negative medium (NM), negative small (NS), zero error (ZE), positive small (PS), positive medium (PM), and positive large (PL) are used to map the crisp input to universe of discourse (-1 to +1). The universe of discourse is the range over which the fuzzy variables are defined. The control 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. The output of the controller i.e., change in control action (ca) is applied to the process. The 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 continuously monitored to maintain the error to zero.

z-1 + ce

Rule Base Inference Engine

Fig 1: Fuzzy logic control system

218

Defuzzifier

Fuzzifier

r + -

e=r-y

FLC

ca

Process/ Plant

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

3.

ARM7 MICROCONTROLLER BASED LEVEL CONTROL SYSTEM

The block diagram of proposed fuzzy logic controller scheme for liquid level control system is illustrated in Fig. 2. A cylindrical tank of 100cmX20cmX20cm dimension is considered. Level of the liquid (water) contained in a tank is measured and controlled at the desired value. The level is measured in terms of pressure developed in the capillary attached to the tank at the bottom. As the liquid level in tank increases the pressure developed inside the capillary also increases. Hence, the pressure, directly proportional to the liquid level, is sensed and converted into equivalent voltage by the integrated circuit differential pressure transducer (DPT) placed on the top of the tank. The microcontroller measures the liquid level through this sensor, signal conditioner, and on-chip analog to digital converter (ADC) and displays it on LCD in terms of cm. The inlet flow of water from a pump (motor) to the tank is controlled by a pneumatic control valve (PCV) which in turn controlled by the microcontroller through on-chip PWM unit, PWM to voltage converter, V/I converter, and current to pressure converter (IPC). The PWM technique is employed to precisely move the pneumatic valve.
ARM7 Microcontroller Desired Value Fuzzy +Logic Controller Measured Value e PWM Unit Output Signal Conditioner PCV Pump A/D Converter Input Signal Conditioner Process Tank Controlled Value

Reservoir

DPT

Fig 2: Block diagram of microcontroller based FLC for liquid level control system

4.

HARDWARE DETAILS

The actual hardware used to study the proposed control system is discussed here. The hardware 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 CPU with real-time emulation and 256KB of embedded high speed flash memory available in compact 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 RISC principle. It includes; 16KB on-chip SRAM, 256KB Flash, 4-channel 10-bit ADC, 32-bit timers with PWM units and RTC, 46 GPIO ports, I2C bus interface, and on-chip crystal oscillator. This microcontroller is best suited for designing single-chip instruments.

219

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

Level Sensor Process Tank

Regulator IPC PCV

Reservoir

Pump

Fig 3: Photograph of level process 4.2 Level Sensor The level sensor SX05DN from SenSym [13] is used. It is basically an integrated circuit differential pressure transducer (DPT) consists of four strain gauges connected in Wheatstone bridge and are pasted on a diaphragm. The bridge is excited with a stable +5V DC. The sensor is provided with two input ports for applying either single ended or differential pressure. In this application, one port is closed, and another is connected to the bottom of the tank for single ended measurement. The input change in pressure, exerted on the diaphragm, is converted into corresponding change in resistance which is further converted to change in voltage. 4.3

Excitation Source In order to convert the change in resistance of the sensor to the corresponding change in 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.9V which 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 the bridge. With a +5V excitation voltage, the sensor will produce an output of 1.5mV/cm. An offset-nullify circuit, using a potentiometer, is connected to bridge output to nullify the offset and make zero adjust in initial condition. Instrumentation Amplifier Sensor produces a small differential output voltage of 1.5mV/cm liquid height. So an instrumentation amplifier, AD620 [14] from Analog Devices, is used to pick, amplify, and convert it to single ended voltage compatible to be sampled by the on-chip ADC of LPC2129 microcontroller. A gain of 10 is set for the instrumentation amplifier to get 15mV/cm which is more than the resolution of ADC. 4.4

220

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

Analog to Digital Converter The output of instrumentation amplifier is acquired by on-chip ADC and converted into 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. LCD LCD provides better readability, reduced power consumption, and backlight during low light vision. A 16x2 line LCD [15] is used to display the measured level. It is interfaced to the microcontroller in nibble-mode with upper 4-bits (D3-D7) on the LCD to transfer the data with MSB first and LSB next mode. The data lines, D3 to D7, are connected to P0.4 to P0.7, and control lines RS (register select), and E (enable) are connected to P0.2 and P0.10 ports of microcontroller respectively as shown in Fig. 4. 4.6

4.5

Fig 4: Circuit schematic of the complete system 5. SOFTWARE DETAILS

The complete algorithm for data acquisition, measurement, display, and control of liquid level is developed in embedded C under KEILs integrated development environment (Vision 4.0). The flowchart of the complete routine is shown in Fig. 5. All the variables of controller and on-chip peripherals are initialized in the beginning. A serial program is also developed to transfer the data to PC through UART1 for further analysis of the data.

221

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

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 it on LCD

Store and send the control action to PC through UART1

Fig 5: Flowchart of level control system 6. RESULTS

The real time implementation of FLC for liquid level control is tested for standard step input of 15 cm. A step input from initial value of 0 cm is applied to the controller. The performance of FLC is compared with the conventional PID controller for the same step of 15 cm. The plots in Fig. 6 show step input response of FLC and PIDC. It is evident from the plot that FLC performs superior over PIDC in terms of sharp rise time, and quick settling time. The comparison of both the controllers is made and the corresponding performance indices are tabulated in Table 1.

15

12

FL PID

Level in Cm

1 0 50 100 150 Time in Sec 200 250 300

Fig 6: Step input response for 15

222

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 Controller Type PIDC FLC tr (Sec) 65.37 59.55 ts (Sec) 108.4 101.91 ess (cm) 0.2 0 MP (cm) 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

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

Das könnte Ihnen auch gefallen