J. Comp. & Math. Sci. Vol.4 (5), 382-401 (2013)
8051 Microcontroller Based Multiple Water Tank Control System S. B. JAGADAL and S. V. HALSE Kernataka State Women University Bijapur, Karnataka, INDIA. (Received on: October 24, 2013) ABSTRACT Nowadays, the use of multiple overhead water tanks installed in houses or offices are evident. And to monitor these tanks is difficult as they are kept at remote places for example terrace or at different places of an industry or building. In this paper we proposed a control system which can be used to monitor many tanks by controlling the operation of motors which pumps water from sump to the overhead tanks using a single 8051 MCU interfaced with LCD display in a virtual environment. Here we introduced a multi-tank control system with four tanks to be monitored. An assembly language program was developed to control these four motors in both modes automatic as well as manual. We have used logic control design to select the particular tank to fill the water to desire level. There is also a high level alarm which is used to prevent the overflow of the water. There is an automatic fill option which fills all the tanks one by one in a sequential manner automatically. This control system also allows user to fill the desire tank using select and run button of the respective motor in a random sequence. When the system is active and running, it can indicate the water level through bar graph LED when connected to sensor point. An LCD display of size 40X2 is interfaced to 8051 MCS to display the status of the tank besides giving necessary instruction to operate this system. We send the program to LCD from 8051MCS.This LCD is 40 characters wide with two lines. This control system schematic is based on basic digital concept to configure the circuit design. Keywords: 8051 Microcontroller, MULTISIM Simulator, multiple water tank control system, LCD module, motor, Digital design. Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
383
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
INTRODUCTION Although much studies have been approved on motor with tank control system, but it is having the limitation of single motor control and a tank design. Many alternative techniques are developed by using the level sensor, microcontroller and solenoid valve to maintain a level at a given set point as explained in1. A comparative study is also made on water level parameters where these parameters are also controlled by using conventional PID controller and then optimized using Fuzzy logic controller2. The proposed system is designed and executed in a virtual environment. In actual implementation of proposed control system can use relay interfacing circuit. As explained in M.A.A. Mashud, et al.3 and Hemant Ingale et al.4. This proposed system can also be controlled and monitored remotely by including additional features of web and cellular based services as explained in5,6,7 where wireless automated controlling network has been successfully implemented for agricultural motor control. Here we achieved the control over four water tanks which suggests upgrading the existing liquid level and flowing control system over a single motor control and water tank monitoring. We can use the same system when four or more additional water tanks are to be monitored and control by slight modification in hardware and software. We can operate the four motors according to our desire sequence by the assembly language programming. This system is easy to implement and require 8051 MCS program development kit to burn program in to the microcontroller with interfacing devices
such as LCD to display operation and relays to run the motors. The National instrumentation (NI) simulation software MUTISIM 11/12 contains Peripherals like the Water Holding Tank with attached water motor that can be controlled via an 8051 microcontroller8,9. The input signals to the 8051 MCU are the push buttons and the empty and set point pins of the tank part. The output signals are connected to the forward, reverse and stop pins of the motor. The user can use the kill button to stop the process and by adjusting the potentiometer he can control the flow rate of liquid. Each water tank with a motor is inbuilt peripheral device in simulator software. We used a single 8051 MCU to control four such peripheral devices. There is an another output signal from sensor, if connected to LED bar graph shows water level in the tank. This sensor output can also be used to turn on the alarm when over flow occurs, or we can use target(set) point signal to turn on SCR which is used as a switch to turn on the alarm. Interfacing relay to 8051 microcontroller Relays are simple switches which are used to control high current/voltage circuits with the help of low current/voltage signals; usually a transistor is used to control the relay. The transistor is driven into saturation (turned ON) when a LOGIC 1 is written on the PORT PIN thus turning ON the relay. The relay is turned OFF by writing LOGIC 0 on the port pin. If we want to connect more relays to microcontroller then we can use ULN 2003 for connecting seven relays or ULN 2803 for connecting eight relays10. In this proposed system, motor operatessimply by the output signal from
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
8051 MCU through a buffer gate instead of a relay.because simulation sofware motor runs on +5V supply. But we have used relay interfacing circuit in case of the sensor out put to turn on the buzzer whenever overflow condition meets in any one of the tanks using OR logical design. Water level sensor techniques and applications: There are so many applications of water level sensor; Common applications include switching motor on and off to avoid overflow, dry running, uninterrupted water supply and indicating water level in a tank. Following are the few techniques to determine the fluid level‌.11,12. 1. Weighing the tank by utilizing strain gauges gives precise level measurement without exposing the tank content to potential electrical spark hazards. 2. Ultrasonic range finding technique is a cost effective level sensing as speed of sound is much slower to speed of light and reflected signal from water surface using ultrasonic transducer can accurately measure distance. 3. By probe electrode and the tank wall or by using a reference electrode in case of insulated tank. A conductive path is established between the sense electrode and the tank wall/reference electrode, when the water/liquid comes in contact with the electrode tip. This current is sensed, amplified and made to operate a relay whose contacts in turn can be used for annunciation/control. 4. The simplest type is a float mechanical switch which gives continuous level information. They come in variety of material suitable for different types of caustic and non-caustic liquids. This
technique is suitable for increasingly resource- and conscious world.
384 today’s energy-
Circuit description Figure 1 shows the circuit of microcontroller based multiple tank control system. We have connected control pins of all the four motors to a single port(P1) of the microcontroller through AND logic gates design to select a single motor to start. There are another two sub circuits as shown in figure 3 and figure 6.The symbolical representation as HB(1) in figure 1 is the replaced hierarchical block shown in sub circuit 1 ( figure 3).This sub circuit consist of seven OR gates which are used to set overflow alarm. One of the input to each first four OR gate is from the each target (set) point of the four peripheral devices i.e. tanks placed on workplace. And these connections are grounded by 50k ohm register each. Another input to these four OR gate is from the common point to kill button. This sub circuit is used to alarm when overflow condition is reached in any tank. Figure 4 shows the connection of tank selection keys 1,2,3,4 and auto fill key A to the Bus 3 in the schematic of figure 1. Figure5 shows the buffer circuits, a buffer gate does not change the logic level of the input; it is used to isolate or amplify the signal. Such four buffer circuits consisting of three buffers gate has been used to connect the forward fill, reverse fill and stop signal of the motor. The buzzer sub circuit as shown in Figure 7 is to alert user whenever overflow occurs in any tank. In this sub circuit SCR gate terminal is triggered by the output of the sub circuit3 which is the ORed outputs of the four relays which are connected to the sensor terminal of each tank.
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
385
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
Schematic of the multi–water tank control system TANK 1
TANK 2
U15
U24
Four motors connected to 8051MCU and push buttons with sub circuit 1:
TANK 3
U13
TANK 4
U16
Total Volume:
50.00
Set Point:
25.00
Current Volume:
28.25
Pump Cntrl Fwd Rev Stop
SP
Empty Target: Sensor:
Flow: 0.00
Total Volume:
50.00
Set Point:
25.00
Current Volume:
25.21
SP
Empty Target: Sensor:
Flow: 0.00
Pump Cntrl Fwd Rev Stop
50.00
Set Point:
25.00
25.16
Current Volume:
27.62
Pump Cntrl Fwd Rev Stop
101% 2.52
SP
Empty Target: Sensor:
Flow: 0.00
101% 2.52
Pump Cntrl Fwd Rev Stop
SP
Empty Target: Sensor:
Flow: 0.00
1
VCC VCC
Buffer
VCC VCC
51
35
K2
K
Buffer
A2
Buffer
A3
K 34
A3 A2
A4
0 EDR201A05
0 EDR201A05
A1
0 EDR201A05
5V
50
K
A1
K
3
VCC VCC K3
45
44
Buffer
2
5V
5V VCC VCC K4
48
110% 2.76
33
X8/IO1 X8/IO3 X8/IO5
X7/IO1 X7/IO3 X7/IO5
46
K5
0 EDR201A05
X8/IO2 X8/IO4 X8/IO6
A4
X1/IO2 X1/IO4 X1/IO6
X7/IO2 X7/IO4 X7/IO6
X4
X3
25
( 25)
2.5 V
2.5 VBus1
26
( 26)
47
X23
Total Volume:
25.00
49
5V
X6/IO2X6/IO4X6/IO6
50.00
Set Point:
113% 2.82
43 X6/IO1 X6/IO3 X6/IO5
Total Volume:
Current Volume:
27
29
( 27)
( 29)
Bus1
30
( 28)
( 30)
VCC
Bus1
VCC
5V
32 ( 32)
RPACK 7
X26
X25
36
2.5 V
31
( 31)
Bus1
28
2.5 V
38
X24
2.5 V
39
2.5 V
40
X13 R1 1kOhm 2.5 V
U14
37
41 42
1 2 3 4 5 6 7 HB1/IO5 8 9 ( H B1/IO5) 62 10 ( 62) 63 11 ( 63) 21 12 ( 21) 22 13 ( 22) 4 14 ( 4) 5 15 23 16 ( 5) 17 ( 23) 24 18 BusOffPage1 ( 24) 19 20
Bus3
Bus4
GND
P1B0T2 P1B1T2EX P1B2 P1B3 P1B4 P1B5MOSI P1B6MISO P1B7SCK RST P3B0RXD P3B1TXD P3B2INT0 P3B3INT1 P3B4T0 P3B5T1 P3B6WR P3B7RD XTAL2 XTAL1 GND
VCC P0B0AD0 P0B1AD1 P0B2AD2 P0B3AD3 P0B4AD4 P0B5AD5 P0B6AD6 P0B7AD7 EAVPP ALEPROG PSEN P2B7A15 P2B6A14 P2B5A13 P2B4A12 P2B3A11 P2B2A10 P2B1A9 P2B0A8
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
HB1/IO5
20 18 17 16 15 14
13 ( 13) 12 ( 12) 11 ( 11) 10 ( 10) 9 ( 9) 8 ( 8) 7 ( 7) 6 ( 6)
( HB1/IO5) 19 ( 20) ( 19) ( 18) ( 17) ( 16) ( 15) ( 14)
BUS2
BusOffPage2
Bus6
8051 GND
( H B1/IO5)
X2
OVFLW HB1
A2 A3 A4
A1 A2 A3 A4
IO1 IO2 IO3 IO4 IO6
( 20) 20
Bus3
LD
HB1/IO6 VCC
GND
( 19) 19
BUS2
T o B u z z e r c ir c u it
VCC 0
Key = K Kill Key = P Power
HB1/IO5
IO5
R3 50Ω
2.5 V
( H B1/IO5)
A1
5V
Key = F FILLUP
( 16) 16
Key = D DRAIN
R8 100Ω
( 15) 15
Key = Space STOP ( 14) 14
Key = N NEXT
GND
Figure 1
Figure 2 shows the LCD Display connected to 8051 MCS via BUS 4.There are 8 data pins D0-D7 connected to port 2 pins, which are used to send information to the LCD or read the content of the LCD’s
internal registers. While three pins of port 3 are used to connect the E, R/W and RS control pins of LCD. To display letters and numbers, we send ASCII codes for the letters A-Z, a-z, and number, to these pins
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
386
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
while making register select pin RS=1.there are also instruction command codes that can be send to the LCD to clear the display or force the cursor to the home position or blink the cursor. R/W read /write input pin allows the user to write information from it. E, enable pin latches the information to its data pins, while Vcc and ground provide +5V. VEE is used for controlling LCD
contrast. Many subroutines are called from the main program to display information on LCD screen. Assembly language programming allows us to make each subroutine into a separate module. These modules can be tested separately. In a large program the modules can be assigned to different programming in order to shorten development time.
LCD Display:
VCC
5 2324
Ln1( 5) Ln2( 23) Ln3( 24)
VCC 0
D7 D6 D5 D4 D3 D2 D1 D0
E RS RW
VCC CV GND
U34
131211109 8 7 6
BusOffPage1 Ln8( 13) Ln7( 12) Ln6( 11) Ln5( 10) Ln4( 9) Ln3( 8) Ln2( 7) Ln1( 6)
Bus4
Bus6
BusOffPage2
Figure 2
Sub circuit 1(HB1) IO4
IO4
U49A
29 U45B 74LS32N
IO3
IO2
IO3
IO2
U48A
5374LS32N
57 U45C
74LS32N U47A
IO5 54
IO5
5674LS32N
U49B 74LS32N
IO1
IO1
U46A
74LS32N
5574LS32N
IO6 Figure 3
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
IO6
387
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
Keys connection: Buffer circuit: 48 ( 48)
Key = 1 NEXT
49( 49)
Key = 2 NEXT
Key = 3 NEXT
GND
VCC
Bus3
50( 50)
51( 51)
Key = 4 5V NEXT
VCC
52
( 52)
Key = A Auto Fill
R6
Figure 5
GND 700â„Ś
Figure 4
Sub circuit 2 X27 X28 2.5 V 2.5 V 36
U45A X30
( 36) 38
44
( 38)
74LS32N U46B
40
X21
( 40)
U47B
2.5 V
4
X31 45
( 4)
42
( 42)
Bus1 37
( 37)
BUS2
74LS32N
74LS32N 2.5 V U48B
2.5 V
U50D 7
( 7)
46X32
39
( 39) 41
74LS32N
74LS32N U49C
( 41)
2.5 V 47
43
( 43)
74LS32N
Figure 6 Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
388
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
Sub circuit 3:
BUZZER (ALARM) SCR
1 X1
D3
VCC
2N1599 X2
3
5V
2.5S1A V
V1
VCC
Key = A
2.5 V LS1 SONALERT 200 Hz
2
60 Vrms 60 Hz 0째
0
Figure 7
Various keys and their functions: Table 1 Key
A
F
D
K
1
2
3
4
N
Function
AUTO FILL
FORDWARD FILL
DRAIN/ REVERSE FILL
STOP/ KILL
Selects Tank 1
Selects Tank 2
Selects Tank 3
Selects Tank 4
Next
Space bar Pause/ stop
OPERATING INFORMATION
This system operates in two modes
The simulation software allows us to navigate 8051 and the peripheral device water tank and 40X2 size LCD to place on the workplace. The bus connection to the 8051 MCU and all four water tanks is made as shown in the circuit diagram. We used logic design to select a particular motor via a single port of microcontroller. The simulator software is interfaced with computer key board as well. We can use computer keyboard as the push buttons in the circuit simulation
[1] First is the auto fill mode in which we can fill all the tanks one by one automatically, if the tank is already full then it jumps to next tank which is empty. We can stop the process by pressing the kill button in forward fill as well as reverse fill operation of the motor. If any tank is drained to a particular level then microcontroller checks this status, if it finds that target level of water is not reached it runs the motor in forward direction to fill tank, as
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
389
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
long as auto fill button is closed this operation is repeated.. When all the tanks are full, draining of a particular tank can be done by selecting the tank number and pressing the D button. The auto fill key A also works as next button in the second mode i.e. manual mode. [2] The second mode is a normal mode of operation; we can select a particular tank to fill it by pressing tank selection keys 1/2/3/4 followed by F (run) push button. When the process of forward fill or reverse fill is going on we can stop it by pressing k (kill) buttons at any time during the process similarly as in auto mode. There is one more button called stop button who’s control is given to the space bar key of the keyboard, which when pressed stops (pauses) the ongoing
process of filling or draining temporally and again by pressing D or F button the respective process can be continued for same tank. Instead of this we can also use stop button (spacebar) to stop the process and then by pressing next N button to fill next tank. Various keys and their functions are displayed in table 1 above. LCD module displays the two state of the tanks i.e. full or empty, besides it displays the ongoing operation of the system (for example: tank 1 is filling) and necessary instruction to the user to press particular key. Software design given below figure out one example of display subroutine at the end of the main program, in the similar manner we can write all subroutines where ever exits in the main program.
SOFTWARE DESIGN $MOD51
; this includes 8051 definitions for the Meta-link assembler
; Please insert your code here. ; Program Start $TITLE (MULTI PUMP CONTROL SYSTEM) ; Program Start Reset: NOP ; move stack pointer past register banks MOV SP, #20H ; P0B4 - empty ; P0B3 - target ; P0B0 - kill button ; P0B1 - power button ; P0B2 - run button ; P1B2 - forward fill Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
390
; P1B1 - reverse fill ; P1B0 - stop fill Begin: ACALL LCDATA ; initialize LCD ACALL display1; display subroutine MOV P1,#000H ;--------------------------------------------------------------------------------------------------------------; Wait for power button to be pressed Start loop: MOV P1, #000H JB P0.1, ready1 ; power button was pressed JMPstart loop Ready1: LCALL display2 ; display subroutine JMP ready Start: Ready: ;--------------------------------------------------------------------------------------------------------------;SET ALL MOTORS IN STOP MODE NEXT: MOV P1,#0F9H ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> SELMOTOR: JB P3.4, AUTODISP JB P3.0, M1 JB P3.1, M2 JB P3.2, M3 JBP3.3, M4 JMP SELMOTOR M1:ACALLMOTOR1 M2: ACALL MOTOR2 M3: ACALLMOTOR3 M4: ACALL MOTOR4 AUTODISP:ACALLDisplay3 JMP AUTO AUTO:
; display subroutine
ACALL AUTOFILLUP1 ; Tank1empty or below set point fill up now MOTOR1: Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
391
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
;**********MOTOR 1 CONTROL *************************************** ; Wait for run button to be pressed to start filling tank readyloop1: JB P0.0, start ; kill button pressed JB P0.2, FILLUP1 JB P0.5,DRAIN1 JB P0.7, NEXT JMP readyloop1 ;__________________________________________________________________________ FILLUP1: AUTOFILLUP1: ACALL Display4 ; display subroutine MOV P1, #009H; set stop signal to high ; Fill in forward direction fillfwd1: MOV P1, #00CH ; set fwd. signal to high CALLoutput delay ; hold fwd. signal high CALLoutput delay MOV P1, #000H ; set fwd. signal back to low ;__________________________________________________________________________ ; Wait for set point to be reached fillfwdloop1: JB P0.0, fillfwdkill1; kill button pressed MOV P1, #00CH JB P0.3, fillfwdend1 ; set point reached JB P0.6, STOP JMP fillfwdloop1 ; Stop filling in fwd. direction and start timer for 5 seconds fillfwdend1: MOV P1, #009H ; set stop signal to high JB P3.4, AUTO2 ; auto button if on go to Auto2 CALLtimer delay ; go to timer routine ACALL Display5 ; display subroutine JMPready ; timer has finished, start draining ; Kill button was pressed during filling in forward direction fillfwdkill1: MOVP1, #009H ; set stop signal to high CALLoutput delay ; hold top signal high CALLoutput delay JMP start ; go back to beginning of program Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
392
;************************************************************************** ; DRAINING Liquid from Tank --TANK MUST BE NOT BE EMPTY ;************************************************************************** DRAIN1: ACALL Display6 ; display subroutine MOV P1, #00AH ; set reverse signal to high CALLoutput delay ; hold reverse signal CALLoutput delay MOV P1, #000H ; set reverse signal to low ;Wait for tank to reach the empty point ______________________________________________________________________ fillrevloop1: JB P0.0, fillrevkill1; kill button pressed MOVP1, #00AH JB P0.4, fillrevend1 ; empty point reached JB P0.6, STOP JMP fillrevloop1 ; Finished draining, go back to ready state ;__________________________________________________________________________ fillrevend1: MOV P1, #009H ; set stop signal to high ACALLDisplay7 ; display subroutine JMP ready ; Kill button was pressed during filling in reverse direction fillrevkill1: MOV P1, #009H ; send stop signal CALLoutput delay CALLoutput delay JMP start STOP:MOV P1, #009H JB P0.2, FILLUP1 JB P0.5, DRAIN1 JB P0.7, N9 JMP STOP N9:ACALL NEXT ;**********MOTOR 2 CONTROL *************************************** MOTOR2: ; Wait for run button to be pressed to start filling tank readyloop2: JNB P0.0, STR ACALL start ; kill button pressed Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
393
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
STR:JB P0.2,FILLUP2 JB P0.5,DRAIN2 ; run button pressed JB P0.7,N2 JMP readyloop2 N2:ACALL NEXT ; ----------------------------Start running------------------------------------------------------------------AUTO2: FILLUP2: ACALLDisplay8 ; display subroutine MOV P1,#011H ; Fill in forward direction fillfwd2: MOV P1,#014H ; set fwd. signal to high CALLoutput delay ; hold fwd. signal high CALLoutput delay MOV P1,#000H ; set fwd. signal back to low ;_________________________________________________________________________ ; Wait for set point to be reached fillfwdloop2: JB P0.0,fillfwdkill2; kill button pressed MOV P1,#014H JB P0.3,fillfwdend2 ; set point reached JB P0.6, STOP2 JMP fillfwdloop2 ;__________________________________________________________________________ ; Stop filling in fwd. direction and start timer for 5 seconds fillfwdend2: MOV P1,#011H; set stop signal to high JB P3.4,AUTO3 CALL timer delay ; go to timer routine ACALLDisplay9 ; display subroutine JMP ready ; timer has finished, start draining ;__________________________________________________________________________ ; Kill button was pressed during filling in fwd. direction fillfwdkill2: MOV P1, #011H CALLoutput delay CALLoutput delay JMP start
; set stop signal to high ; hold top signal high ; go back to beginning of program
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
394
;************************************************************************** ; DRAINING Liquid from Tank --TANK MUST BE NOT BE EMPTY ;************************************************************************** DRAIN2: ACALL DRAIN11 ACALL KEY2 MOV P1, #012H ; set reverse signal to high CALLoutput delay ; hold reverse signal CALLoutput delay MOV P1, #000H ; set reverse signal to low ; Wait for tank to reach the empty point ;__________________________________________________________________________ fillrevloop2: JB P0.0, fillrevkill2 ; kill button pressed MOV P1,#012H ; set reverse signal to high JB P0.4,fillrevend2 ; empty point reached JB P0.6, STOP2 JMP fillrevloop2 ; Finished draining, go back to ready state fillrevend2: MOV P1,#011H ; set stop signal to high ACALL Display10 ; display subroutine JMP ready ;__________________________________________________________________________ ; Kill button was pressed during filling in reverse direction fillrevkill2: MOV P1, #011H ; send stop signal CALL output delay CALL output delay JMP start STOP2:MOV P1, #011H JB P0.2, FILLUP2 JB P0.5,DRAIN2 JB P0.7, N5 JMP STOP2 N5:ACALL NEXT ########################################################################## MOTOR3: ; ################## MOTOR 3 CONTROL #################################### ; Wait for run button to be pressed to start filling tank readyloop3: Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
395
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
JB P0.2, FILLUP3; run button pressed JB P0.5, DRAIN3 JNB P0.0, No KILL JB P0.7, N3 ACALL start ; kill button pressed No KILL:LJMP readyloop3 N3:ACALL NEXT ; __________start running___________________________________________________ AUTO3: FILLUP3: ACALL Display11 ; display subroutine MOV P1, #021H ; Fill in forward direction fillfwd3: MOV P1, #024H ; set fwd. signal to high CALLoutput delay ; hold fwd. signal high CALLoutput delay MOV P1, #000H ; set fwd. signal back to low ; Wait for set point to be reached fillfwdloop3: JB P0.0, fillfwdkill3; kill button pressed MOV P1, #024H ; set fwd. signal to high JB P0.3, fillfwdend3 ; set point reached JB P0.6, STOP3 JMP fillfwdloop3 ; Stop filling in fwd. direction and start timer for 5 seconds ;__________________________________________________________________________ fillfwdend3: MOV P1, #021H ; set stop signal to high JB P0.6, STOP3; stop button pressed JB P3.4, AUTO4 CALL timer delay ; go to timer routine ACALL Display12 ; display subroutine JMP ready ; timer has finished, ; Kill button was pressed during filling in fwd. direction fillfwdkill3: MOV P1, #021H CALLoutput delay CALLoutput delay JMP start
; set stop signal to high ; hold top signal high ; go back to beginning of program
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
396
;************************************************************************** ; DRAINING Liquid from Tank --TANK MUST BE NOT EMPTY ;************************************************************************** DRAIN3: ACALL Display13 ; display subroutine MOV P1, #022H ; set reverse signal to high CALLoutput delay ; hold reverse signal CALL output delay MOV P1, #000H ; set reverse signal to low ; Wait for tank to reach the empty point fillrevloop3: JB P0.0, fillrevkill3; kill button pressed MOV P1, #022H JB P0.4, fillrevend3 ; empty point reached JB P0.6, STOP3 JMP fillrevloop3 ; Finished draining, go back to ready state fillrevend3: MOV P1, #021H ; set stop signal to high ACALL Display14 ; display subroutine JMP ready ; Kill button was pressed during filling in reverse direction fillrevkill3: MOV P1, #021H ; send stop signal CALLoutput delay CALLoutput delay JMP start STOP3:MOV P1, #021H JB P0.2, FILLUP3 JB P0.5, DRAIN3 JB P0.7, N8 JMP STOP3 N8:ACALL NEXT ;########################################################################## MOTOR4: ; #################### MOTOR 4 CONTROL ################################## ; Wait for run button to be pressed to start filling tank readyloop4: JB P0.2,FILLUP4 JB P0.5,DRAIN4; run button pressed JNB P0.0,NoKIL ; kill button pressed Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
397
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
JB P0.7,N4 ACALL start NoKIL:JMP readyloop4 N4: ACALL NEXT AUTO4: ;________________________ start running_______________________________________ FILLUP4: ACALL LINE10 MOV P1,#041H JB P0.3, DRAIN4 ; Fill in forward direction fillfwd4: MOV P1, #044H ; set fwd. signal to high CALL output delay ; hold fwd. signal high CALLoutput delay MOV P1, #000H ; set fwd. signal back to low ; Wait for set point to be reached fillfwdloop4: JB P0.0, fillfwdkill4; kill button pressed MOV P1,#044H ; set fwd. signal to high JB P0.3, fillfwdend4 ; set point reached JB P0.6, STOP4;Press Stop Key, Topause operation JMP fillfwdloop4 ; Stop filling in fwd. direction and start timer for 5 seconds fillfwdend4: MOV P1,#041H ; set stop signal to high CALLtimer delay ; go to timer routine ACALL FLFDED4 ; display subroutine JMP BELOW; timer has finished, BELOW: ACALLDisplay15 ; display subroutine JMP NEXT ; Kill button was pressed during filling in fwd. direction fillfwdkill4: MOV P1,#041H ; set stop signal to high CALLoutput delay ; hold top signal high CALL output delay JNB P1.7,OVRFLW4 ; CHEK IF OVER FLOW JMP DRAIN4;OCCURS DRAIN THE TANK OVRFLW4:JMP start ; go back to beginning of program Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
398
;************************************************************************** ; DRAINING Liquid from Tank --TANK MUST BE NOT EMPTY ;************************************************************************** DRAIN4: ACALL Display16 ; display subroutine MOV P1,#042H ; set reverse signal to high CALLoutput delay ; hold reverse signal CALLoutput delay MOV P1, #000H ; set reverse signal to low ; Wait for tank to reach the empty point fillrevloop4: JB P0.0,fillrevkill4 ;kill button pressed MOV P1,#044H JB P1.7,ADJ ; OVER FLOW ADJESTMENT JB P0.4,fillrevend4 ; empty point reached JB P0.6, STOP4 JMP fillrevloop4 ; Finished draining, go back to ready state fillrevend4: MOV P1,#041H ; set stop signal to high ACALL Diplay17 ; display subroutine JMP ready ; Kill button was pressed during filling in reverse direction fillrevkill4: MOV P1, #041H ; send stop signal CALL output delay CALLoutput delay LJMP start STOP4:MOV P1, #041H JB P0.2,FILLUP4 JB P0.5,DRAIN4 JB P0.7,N7 JMP STOP4 N7: ACALL NEXT ADJ: JNB P0.3,DR;NO SETPOINT REACHED JMP DRAIN4 DR:JMP STOP4 ;-------------------------------------------------------------------------------------------------------------; Timer Timer start: Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
399
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
MOV P1, #041H ; set stop signal to high CALLoutput delay ; hold stop signal CALLoutput delay MOV P1,#000H ; set stop signal to low MOV R2,#39H ; call output delay 39H times to get 5 second delay ; Wait for timer to finish Timer loop: JB P0.0, timerdelaykill; kill button pressed, stop timer CALLoutput delay DJNZ R2, timerloop JMPtimerdelayend Timer delay: JMP timer start ; Kill button was pressed during timer routine, wait for power button timerdelaykill: JB P0.1, timerdelayready ; power button pressed JMPtimerdelaykill ; Power button was pressed, wait for run button to resume timer timerdelayready: JB P0.2, timerdelay ; run button pressed JB P0.0, timerdelaykill ; kill button pressed JMPtimerdelayready ; Timer routine finished, return from call timerdelayend: RET ; Timer delays outputdelay: PUSH ACC MOV A, R5 PUSH ACC MOV A, R6 PUSH ACC MOV R5, #50 ; number of inner delays to call CLR A outerdelay: MOV R6, A CALLinner delay DJNZ R5,outerdelay POP ACC MOV R6, A POP ACC Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
400
MOV R5, A POP ACC outputdelayend: RET innerdelay: NOP NOP NOP NOP NOP DJNZ R6,innerdelay RET ; ---------------------initialize LCD-----------------------------------------------------------------------LCDATA: MOV A, #38H ACALL COMNWRT MOV A, #0EH ACALL COMNWRT MOV A, #01H ACALL COMNWRT MOV A, #06H ACALL COMNWRT RET ; -----------------------------Send command to LCD----------------------------------------------------COMNWRT: MOV P2,A CLR P3.6 CLR P3.7 SETB P3.5 CLR P3.5 RET ; -----------------------Send data to LCD-----------------------------------------------------------------DATAWRT: MOV P2,A SETB P3.6 CLR P3.7 SETB P3.5 CLR P3.5 RET Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
401
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
;--------------------------------------------------------------------------------------------------------------EXAMPLE OF A SUBROUTINE TO DISPLAY WORD “PUMP” ---------------------------------------------------------------------------------------------------------------PUMP: MOV A, #'T' ACALL DATAWRT MOV A, #'A' ACALL DATAWRT MOV A, #'N' ACALL DATAWRT MOV A, #'K' ACALL DATAWRT MOV A, #'S' ACALL DATAWRT RET ______________________________________________________________________END RESULT AND CONCLUSION Water tank control system can be utilized in many areas such as water dam, water treatment system, industry tank control and boilers. The proposed control system is effective and useful when a number of overhead tank are to be monitored. It suggests upgrading the existing liquid level and flowing control system over a single motor control. We have successfully controlled four motors operation and monitored the respective four water tanks in a virtual environment using MULTISIM simulation software. We have used logic design to select the desire tank to operate. The status of each tank is displayed on LCD screen. The exiting features of level control and tank monitoring is included to the proposed system. Multi-tank control system is flexible and cost effective with highly variable operating requirements. It saves overhead costs of electricity bill, time, manpower and wastage of water. The circuit design is simple and compact which can be
converted into an embedded system by implementing it in actual hardware’s to monitor and control multiple tanks with multiple motors using a single 8051 MCU. REFERENCES 1. Kavita Jindala, Kavita Singh, “Hardware and Software based Water level controller system using Microcontroller”, International Journal of Science Technology & Management, IJSTM Vol. 2, Issue 2 (2011). 2. D. M Souran, S. H. Abbasi and F. Shabaninia V. E Balas et al. (Edn), “Comparative study between tank’s water level control using PID and Fuzzy logic control.” Soft Computing Applications. AISC, 195, pp.41-153 springer-Verilog Berlin Heidelberg. (2013). 3. M.A.A. Mashud1, M.A.A. Tariq1, M. Shamim Hossain 2 and Md. Serajul Islam 3. “Design and development of a low-cost microcontroller based single
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)
S.B. Jagadal, et al., J. Comp. & Math. Sci. Vol.4 (5), 382-402 (2013)
phase water-pump Controller”, International Journal of Information Sciences and Techniques (IJIST) Vol.2, No.4, (2012). 4. Hemant Ingale and N.N. Kasat. “Automated Solar Based Agriculture Pumping.” International Journal of Advanced Research in Computer Science and Software Engineering, Volume 2, Issue 11, pp. 407-410 (20120). 5. S.M. Khaled Reza, Shah Ahsanuzzaman Md. Tariq, S.M. Mohsin Reza. “Microcontroller Based Automated Water Level Sensing and Controlling: Design and Implementation Issue:” WCECS, San Francisco, USA, Proceedings of the World Congress on Engineering and Computer Science. (2010). 6. Brito, N,;Guimaraes, Portugal; Ribeiro, P. , Soares, F., Monteiro, C,. “A remote system for water tank level monitoring
7.
8. 9.
10.
11. 12.
402
and control - A collaborative case-studyLearning in Industrial Electronics, ICELIE '09. 3rd IEEE International Conference on (2009). http://www.techrepublic.com/resourcelibrary/whitepapers/tank-water-levelmonitoring-system-using-gsm-network/ www.ni .com - multisim guide pdf Muhammad Ali Mazidi Janice Gillispie Mazidi, “The 8051 microcontroller and embedded systems” Prentice Hall of India, New Delhi. www.efymag.com-water-level controller cum-motor protector; numeric water level indicater http://en.wikipedia.org/wiki/Level_senor Rajesh Kumar Garg and Vikram, Design Plan of Modular Controller Discharge System using Simulation Singh, International Journal of Computer Applications, Volume 9– No.1, 0975 – 8887 (2010).
Journal of Computer and Mathematical Sciences Vol. 4, Issue 5, 31 October, 2013 Pages (322-402)