automatic water level controller using at895c1


1.1 Introduction

            Water level controller is automatic electronic circuit. This circuit monitor the condition of water tank and control the motor used to pump water from ground tank to roof tank using microcontroller. The control panel, i.e. the main control unit of the system which consist of the primary control switches. The programed logic in microcontroller gives the output which is connected the relay which controls the switching of the pump, using of siren and LCD to indicate the present condition of controller. Beside the program logic and its functions, one important thing regard the level monitoring is its sensor. In this project we will use self-make sensor   which is consist of metallic strip. Among different strips one will be connect with dc voltage, when water reaches and touches any of the strip the circuit is completed and respective Optocoupler is activated which gives will signal to microcontroller. When all strip is dipped in water motor will off. Optocoupler will be used to make circuit safe from outside signal. We will need two different power supplies, one for smooth running of microcontroller and another for input and optocoupler













1.2 Objectives

v  To  observe the water level of tank

v  To control motor automatically

v  To save energy and natural resources




















1.3 Problem statement

                   Most of the people in the context of our country, they are still using manual process for water pumping and motor control that used in home, office and industries. Manual controlling process is difficult when the water tank is located at higher buildings and controlling from ground level. Due to more time consuming on manual operation it is total loss of our valuable time. If we are unable to continuous monitoring there are loss of energy sources for pumping water as well as loss of natural resources by overflowing water from tank.

                                  With invention of different technology and automatic system, people wants to do such a task without touching it. For fulfillment of people desire we have design this system which control the motor used to pump. Motor is automatically start and stops as our requirement. Our system is not only motor controlling system it also check the condition of water tank and display the present status.

   The proposed approach for this system is based on microcontroller controlling system with simple self-made water level sensor. Microcontroller reads the status of system and give desired output by switching motor and displaying LCD and LED.











 1.4 Theory  

                The embedded system is a combination of computer hardware, software   and perhaps additional mechanical or other parts, designed to perform a specific function within a given time frame. The embedded software is required for all real-time applications and is developed using a real time operating system (RTOS), as it helps to schedule and execute tasks based on priority in a predictable manner.

                      This   project   is   based   on the embedded systems technology using microcontroller. The objective of this project is to control the motor used in home and office for water pumping with the help of switching function of microcontroller with observing status by simple self-made sensor. In this project we interface LCD and Microcontroller to show the status of whole system. When water tank is empty motor is automatically start and when tank is full motor is stop and  all condition in  you are system will be display in LCD.

The Microcontroller is the embedded device which has on chip program memory in which the machine control program is stored. Suppose if sensor send signal to turn on the motor, then the Microcontroller activates the relay which is connected to motor. Now the Motor is switched ON by relay.










2.1 Parts of system




          Fig 1: Block diagram of automatic water level controller

              The figure shown above is the simple block diagram of our project. It is a simple illustration of how we have implemented our project and the various parts involved in it. From the above representation, the sensor is used to read status of water level and sends different signal to the microcontroller. Explanation of each block are follow:


2.1.1Water level sensor:

                  In market, different water level sensor are available but in this project we have used self-made sensor. Water level sensor is the simply group of wire. Separate wire conducts voltage from where the level of water is reached and this voltage is supplied to the signal conditioner.


2.1.2 Input signal conditioner:

                The voltage from water level sensor is simply amplified by this section of our project. The output of sensor is very small so we process it using amplifier circuit. We have used emitter follower amplifier in this project whose output is given to the microcontroller.


2.1.3 Microcontroller:

                  Microcontroller is programmable semiconductor device. This is 40 pins digital device. Microcontroller has in built RAM and ROM with microprocessor. The microcontroller we used in this project is AT89C51.which is the main section of our project. Microcontroller are widely used in embedded system.

2.1.4 Optoisolators:

                     Optocoupler is used to isolate two part of system. We have used motor in our projects, which can produce back EMF, a high voltage spike produced by a sudden change of current. In this situation, we can reduce the effect of this unwanted voltage spike by using optocoupler. Optoisolator has an LED transmitter and a photo sensor receiver, separated from each other by air gap.

2.1.5 Relay driving circuit:

                         Microcontroller pins lack sufficient current to drive relay. While the relay’s coil needs around 10mA to be energized, the microcontroller pin can provide a maximum 1-2 mA current. For this reason, we placed a driver as ULN2803. Which is Darlington pair circuit whose gain is very high, input impedance is very high and output impedance is low.


2.1.6 Relay:

               A relay is an electrically controllable switch widely used in industrial controls, automobiles and appliances. It allows isolation of two separate section of system with two different voltage source. We have used electromechanical relay, when current flows through the coil magnetic field is induced around the coil which causes the armature to be attracted to the coil.


2.1.7 Indicator:

                  Indicator are the electronic devices which shows the condition of the system. It indicates what is happening in our system. LCD and LED are the indicators used in our system. We have added LED indicator together with LCD because uneducated people cannot understand LCD’s output.






2.1.8 Power supply:

                          Power supply provides all necessary voltage and current for our system to operate. Power supply used in this projects convert 220v AC supply in to 5v and 12v dc supply using transformer, diodes, capacitor and regulator IC.  A power supply can by broken down into a series of blocks, each of which performs a particular function. For example a 5V regulated supply:


Fig 2: block diagram of power supply















3.1 Component used


Microcontroller is a microprocessor designed specifically for control applications, and is equipped with ROM, RAM and facilities Input/ Output on a single chip. The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.



• Compatible with MCS-51™ Products

• 4K Bytes of In-System Reprogrammable Flash Memory

– Endurance: 1,000 Write/Erase Cycles

• Fully Static Operation: 0 Hz to 24 MHz

• Three-level Program Memory Lock

• 128 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Two 16-bit Timer/Counters

• Six Interrupt Sources

• Programmable Serial Channel

• Low-power Idle and Power-down Modes



Pin configuration:

AT89C51 microcontroller has 40 pins with a single 5 Volt power supply. The pin 40 is illustrated as follows:


                                Fig 3: AT89C51 pin configuration


The function of each pin AT89C51 is:

                    Pin 1 to 8 (Port 1) is an 8-bit parallel port of a two-way (bidirectional) that can be used for different purposes (general purpose).

Pin 9 is a pin reset, reset is active if a high ration.

  • P3.0 (10): RXD (serial port data receiver)
  • P3.1 (11): TXD (serial port data sender)
  • P3.2 (12): INT0 (external interrupt 0 input, active low)
  • P3.3 (13): INT1 (external an interrupt input, active low)
  • P3.4 (14): T0 (external input timer / counter 0)
  • P3.5 (15): T1 (external input timer / counter 1)
  •  P3.6 (16): WR (Write, active low) control signal from port 0 write data to memory and input-output data externally.
  • P3.7 (17): RD (Read, active low) control signal of the reading of input-output data memory external to the port 0. XTAL pin 18 as the second, the output is connected to the crystal oscillator. XTAL pin 19 as the first, high input to the oscillator, connected to the crystal.



              A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. Because a relay is able to control an output circuit of higher power than the input
circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier.

                            Fig 4: Relay


                 When a current flows through the coil, the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact. When the current to the coil is switched off, the armature is returned by a force approximately half as strong as the magnetic force to its relaxed position. Usually this is a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a spike of voltage and might cause damage to circuit components. Some automotive relays already include that diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a small copper ring can be crimped to the end of the solenoid. This “shading ring” creates a small out-of-phase current, which increases the minimum pull on the armature during the AC cycle.

3.1.3 ULN2803A

         The ULN2803A is a high-voltage, high-current Darlington transistor array. The device consists of eight NPN Darlington pairs that feature high-voltage outputs with common-cathode clamp diodes for switching inductive loads. The collector-current rating of each Darlington pair is 500mA. The Darlington pairs may be connected in parallel for higher current capability. Applications include relay drivers, hammer drivers, lamp drivers, display drivers (LED and gas discharge), line drivers, and logic buffers. The ULN2803A has a 2.7-k series base resistor for each Darlington pair for operation directly with TTL or 5-V CMOS devices.



Fig 5: Logical diagram of ULN2803


  • 500-mA Rated Collector Current (Single Output)
  • High-Voltage Outputs  50 V
  • Output Clamp Diodes
  • Inputs Compatible With Various Types of Logic
  • Relay Driver Applications

3.1.4 Capacitor

               A capacitor is an electrical/electronic device that can store energy in the electric field between a pair of conductors (called “plates”). The process of storing energy in the capacitor

is known as “charging”, and involves electric charges of equal magnitude, but opposite polarity, building up on each plate. Capacitors are occasionally referred to as condensers. Capacitors are often used in electrical circuit and electronic circuits as energy-storage devices. They can also be used to differentiate between high-frequency and low-frequency signals. This property makes them useful in electronic filters.

Capacitance: The capacitor’s capacitance (C) is a measure of the amount of charge (Q) stored on each plate for a given potential difference or voltage (V) which appears between the plates:


In SI units, a capacitor has a capacitance of one farad when one coulomb of charge is stored due to one volt applied potential difference across the plates. Since the farad is a very large unit, values of
capacitors are usually expressed in microfarads (µF), Nano farads (nF), or Pico farads (pF).




                 When there is a difference in electric charge between the plates, an electric field is created in the region between the plates that is proportional to the amount of charge that has been moved from one plate to the other. This electric field creates a potential difference V = E·d between the plates of this simple parallel-plate capacitor.

The capacitance is proportional to the surface area of the conducting plate and inversely proportional to the distance between the plates. It is also proportional to the permittivity of the dielectric (that is, non-conducting) substance that separates the plates.

The capacitance of a parallel-plate capacitor is given by:

Where ε is the permittivity of the dielectric (see Dielectric constant), A is the area of the plates and d is the spacing between them.



Polarized capacitors (large values, 1µF +):


                                                    Fig 7: circuit symbol of capacitor 




3.1.5 Diode

               The P-N junction diode is a normal semiconductor lattice formed by combining a p-type & a n-type extrinsic semiconductor materials. It permits the easy flow of current only in one direction but restricts it in the other direction. Hence it is popularly used in rectification purposes of the a.c. supply. The P-N junction diode is symbolized in the circuit as shown:

                The Anode (A) is the p- type material & the cathode (K) is the n- type material. A normal diode has basically two states of operation. These are: the forward bias & the reverse bias. In the forward mode anode is positive & cathode is negative. Here high current flows heavily known as forward current. In the reverse mode anode is negative & cathode is positive. Here very little current
known as reverse current flows.

Fig 8: diode



3.1.6 Transistor

                A transistor is a semiconductor device, commonly used as an amplifier or an electrically controlled switch. The transistor is the fundamental building block of the circuitry in computers, cellular phones, and all other modern devices. Because of its fast response and accuracy, the transistor is used in a wide variety of digital and analog functions, including amplification, switching, voltage regulation, signal modulation, and oscillators. There are mainly two groups of transistors the BJT & the FET. The BJT has both polarity carriers i.e. Holes and Electrons, while the FET is a special transistor having only one type of carrier responsible for conduction. Generally there are two types of transistors. They are the NPN & the PNP which are symbolized as shown below. The NPN type has p-type material sandwiched between the n- type materials while the PNP has n- type material sandwiched between the p- type materials. The transistor has three terminals namely Base, Collector & Emitter.

                        Fig 9: circuit symbol of transistor



3.1.7 Resistor



                              Fig 10: resistor

                 Resistors restrict the flow of electric current, for example a resistor is placed in series with a light-emitting diode (LED) to limit the current passing through the LED.


Resistor values – the resistor color code:

Resistance is measured in ohms; the symbol for ohm is an omega .
1 is quite small so resistor values are often given in k and M .
1 k = 1000     1 M = 1000000 .

The Resistor
Color Code























           Resistor values are normally shown using colored bands.
Each color represents a number as shown in the table.

Most resistors have 4 bands:

  • The first band gives the first digit.
  • The second band gives the second digit.
  • The third band indicates the number of zeros.
  • The fourth band is used to shows the tolerance (precision) of the resistor, this may be ignored for almost all circuits but further details are given below.


This resistor has red (2), violet (7), yellow (4 zeros) and gold bands.
So its value is 270000 = 270 k .

On circuit diagrams the  is usually omitted and the value is written 270K.




3.1.8 Transformer

                Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC.

Step-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage.

The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core.

Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. 

The ratio of the number of turns on each coil, called the turn’s ratio, determines the ratio of the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.

  turns ratio = 





power out = power in   



Vs × Is = Vp × Ip


Vp = primary (input) voltage
Np = number of turns on primary coil
Ip  = primary (input) current


Vs = secondary (output) voltage
Ns = number of turns on secondary coil
Is  = secondary (output) current








Fig 11: transformer


3.1.8 Preset



Preset Symbol

These are miniature versions of the standard variable resistor. They are designed to be mounted directly onto the circuit board and adjusted only when the circuit is built. For example to set the frequency of an alarm tone or the sensitivity of a light-sensitive circuit. A small screwdriver or similar tool is required to adjust presets.

Presets are much cheaper than standard variable resistors so they are sometimes used in projects where a standard variable resistor would normally be used.

Multiturn presets are used where very precise adjustments must be made. The screw must be turned many times (10+) to move the slider from one end of the track to the other, giving very fine control.



Fig 12: preset


3.1.10 Crystal Oscillator

                A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency.[This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits incorporating them became known as crystal oscillators, but other piezoelectric materials including polycrystalline ceramics are used in similar circuits.

Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion crystals are manufactured annually. Most are used for consumer devices such as wristwatchesclocksradioscomputers, and cellphones. Quartz crystals are also found inside test
and measurement equipment, such as counters, signal generators, and oscilloscopes.

                      Fig 13: Crystal oscillator

3.1.11 LCD

    This 16-character, 2-line parallel liquid crystal display achieves a large viewing area in a compact package. It features a yellow-green LED backlight and uses the common HD44780 interface (330k pdf), so sample interface code is widely available for a variety of microcontrollers. This LCD is also available without a backlight.

The DDRAM address 0x00 corresponds to the first character of the top line, address 0x0F corresponds to the last character of the top line, address 0x40 corresponds to the first character of the second line, and address 0x4F corresponds to the last character of the second line.

You can find sample HD44780 LCD interface code written for a variety of AVR microcontrollers as part of the Pololu AVR library.













ground (0 V)



5 V logic supply voltage



contrast adjustment



H/L register select signal



H/L read/write signal



H/L enable signal


DB0 – DB7

H/L data bus for 4- or 8-bit mode


A (LED+)

backlight anode


K (LED-)

backlight cathode











                                               Fig 14: LCD display




3.1.12 LED

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices and are increasingly used for other lighting. Appearing as practical electronic components in 1962, early LEDs emitted low-intensity red light, but modern versions are available across the visibleultraviolet, and infrared wavelengths, with very high brightness.

When a light-emitting diode is forward-biased (switched on), electrons are able to recombine with electron holes within the device, releasing energy in the form of photons. This effect is called electroluminescence and the color of the light (corresponding to the energy of the photon) is determined by the energy gap of the semiconductor. A LED is often small in area (less than 1 mm2), and integrated optical components may be used to shape its radiation pattern.[6] LEDs present many advantages over incandescent light sources including lower energy consumption, longer lifetime, improved physical robustness, smaller size, and faster switching. LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lamp sources of comparable output.

Light-emitting diodes are used in applications as diverse as aviation lightingautomotive lighting, advertising, general lighting, and traffic signals. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also useful in advanced          communications technology. Infrared LEDs are also used in the remote control units of many commercial products including televisions, DVD players and other d


                                       Fig : Light emmiting diode


3.1.13 Optoisolator

                     In electronics, an opto-isolator, also called an optocoupler, photocoupler, or optical isolator, is “an electronic device designed to transfer electrical signals by utilizing light waves to provide coupling with electrical isolation between its input and output”. The main purpose of an opto-isolator is “to prevent high voltages or rapidly changing voltages on one side of the circuit from damaging components or distorting transmissions on the other side.” Commercially available opto-isolators withstand input-to-output voltages up to 10 kV and voltage transients with speeds up to 10 kV/μs.



               Fig 16: Optoisolator









3.2 Circuit diagrm


                                                                                                                                                                                                                                                                                                                                                                                                               4.1 Software used

4.1.1Mide compiler

                Mide Software is used which is provide with software development tools for 8051 based microcontrollers. With the Mide tools, we can generate embedded applications for virtually every 8051 derivative. As well as we use it for debugging program and generating Hex Code, this is understood by microcontroller.


4.1.2 ISP flash programmer


It is an application program in computer which is used to burn program into Microcontroller.



4.1.3 Proteus

     It is an application program for simulation of system using virtual hardware component with hex code generated by mide.








4.2 Flow chart







Read from sensor

Turn on motor

Show status

Turn off motor

Show  status

Show status


Turn off motor

Show  status


























                                                         Yes                                                         No

                       Fig 18: flow chart of program

5.1 Limitation


  1. If the one wire of the sensor is broken system is halted
  2. Sensor operated on the principle of water conduct electricity so sometimes it doesn’t work so we can change sensor type as our requirement.
  3. System debugging is difficult for normal user















5.2 Problem faced

             Firstly due to lack of sufficient knowledge about programming, we faced problem on generating hex code for microcontroller. Later we have solved this problem learning book, e-book and consulting with teachers and friends.

The most difficulty we faced in the course of our project is implementation hardware due to lack of knowledge about some hardware like ULN2803 and optocoupler. At last we were more worry about our sensor which had worked in testing but not worked in all water at final testing. and power supply have created problem.


















5.3      Application

            The automatic water level controller system can be used broadly over different fields. Some of the major fields are listed below:


  • Personal use
  • Office use
  • Business
  • Research
    • Education
















5.3 Cost of project:




Unit price


















Regulator IC















Capacitor (electrolytic)






























Crystal oscillator





ULN 2803










 IC base











5.4 Conclusion

                              After analyzing and working in this project we concluded that project is very useful in daily life of people .We faced few problems while doing this project till. We did a group work and with the help of our supervisor and faculty members we are so close in success of our project. Thus, the project we have undertaken has helped us gain a better perspective on various aspects related to our course of study as well as practical knowledge of electronic equipment. We became familiar with software analysis, designing, implementation, testing and maintenance concerned with our project. Really, we are developing a useful project.














5.5 References

Posted in Uncategorized | 4 Comments

gaunshahar, lamjung

gaunshahar, lamjung

Posted in Uncategorized | Leave a comment

बुढेस कालमा घरको  जग  हाल्नु पर्ने बाध्यता!

थाकी सकेको जिन्दगी फेरी थाल्नु पर्ने बाध्यता!

दुनियाँको संसार सधै उज्यालो देखेको तिमि!

बिजुली त अरुलाई हो दाइ टुकी बाल्नु पर्ने बाध्यता!

अरुको भाउ बढ्दा टाउको मा हात राखेको तिमि!

आफ्नो श्रम हात जोड्न मात्र फाल्नु पर्ने बाध्यता!

दुनियाँलाई राजा महाराजा सरि देखेको तिमि!

थोत्रा भोटो पनि दसौ पटक् टल्नु पर्ने बाध्यता!

कुन क्रान्तिले के दियो तिमिलाई मेरो दजुभाई !

बैमानको लागि बैमानकै सत्ता ढाल्नु पर्ने बाध्यता!

बलि को बोका बानए तिम्रो गरिबिलाई,बध्यातलाई!

जबरजस्ति यो देशमा सपनि पाल्नु पर्ने बाध्यता!

के गर्नु बिश्वाश नगरे नि नहुनी मेरो दाई!

  • टाउकोले टेकेर भएपनि पाइला चाल्नु पर्ने बाध्यता!
  • Image
Posted on by rmshmlpt | Leave a comment


Water level controller is automatic electronic circuit. This circuit monitor the condition of water tank and control the motor used to pump water from ground tank to roof tank using microcontroller. The control panel, i.e. the main control unit of the system which consist of the primary control switches. The programed logic in microcontroller gives the output which is connected the relay which controls the switching of the pump, using of siren and LCD to indicate the present condition of controller. Beside the program logic and its functions, one important thing regard the level monitoring is its sensor. In this project we will use self-make sensor   which is consist of metallic strip. Among different strips one will be connect with dc voltage, when water reaches and touches any of the strip the circuit is completed and respective Optocoupler is activated which gives will signal to microcontroller. When all strip is dipped in water motor will off. Optocoupler will be used to make circuit safe from outside signal. We will need two different power supplies, one for smooth running of microcontroller and another for input and optocouplers.


      The automatic water level controller system can be used broadly over different fields. Some of the major fields are listed below:

  •  Personal use
  • Office use
  • Business
  • Research
  • Education




Posted in Uncategorized | Leave a comment

Hello world!

Welcome to! This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Happy blogging!

Posted in Uncategorized | 1 Comment