Upload
deepa-bhatia
View
674
Download
1
Embed Size (px)
Citation preview
INTRODUCTION
We proposed a project WATER LEVEL DETECTOR WITH TURBIDITY SENSOR.
This project came to our mind when we saw that water is being wasted when it is over flown
and in order to save water we thought to make a detector which could sense the level of water
and indicate that whether tank is empty or full. The determination of liquid level applications
has been developed for many years especially for process industries. There are many ways or
methods to determine the level of a liquid. Whatever method we chosen, much depend on the
nature of the liquid itself and sometimes the environment also might limit our choice of the
methods available. For example, to determine the level of molten iron in a blast furnace it is
not a straightforward and many delicate sensing devices cannot operate in this corrosive and
extremely high temperature.
Therefore before choosing any sensing method, we have to investigate what are the methods
available and should be operable in very hazardous environment and extremely high
temperature. After consideration of the specification and the conditions where the method will
be applied, it was decided to design a liquid level sensing device using simple 555 Timer
circuit and with the help of 8051 microcontroller we have embedded the circuit in printed
circuit board by etching drilling & soldering process.
Moreover, to determine the dirty water which enters into the tank along with fresh water can
also be detected by using turbidity sensor. Turbidity is the cloudiness or haziness of a fluid
caused by large numbers of individual particles that are generally invisible to the naked eye,
similar to smoke in the air. The measurement of turbidity is a key test of water quality.
Turbidity sensors measure suspended solids in water, typically by measuring the amount of
light transmitted through the water. They are used in river and stream gaging, waste water and
effluent measurements control instrumentation for settling ponds, sediment transport and
laboratory measurements. Turbidity analysis is the study of the optical properties that causes
light through water to be scattered and absorbed rather than transmitted in straight lines. A
turbid meter or sometimes called as turbiditimeter (turbidity meter) is a common name for an
instrument that measures turbidity. Measuring low level turbidity requires an accurate
measurement of the scattered light in water. With advances in the development of photo
detector sensors, later turbidimeter designs are able to detect very small changes (attenuation)
of transmitted light intensity through a fixed volume sample.
1
[1] VINN EXCELLENCE CENTER, ICT School of KTH, Stockholm published a report on
10-08-2012 was based on water quality monitoring system based on wsn. Water Quality
Monitoring has a big influence on the aquaculture management, waste water treatment,
drinking water and some other applications. There is a trend to build a wireless sensor
network system for water quality monitoring. This system detects pH, conductivity, dissolved
oxygen, turbidity, temperature, ORP (Oxidation-Reduction Potential), BOD (Biochemical
Oxygen Demand), Flow and etc. Some important electrochemical parameters of water quality
should also be detected, like Ca2+, Mg2+, Cl2, Cl-, NO3-, NH3+, CO2/CO32-, F-, BF4-, K+,
Na+.In this paper it has research an integrated system model for water quality monitoring
system which is based on chlorine analyzer, turbidity meter, pH meter, conductivity meter,
dissolved oxygen meter and so on. Moreover describe about the water quality monitoring
program according to different physical environment.
[2] Department of electrical engineering NATIONAL INSTITUTE OF TECHNOLOGY,
Rourkela proposed a thesis about low cost automatic water level control for domestic
applications.
Automatic Water Level Controller can provide a solution to preserve water. In many houses
there is unnecessary wastage of water due to overflow in Overhead Tanks. The operation of
water level controller works upon the fact that water conducts electricity. So water can be
used to open or close a circuit. As the water level rises or falls, different circuits in the
controller send different signals. These signals are used to switch ON or switch OFF the
motor pump as per our requirements. The objective of this thesis deals with the following:
To create the most cost-effective and reliable water level controller using as less
resources as possible.
To study the controller model and observe its characteristics.
To compare the controller with the conventional controllers available in market and
find the advantages of the former over the latter.
[3] INTERNATIONAL JOURNAL OF RECENT DEVELOPMENT IN ENGINEERING
AND TECHNOLOGY, proposed a project on 2nd august 2014 about GSM Based Water level
and Temperature Monitoring System by Usama Abdullah and Ayesha Ali.This system
describe how to monitor a control industrial system. It can monitor the industrial system from
2
any location, due to this it will save lots of time in this busy era. In this project, they have
designed GSM based water level and temperature monitoringsystem (WLTMS). We detect
the water level of the tank which is connected to the industry. It also monitor the temperature
of the tank. For this purpose, they have used LM35 sensor which defines the parameters of the
temperature sensor. Analogue output of LM35 is amplified through a process of signal
conditioning, where OP-741 is used to amplify the signal. Amplified signal is fed into an
ADC for the sake of digital data. This digital data is transferred to an LCD for displaying
result. PIC microcontroller is used for this procedure. Modem is also connected to this
controller for the wireless communication of the data through GSM technology by receiving
an alert through SMS.
[4] A thesis submitted by in partial fulfilment of the degree of Master of Science on 2003.The
project designed to be implemented to measure the level of molten iron liquid inside a tank.
The design is based on a torque-controlled drive where the level of the liquid in the tank is
measured using a suspended float. The float is lowered from the disc drilled around its
perimeter and a lightweight rope, using torque sensitive electric drive and rotary encoder
circuit to produce the pulse that is used to calculate the level of the liquid inside a tank. When
the float makes contact with the liquid level surface, the torque reduces and the number of
revolutions made by the disc is counted and the level is calculated using an appropriate
formula and displayed.
[5] A Report on OPTICAL FIBER SENSORS FOR THE MEASUREMENT OF WATER
TURBIDITY by Ahmad Fairuz Bin Omar and Mohd Zubir Bin MatJafri School of Physics,
University Science Malaysia,
Published on 20 October 2009.Turbidity meters operate based on the optical phenomena that
occur when incident light through water body is scattered by the existence of foreign particles
which are suspended within it. This review paper elaborates on the standards and factors that
may influence the measurement of turbidity. The discussion also focuses on the optical fiber
sensor technologies that have been applied within the lab and field environment and have
been implemented in the measurement of water turbidity and concentration of particles. This
paper also discusses and compares results from three different turbid meter designs that use
3
various optical components. Mohd Zubir and Bashah and Daraigan have introduced a design
which has simple configurations. Omar and MatJafri, on the other hand, have established a
new turbid meter design that makes use of optical fiber cable as the light transferring medium.
The application of fiber optic cable to the turbid meter willpresent a flexible measurement
technique, allowing measurements to be made online. Scattered light measurement through
optical fiber cable requires a highly sensitive detector to interpret the scattered light signal. This has made the optical fiber system have higher sensitivity in measuring turbidity compared to the other two simple turbid meters presented in this paper. Fiber optic sensors provide the potential for increased sensitivity over large concentration ranges. However, many challenges must be examined to develop sensors that can collect reliable turbidity measurements in situ
[6] A report on capacitive measurement principles for liquid levels by VLAD BANDE was
submitted on 2011.The aimof the thesis is to develop a capacitive level measurement system,
with future implementation in one of the hydro-technical constructions in Romania, which
allows data acquisition from the sensing element, the conversion into capacitance and in level
terms and as well allows that the final results to be displayed on a user-friendly interface.
When measuring the water level, the first logical step is the selection of the proper
measurement principle, which will have to take into consideration several constrains: the
location where the level must be evaluated, the accuracy needed, the application type or the
liquid composition and aspect. The future aim of the implementation revealed in the current
system will be the measurement of the infiltration water level inside hydro technical
constructions. The upstream water from the reservoir or the rain water enters via the dam’s
wall inside the dam’s internal galleries where it is retained inside special built gutters. The
gutters are connected in one point at the exit point of the galleries, where the water can be
eliminated from the dam. Though, the total amount of the water infiltration can be measured
in the gutter which collects all the dam infiltrations. For the correct measurement principle to
be selected, it is necessary to know the minimal technical specifications needed for such a
sensorial system, which will have to mandatory take into consideration the needed
measurement domain. The targeted objectivesare to build a low-cost capacitive level sensor
based on the parallel plate capacitor’s principle and to be able to implement a general
mathematical algorithm for capacitance to column liquid height conversion. In addition, in
this thesis the behavior models for the inhomogeneous dielectric capacitors will be revealed.
4
5
Water is a precious gift of nature. In day today life water is very essential resource either for
house consumption or industrial consumption. Water is used in household activities and
industrial activities. In house and industries we keep water in over headed tank, through
motor. In house when we start motor tank get full and water overflow take place.
Sometimes,we forgot to switch off the motor and sometime electricity supply switched off we
forget to switch off the motor. So water is wasted. To overcome this problem and save the
precious resource we have proposed this project of Water Level Detector.
In industrial purpose, water is used as the important material in industrial process. So the
purity of the water is very important and purity to be maintained. in some industrial processes
we have to continously monitor the water level. To check their turbidity level we had
proposed our project that is Water Level Detector with Turbidity Sensor .
There are many ways or methods to determine the level of a liquid. Whatever method we
chosen, much depend on the nature of the liquid itself and sometimes the environment also
might limit our choice of the methods available. For example, to determine the level of molten
iron in a blast furnace it is not a straight forward and many delicate sensing devices cannot
operate in this corrosive and extremely high temperature.
6
4.1 TURBIDITY SENSOR:
INTRODUCTION
Turbidity means the scattering particles or obstacles in the water. Turbidity analysis is
the study of a optical properties that causes light through water to be scattered and
absorbed rather than transmitted in straight line.
Turbidity causes cloudiness or a decrease in transparency of water. The direction of
the transmitted light path will undergo changes when the light hit particle in the water
column. If the turbidity level is low, less light will be scattered away from its original
direction.
Light scattered by particle or turbidity causing particle such as slit, clay, algea,organic
matter & micro-organism may enable the detection of these particle in water. With
advance in the development of the photo detector sensor, turbid meter designs are
done and able to detect the small change of the transmitted light intensity.
There are 2 main type of turbid meter. They are categorize as:-
Absorptionmeter and Nephelometer.
Figure 4.1:Flow Chart of Turbidity Measurement
7
COMPONENTS USED
Table 4.1 Component Used For Turbidity Sensor:
S.NO COMPONENTS QUANTITY RANGE
1. LED 1 -
2. Resistor 1,1 10KΩ,220Ω
3. Variable Resistor 1,1 10KΩ,100KΩ
4. LDR 1 -
5. LM358 1 Dual Mode
THEORY
When light is transmitted onto a water body, the suspended particles will block the transmission of light from going through the water. In pure or very clear water, the light transmission will be largely uninterrupted, with a small scattering effect. The pattern of interaction between light and suspended solids is depending on the size, shape and composition of the particles in the solution and to the wavelength of the incident light. Besides the scattering effect, the transmitted light will also be absorbed and attenuated in its intensity by the particles
8
Figure 4.2: Circuit Diagram of Turbidity Measurement
PRINCIPLE
Turbidity as measured using photometric techniques is defined as reduction of transparency of
a liquid caused by the presence of undissolved matter. Reduction of transparency can be
measured to a certain extent using scattering and/or transmission of light. Simple scatter is
limited to about 10 NTU. In practice,however, electronic linearization makes it possible to
usescatter intensity measurement for much higher measuring ranges (up to about 2000 NTU).
The lowest measurable turbidity level depends on how much straylight is present. The amount
of stray light present in thephotometer system determines the lowest measurableturbidity
level.
WORKING
Turbidity sensor basically work on the method of scattering of light. The basic circuit consist
of the LED and LDR. Firstly the LED is glowed by giving supply then the water is placed
between the LED and LDR circuit. As the light pass through the water ,the light will scattered
and experience the TIR which light will be detected by the LDR and its output will be
amplified and displayed in the displaying device. The output will vary according to the
turbidity causing particle such as slit,clay,algea,organic matter & micro-organism.When the
turbidity is high the light will scatter more and less output will be obtain and output will
display HIGH. As the light scattering will be less than the output of the amplifying circuit will
be high and output will display as LOW.
c Figure 4.3 Water with Turbidity to measure and turbidity sensor
9
4.2 POWER SUPPLY
INTRODUCTION
A Power supply is an electronics device that supplies electrical energy to an electrical load.
The primary function of a power supply is to convert one form of electrical signal to another
form and result, power supplies are sometimes referred to as electric power convertors. Some
power supply are discrete, stand alone devices, whereas other are built into larger devices
along with their loads. Example of the latter includes power supplies found in desktop
computers and consumer electronics devices.
DESIGNING OF POWER SUPPLY
Fig No.4.4 Circuit Diagram Of 5v & 12v Power Supply
A 5V & 12V DC is most commonly used. The above circuit shown in the figure, uses a
cheap integrated three-terminal positive regulator LM7805, and LM7812 and provides high-
quality voltage stability and quite enough current to enable the microcontroller and peripheral
electronics to operate normally ( current upto 1Amp).
10
COMPONENTS USED
TABLE NO:4.2 COMPONENT USED
S.NO COMPONENTS QUANTITY
1. Step down transformer (1A). 1
2. Diodes IN4007 4
3. Capacitors 470µf ,1000µf,10µf 1,1,1
4. Voltage regulator for 12V LM7812 1
5. Voltage regulator For 5V LM780 1
6. Resistor 220Ω 1
7. LED 1
WORKING OF POWER SUPPLY
To provide a usable low voltage are the following conditions:
1. Reduce the mains ac (alternating current ) voltage to lower level.
2. Convert this lower voltage from ac to dc (direct current)
3. Regulate the dc output to compensate for varying load(current demand)
4. Provide protection against excessive input/output voltages.
11
Figure No.4.5 Power Supply
4.3 WATER LEVEL DETECTOR:
INTRODUCTION
Measurement of the height of water in a tank or a big structure such as dam is a major
subject of study in engineering. It is not easy to measure the water level in large architectural
structures physically. Hence we always have the necessity of a electronic equipment that can
measure the water level in a container and show a message informing about the water level in
it.
Water level indicator is widely used in many industries and houses .In this project a
programmed microcontroller is the basic component for the water level indicator.
ATMELS52 microcontroller helps to indicate the level of water or any other conducting
liquid. With the help of an LCD display, we can see different level of the water contained in a
tank or in any other vessels. A liquid level sensor (turbidity circuit) detects the impurity of the
liquid in the tank and feeds it to the microcontroller and the microcontroller generates a
corresponding output text which is then displayed in the LCD.
PRINCIPLE
Sustainability of available water resource in many reason of the word is now a dominant
12
issue. This problem is quietly related to poor water allocation, inefficient use, and lack of
adequate and integrated water management. Water is commonly used for agriculture,
industry, and domestic consumption. The basic principle of this equipment is to provide clean
and purify water to human resources.
COMPONENTS REQUIRED
Microcontroller:
A microcontroller is compact ‘microcomputer’ designed to govern the operation of
‘embedded systems’ in motor vehicles, robots, office machines, complex medical
devices, mobile radio transceiver, vending machines, home appliance, and various
other devices.
Figure 4.6: Microcontroller
Features Of MicroController:
Power off flag
Watchdog timer
32 Programmable I/O lines
3-16 bit timer/counter
256*8 bit internal RAM
8 Interrupt Sources
13
Analog to Digital convertor:
An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts a
continuous physical quantity (usually voltage) to a digital number that represents the
quantity's amplitude.
The conversion involves quantization of the input, so it necessarily introduces a small
amount of error. Instead of doing a single conversion, an ADC often performs the
conversions ("samples" the input) periodically.
Figure 4.7:ADC 0808
Features of ADC 0808:
Easy interface to all microprocessors.
No-zero or Full scale adjust Required.
0V to Vcc Input Range
Conversion time 100usec.
Resolution 8 bits.
Decade Counter 7490:
A BCD counter is a special type of a digital counter which can count to ten on the
application of a clock signal. We saw previously that toggle T-type flip flops can be
used as individual divide-by-two counters. If we connect together several toggle flip-
flops in a series chain we can produce a digital counter which stores or display the
number of times a particular count sequence has occurred.
14
Figure 4.8:Decade Counter 7490
Features of Decade Counter:
Counter and 7 segment decoding in one package
Ideal for low power input
LCD (Liquid Crystal Display):
An LCD display is specifically manufactured to be used with microcontrollers, which
means that it cannot be activated by standard IC circuits. It is used for displaying
different messages on a miniature liquid crysal display.
Figure 4.9: LCD Display
The board supports a standard 16X2 LCD Display. The LCD can be plugged onto the
board through the 16 pin female connector. The LCD pins are wired to PORT2 and
can be controlled through a 4 bit interface. The connections between the LCD and the
microcontroller are as follows
LCD RS -> P2.2 ,LCD RW -> GND,
LCD EN -> P2.3, LCD D4-D7 -> P2.4 – P2.7
Preset:
A preset is a three legged electronic component which can be made to offer varying
resistance in a circuit. The resistance is varied by adjusting the rotary control over it.
The adjustment can be done by using a small screw driver or a similar tool. The
15
resistance does not vary linearly but rather varies in exponential or logarithmic
manner.
Figure 4.10:PRESET
Crystal Oscillator:
The board by default comes with an onboard crystal oscillator circuit consisting of a
11.0952 MHz quartz crystal and the required capacitors. If you would like to use the
microcontroller on a different speed, you may replace this crystal with the crystal of
the required frequency. Make sure you replace the capacitors also to match the crystal
you use.
Figure 4.11:Crystal Oscillator
WATER LEVEL SENSOR CIRCUIT:
Water level sensor circuit comprises of capacitor which is made up of aluminium strip
and Astable 555 Timer Circuit. The capacitor is of aluminium which is laminated to prevent it
from water contact. The electrodes of capacitor are parallel placed to each other. The two
parallel electrodes are separated with small gap to prevent it from physical contact.
16
Figure 4.12:555 Timer Circuit
Astable 555 Timer Circuit is used as a sensor,which senses the output of capacitor. As we
know that,duty cycle of 555 Timer should be 50% but in practical it fluctuates. So we use
diode D1.
By connecting this diode, D1 between the trigger input and the discharge input, the timing
capacitor will now charge up directly through resistor R1 only, as resistor R2 is effectively
shorted out by the diode. The capacitor discharges as normal through resistor, R2.
An additional diode, D2 can be connected in series with the discharge resistor, R2 if required
to ensure that the timing capacitor will only charge up through D1 and not through the parallel
path of R2. This is because during the charging process diode D2 is connected in reverse bias
blocking the flow of current through itself.
17
Figure 4.13 Capicator made up of aluminium strip
LAYOUT DIAGRAM:
18
Figure 4.14 Layout Diagram
CIRCUIT DIAGRAM OF WATER LEVEL DETECTOR:
Figure 4.15 Circuit Diagram of Water level Detector
ADVANTAGE OF WATER LEVEL DETECTOR
Maintenance:
19
It is an economical system that requires very less maintenance as compared to
conventional system as it has no complicated circuits and delicate mechanisms. This
saves the additional maintenance cost.
Cost:
The main advantage of the water level controller is it has very low cost than the
conventional one available in markets.But for our system, the components used are
less in number and easily available. Hence losses will be less leading to a better
efficiency.
Construction:
The construction of a water level controller is very simple as it requires only a few
components. The circuit involved is also relatively simpler.
4.4 FEATURES OF WATER LEVEL DETECTOR:
Easy installation
20
Low Maintenance
Compact and Elegant Design
Fully Automatic
Saves water, motor and energy
Fully automatic, saves man power.
Consume very little energy, ideal for continuous operation.
Automatic water level detector provides us the flexibility to decide for ourself the
water levels for operations of pump set.
Shows clear indication of water levels in the overhead tank.
Low AC Voltage sensing circuit to avoid polarization of electrodes in water. These
special stainless steel plastic moulded conductive electrodes are Long life sensors, do
not require frequent cleaning or replacement.
4.5 FLOW DIAGRAM OF WATER LEVEL DETECTOR:
21START
SENSOR DESIGNING
SENSOR TESTING
COMP.CKT & DESIGN
LCD INTERFACING
ADC INTERFACE
IS TESTING OK?
TESTING HARDWARE
& SOFTWARE CIRCUIT
NO NO
YES
SUCCESS
4.6 COMPLETE HARDWARE SETUP:
22
Figure 4.16 Hardware Setup
Figure 4.17 Complete Hardware Circuit
23
The experimental model was made according to the circuit diagram and results were as
expected. We have made aluminum strip capacitor with separation of 1 cm, length equal to
67cm with width 2.5cm.
Now using 555 timer circuit with R1 has variable resistor R1 has variable resistor 10k and R2
with 150k ohm.
Expected result as:
Capacitor value without dipping in water = 8.267nfarad
Capacitor value with dipping in water = 11.225nfarad
The output of Astable 555 timer circuit is
Figure 5.1 Astable 555 Timer Circuit
24
CONCLUSION
After performing this project we can conclude that water level is measured at various level ie
at empty level, at 10% to 100% level of water.
This system is very beneficial in rural as well as urban areas.
It helps in the efficient utilization of available water sources.
If used on a large scale, it can provide a major contribution in the conservation of
water for us and the future generations.
Water level controller is a simple yet effective way to prevent wastage of water. Its simplicity
in design and low cost components make it an ideal piece of technology for the common man.
This paper has presented the overall design concept and factors to be put forward as major
considerations in the development of optical instruments for water turbidity measurement.
This paper has also shown a design which can be developed through a very simple circuit.
Water quality is measure with IR sensors which have been successfully introduced an
innovative approach for water turbidity measurement with higher sensitivity and reliability. In
the development of IR sensors for water turbidity measurements. The combinations between
the light source and detector define the spectral characteristics of the turbid meter and the
behavior of its respond to the sample. Sensitivity of an instrument, but it may affect its
linearity at high particle concentrations due to the existence of multiple scattering. Particles
properties such as size, color, shape and composition are factors which may influence the
value of turbidity and its correlation with the capacity of suspended particles in water. These
factors may influence the direction of scattered light and the intensity of light which will be
absorbed by the particles. Different sizes of particles may cause the light to be scattered with
different intensity for different incident light wavelengths. Finally the output is given to ADC
and display its value in LCD showing the results such as clear water, turbidity water and
heavily turbidity.
FUTURE SCOPE
1. The water level controller designed in this project can be used to control water flow. If
water is too low then the submersible pump would start running unnecessarily and overheat
itself. This could be taken care by implementing another sensor. Also, the rate of water input
must always be equal to or greater than the rate of water output. To make this happen we
25
could use a speed regulator. If these issues are taken care of then a more efficient and reliable
performance can be achieved.
2. Moreover we can use GSM so that we can know the level of water through a wireless
communication and can use data logger to store the information in the absence of the person.
3. It can also be used in domestic purposes for detecting the presence of water so that we can
preserve it from wasting.
4. However in industrial purposes also we can implement this project so that suspended
particles can be sense and detects the water level.
5. We can extend this project by designing a GSM based water level and temperature
monitoring system. It can be used to measure the temperature, humidity by using sensor for
particular measurement.
6. This water level controller monitors the level of the overheadtank and automatically
switches on the water pump whenever the level goes below a preset limit. The level of the
overhead tank can be indicated using 5 LED’s and the pump is switched OFF when the
overhead tank is full. The pump is not allowed to start if the water level in the sump tank is
low and also the pump is switched OFF when the level inside the sump tank goes low during
a pumping cycle.
7. It can also be used to check the pH of the water whether it is acidic basic and neutral using
pH sensor.
26
REFERENCES
[1] VINN EXCELLENCE CENTER, ICT School of KTH, Stockholm published a report on
10-08-2012.
[2] Department of electrical engineering NATIONAL INSTITUTE OF TECHNOLOGY,
Rourkela.
[3] International Journal of Recent Development in Engineering and Technology, proposed a
project on 2nd august 2014.
[4] A thesis submitted by in partial fulfilment of the degree of Master of Science on 2003
[5] A Report on Optical Fiber Sensors for the Measurement of Water Turbidity by Ahmad
Fairuz Bin Omar and Mohd Zubir Bin MatJafri School of Physics, University Science
Malaysia, Published on 20 October 2009
[6] A report on capacitive measurement principles for liquid levels by VLAD BANDE was
submitted on 2011.
[7] Muhammad Ali Mazidi, Janice Gillispie Mazidi and Rolin D. McKinlay “The 8051
microcontroller and embedded systems” pearson publication, second edition
[8]The 8051 MICRO CONTROLLER by Kenneth J.Ayala.
[9]The HandBook of ELECTRONICS by AK Maini
[10]Electronic Devices and Circuit Theory,Boylested
.
27
APPENDIX
SOURCE CODE
BUZZ BIT P2.6
A1 BIT P2.0
B1 BIT P2.1
C1 BIT P2.2
ALE BIT P2.7
SOC BIT P2.3
EOC BIT P2.5
OE BIT P2.4
ADC EQU P0
TEMP EQU 7FH
;**************LCD****************
LCD EQU P1
E BIT P3.7
RS BIT P3.6
;**************************************
ORG 0000H
MOV TMOD,#00100000B ;TR1 MD 2 THROUGH H/W
MOV A,#38H;2 Lines AND 5X7 MATRIX
ACALL COMNWRT
ACALL DELAY
MOV A,#0EH;DISPLAY ON,CURSOR BLINKING
ACALL COMNWRT
ACALL DELAY
MOV A,#01H;CLR SCREEN
ACALL COMNWRT
28
ACALL DELAY
MOV A,#06H;SHIFT CURSOR RIGHT
ACALL COMNWRT
ACALL DELAY
;........CHAR...........
MOV A,#82H
ACALL COMNWRT
ACALL DELAY
ACALL DATAWRT
ACALL DELAY
A1: MOV TH1,#00H
MOV TL1,#00H
JH1: JNB P3.4,JH1
JH2: JB P3.4,JH2
JH3: JNB P3.4,JH3
SETB TR1
JH4: JB P3.4,JH4
CLR TR1
MOV A,TL1
ACALL BIN_TO_ASCII_S2
MOV A,#83H
ACALL COMNWRT
ACALL DELAY
MOV A,50H
ACALL DATAWRT
ACALL DELAY
MOV A,51H
29
ACALL DATAWRT
ACALL DELAY
MOV A,52H
ACALL DATAWRT
ACALL DELAY
CLR E
CLR BUZZ
ACALL WATER_LVL_TURBIDITY
;***************************************
MOV ADC,#0FFH;MAKING P1 I/P FOR ADC DATA..
CLR ALE ;L TO H
CLR SOC ;L to H
CLR OE ;L TO H
SETB EOC; MAKING IP PORT FOR INTERRUPT
AGAIN: ACALL ADC_DATA
MOV TEMP,A
ACALL TEST
CJNE A,#175,NEXT1
NEXT1: JNC DISP1
CJNE A,#124,NEXT2
NEXT2: JNC DISP2
ACALL DISP_CLEAR
SJMP AGAIN
DISP1: ACALL DISP_T00_TURBID
SJMP AGAIN
DISP2: ACALL DISP_TURBID
SJMP AGAIN
30
;************************************************************
WATER_LVL_TURBIDITY:
MOV A,#80H
ACALL COMNWRT
ACALL DELAY
MOV DPTR,#LBL1
ACALL DISP_LCD
MOV A,#0C0H
ACALL COMNWRT
ACALL DELAY
MOV DPTR,#LBL2
ACALL DISP_LCD
RET
;***************************************************
DISP_T00_TURBID: SETB BUZZ
ACALL DISP_ALC_DETECTOR
MOV A,#38H;2 Lines AND 5X7 MATRIX
ACALL COMNWRT
ACALL DELAY
MOV A,#0C0H
MOV DPTR,#TOO_TURBID
ACALL DISP_LCD
RET
;***************************************************
DISP_TURBID:
SETB BUZZ
31
ACALL DISP_ALC_DETECTOR
MOV A,#38H;2 Lines AND 5X7 MATRIX
ACALL COMNWRT
ACALL DELAY
MOV A,#0C0H
ACALL COMNWRT
ACALL DELAY
MOV DPTR,#TURBID
ACALL DISP_LCD
RET
;*****************************************************
DISP_CLEAR: CLR BUZZ
ACALL DISP_ALC_DETECTOR
MOV A,#38H;2 Lines AND 5X7 MATRIX
ACALL COMNWRT
ACALL DELAY
MOV A,#0C0H
ACALL COMNWRT
ACALL DELAY
MOV DPTR,#CLEAR
ACALL DISP_LCD
RET
;************************************************
COMNWRT: CLR RS;RS=0 FOR CMD
MOV LCD,A
SETB E;ENABLE H TO L
32
ACALL DELAY
CLR E
ACALL DELAY
RET
DATAWRT: SETB RS;RS=1 FOR DATA
MOV LCD,A
SETB E;ENABLE H TO L
ACALL DELAY
CLR E
ACALL DELAY
RET
;DELAY............
DELAY: MOV R7,#200
BACK2: MOV R6,#200
BACK: DJNZ R6,BACK
DJNZ R7,BACK2
RET
ADC_DATA:CLR A1
CLR B1
CLR C1
ACALL DELAY
SETB ALE ;
ACALL DELAY
SETB SOC
HERE1: JB EOC,HERE1;EOC
ACALL DELAY
33
SETB OE
ACALL DELAY
MOV A,ADC
ACALL DELAY
CLR SOC
CLR OE
CLR ALE
RET
DELAY1:MOV R7,#2
BACK5: MOV R6,#255
BACK4: MOV R5,#255
BACK3: DJNZ R5,BACK3
DJNZ R6,BACK4
DJNZ R7,BACK5
RET
TEST: MOV A,TEMP
MOV B,#10
DIV AB
MOV 42H,B
MOV B,#10
DIV AB
MOV 41H,B
MOV 40H,A
;........BCD TO ASCII.......
MOV R0,#40H
MOV R2,#3
34
HERE: MOV A,@R0 ;(I/P BCD NO.)
ORL A,#30H
MOV @R0,A
INC R0
DJNZ R2,HERE
MOV A,#0CCH
ACALL COMNWRT
MOV A,40H
ACALL DATAWRT
ACALL DELAY
ACALL DELAY
MOV A,41H
ACALL DATAWRT
ACALL DELAY
MOV A,42H
ACALL DATAWRT
ACALL DELAY
MOV A,TEMP
RET
ORG 400H
WTR_LVL : DB " WATER LEVEL",0;
TURBIDITY: DB "TRUBIDITY",0;
CLEAR : DB " CLEAR",0
END
35