Senin, 21 Mei 2012

Water Level Indicator using ATMEGA16 microcontroller

3 komentar

A simple water level indicator using ATMEGA16 microcontroller. It displays water level in the tank as well as in the reservoir. Also, it controls the motor which pumps the water in the tank from the reservoir. In the auto mode, motor is automatically turned on when water level reaches 20% in the tank and it is turned off when water level reaches 100%.

The following picture shows the final circuit in working condition.
Figure 1.   Final working circuit for water level indicator

In the above image, seven segment display shows the current water level in the tank. While bar LED display shows the current water level in the reservoir. Also LCD shows different messages as well at different times. The yellow LED near bar LED display shows that if motor is turned on or not. When yellow LED is on, then motor is on, otherwise motor is off. The green LED in the top left corner shows if the circuit is powered on or not. The multiple wire connector in the top left corner is attaching sensors placed in the water tank to the circuit. While the multiple wire connector in the bottom left corner is attaching sensors placed in the water reservoir to the circuit. The push button below the microcontroller turns the motor on manually. While the push button on the left side of the microcontroller resets the controller.

This is a video of this circuit in action which is shown below.

This circuit can alert user about error conditions (on the LCD). One such example is shown below.
Figure 2.   Error condition indication in the water level indicator ciruit 

Circuit Diagram

Figure 3.   Circuit diagram of water level indicator using ATMEGA16 

The following image shows the pin configuration settings for the ATMEGA16 microcontroller in the code.
Figure 4.   Pin configurations for ATMEGA16

How to use this circuit

To use this circuit you have to install the water level sensors in the water tank. Connector CN1 is used to connect the circuit with the water level sensors as shown below.

Figure 5.   Connections to the water tank

Also you have to install the water level sensors in the water reservoir. Connector CN2 is used to connect the circuit with the water level sensors as shown below.

Figure 6.   Connections to the water reservoir and motor

Input Voltage:   12volt power supply is required.
Capacitors:        The capacitors used in this circuit need to have a rating of at least 16v.
Q1, Q2, Q3, Q4 transistor:     Any npn transistor will work here.

Water Sensors:  Simple wires can be placed in the water tank. As the current required to pass through the wire is in nano amps. But if you want then you can place carbon rods at the end of wires which can be extracted from the 1.5v AA cell. These carbon rods should be thoroughly washed and then you should attach the wire to the carbon rod and then use some epoxy to hide the wire part.

uA741:            This is used to generate the output to drive the relay for the motor control.
LM7805:        This is the 5v regulator used to power up the whole circuit.
Seven Segments:         These are used to display water level. Common cathode seven segments are used
LCD:              Common 16x2 LCD can be used in this circuit.
LED Bar:       DS1 is the 10 LEDs bar.
Crystal:          8Mhz crystal needs to be attached with the ATMEGA16.
ATMEGA16:           This microcontroller is used to generate all the required logic for this circuit.

PCB Design

The circuit diagram was made in the Livewire software [ Download from Here ] and it is shown in the figure 3 above. The PCB was designed in the PCB wizard [ Download from Here ]. The final PCB design is shown below.

Figure 7.   PCB design for the water level indicator
I have designed this circuit completely on my own. Your comments and feedback is highly appreciated.

For ATMEGA16 code Click Here [This code was written using VMLAB]
For Schematic + PCB design Click Here  [These will open in PCB wizard 3, which can be downloaded from here]

source :