AVR Microcontroller Based Automatic Water Level Control System

This water level project sensing the water level in the tank and switch the water pump automatically if the water is below the certain level. This ATmega8 water level controller project.

Water Level Controller Working

The main concept of this project is to switch ON the water pump automatically when the water goes below the certain level. Here we set the 25%. If water goes below it, the pump motor will start automatically. And switch the pump OFF when the water level reaches to 100%. We have connected the 16×2 LCD to show the water level.

One important feature in this project is, we can switch the pump motor ON manually. Suppose the water level is at 50%, and we want to turn the motor ON. By pressing the switch connected to PC4. Pump motor will ON and fill the water till it reaches to 100% level then OFF automatically.

How to Make Water Level Controller

There is a different concept to make water level controller. We have used four sensor probes to sense the level of water. A 16×2 lcd display. AVR ATmega8 microcontroller to sense the water level process the input and display on the LCD. A relay circuit to turn the water pump ON and OFF. A manual switch to turn water pump ON at any level of water in the tank. Simply connect all the module as given in the water level controller circuit diagram.

How to Measure Water in a Tank

In this project. we have used four sensors to sense the water in a tank.  This four electrode/sensor is placed in the tank at 25%, 50%, 75% and at the top or 100% of the tank level.

As given in circuit, we put one wire of 5V supply in the bottom of the tank. And remaining wires at its different level in the tank. When water is around 30% then 5V supply wire and electrode at 25% will short and the transistor connected to it will trigger. Due to this a low voltage signal will be received by the PC0 pin of the ATmega8 microcontroller.

When the water level is at 50%, then 5V supply wire will short to 25% and 50% level wire. This will give input 0 at PC0 and 0 at PC1. By reading these pins we display the water level on the 16×2 LCD.

Automatic Water Pump Controller Circuit Diagram

Automatic Water Level Controller AVR Code

#include<avr/io.h>
#include”lcd.h”
#include<util/delay.h>
int main()
{
lcd_init(LCD_DISP_ON);
int readLevel=0;
int motorON=0;
DDRB=0b11111111;
DDRC=0b0000000;
while(1)
{
readLevel=PINC & 0b0001111;
//Turn ON the Pump Manually by PC4
if(PINC & 0b0010000)
{
motorON=1;
PORTB=0b00000001;
}
if(readLevel==0b0001111)
{
motorON=1;
PORTB=0b00000001;
lcd_puts(“Water Below 25%”);
if(motorON){
lcd_gotoxy(0,1);
lcd_puts(“Motor ON”);
}
}
if(readLevel==0b0001110)
{
lcd_puts(“Water Level=25%”);
if(motorON){
lcd_gotoxy(0,1);
lcd_puts(“Motor ON”);
}
}
if(readLevel==0b0001100)
{
lcd_puts(“Water Level=50%”);
if(motorON){
lcd_gotoxy(0,1);
lcd_puts(“Motor ON”);
}
}
if(readLevel==0b0001000)
{
lcd_puts(“Water Level=75%”);
if(motorON){
lcd_gotoxy(0,1);
lcd_puts(“Motor ON”);
}
}
if(readLevel==0b0000000)
{
PORTB=0b00000000;
motorON=0;
lcd_puts(“Water Level=100%”);
if(motorON){
lcd_gotoxy(0,1);
lcd_puts(“Motor ON”);
}
else{
lcd_gotoxy(0,1);
lcd_puts(“Motor OFF”);
}
}
_delay_ms(800);
lcd_clrscr();
}
return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *