Manual and Automatic Water Level Controller using Arduino Nano

Published  February 23, 2022   0
Automatic Water Level Controller using Arduino

This project is based on a water tank management system. The project name is a Manual And Automatic Water Level Controller. In the project setup, the motor is controlled by two modes, which are as below:-

  1. Auto Mode and
  2. Manual Mode

In auto mode When the water level is very low the water pump will automatically be ON, When the water level will reach a very height than the water pump will automatically be OFF, and in manual mode, you can  ON and OFF the water pump. if you ON the water pump in the manual mode and you forgot after some time no problem the device automatically turn OFF the water pump This project can help to save water. We can apply this whole setup in our home. 

Before this, we worked on some water monitoring projects:

Water Level Controller

Component Required for Automatic Water Level Controller

Project Used Hardware 

  • Arduino Nano  (Atmega328P Microcontroller IC )  
  • LCD display(16*2)
  • Ultrasonic sensor(HC SR04)
  • Transformer(0-12)
  • diodes(1n4007)
  • capacitor(470uf and 25v)
  • voltage regulator(7805)
  • indicator light(green color)
  • switch
  • push button
  • bluetooth module(HC-05)
  • 5v relay
  • Transistor(BC457)
  • Resistance
  • I2C module

Project Used Software

  • Arduino IDE
  • MIT app inventor
  • Tinkercad
  • Ultimaker Software
  • Fritzing Software

Project Hardware/Software Selection

Atmega328P Microcontroller IC

ATmega328P Microcontroller is the most widely used standalone Atmega IC for electronics projects. Here I used this microcontroller IC instead of Arduino Uno to save some space.

Ultrasonic Sensor

An ultrasonic sensor is an electronic device that measures the distance of a target object by emitting ultrasonic sound waves, and converts the reflected sound into an electrical signal. Ultrasonic waves travel faster than the speed of audible sound (i.e. the sound that humans can hear). Ultrasonic sensors have two main components: the transmitter (which emits the sound using piezoelectric crystals) and the receiver (which encounters the sound after it has travelled to and from the target).

Relay Module(single channel)

Relay is an electromechanical device that uses an electric current to open or close the contacts of a switch. The single-channel relay module is much more than just a plain relay, it comprises of components that make switching and connection easier and act as indicators to show if the module is powered and if the relay is active or not.

LCD display(16*2)

A 16x2 LCD display is a very basic module and is very commonly used in various devices and circuits. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix.

Bluetooth Module(HC-05)

HC-05 Bluetooth Module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. Its communication is via serial communication which makes an easy way to interface with the controller or PC.

Transformer(0-12):

The transformer in the simplest way can be described as a thing that steps up or steps down voltage. In a step-up transformer, the output voltage is increased and in a step-down transformer, the output voltage is decreased. The step-up transformer will decrease the output current and the step-down transformer will increase the output current for keeping the input and the output power of the system equal.

voltage regulator(7805)

voltage regulator, any electrical or electronic device that maintains the voltage of a power source within acceptable limits. ... Such a device is widely used in motor vehicles of all types to match the output voltage of the generator to the electrical load and to the charging requirements of the battery.

Automatic Water Level Controller Circuit Diagram

Automatic Water Level Controller Circuit Diagram

APP Design in MIT App Inventor

App Inventor

APP Blocks in MIT App Inventor

MIT App Inventor

3D Model Design in Tinkercad  

3D Model Design in TinkerCad

3D Model Design in Ultimaker Software

3D Model Design in Ultimaker Software

Circuit Diagram Design Fritzing Software

Circuit Design in Fritzing Software

Code in Arduino IDE

Code in Arduino IDE

Code
#include <EEPROM.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int Trig_Pin = 2;
int Echo_Pin = 3;
int Push_Button =10;
int Switch_pin =11;
int Motor_Pin =13;
int oldValue = 0 , newValue = 0;
long duration, cm;
int set_val,percentage;
bool state,pump;
void setup() {
  Serial.begin(9600);
  lcd.begin();
  lcd.print("WATER LEVEL:");
  lcd.setCursor(0, 1);
  lcd.print("PUMP:OFF MANUAL");
   pinMode(Trig_Pin, OUTPUT);
  pinMode(Echo_Pin, INPUT);
  pinMode(Push_Button, INPUT_PULLUP);
  pinMode(Switch_pin, INPUT_PULLUP);
  pinMode(Motor_Pin, OUTPUT);
  set_val=EEPROM.read(0);
   if(set_val>30)set_val=30;
}
if(percentage<20&digitalRead(Switch_pin))pump=1;
   if(percentage>90)pump=0;
   digitalWrite(Motor_Pin,!pump);
   lcd.setCursor(5, 1);
   if(pump==1)lcd.print("ON ");
   else if(pump==0) lcd.print("OFF");
   lcd.setCursor(9, 1);
   if(!digitalRead(Switch_pin))lcd.print("MANUAL");
   else lcd.print("AUTO   ");
    if(!digitalRead(Push_Button)&!state&digitalRead(Switch_pin)){
      state=1;
      set_val=cm;
      EEPROM.write(0, set_val);
      }
     if(!digitalRead(Push_Button)&!state&!digitalRead(Switch_pin)){
        state=1;
        pump=!pump;
     }
    if(digitalRead(Push_Button))state=0;
  delay(500);
}
long microsecondsToCentimeters(long microseconds) {
  return microseconds / 29 / 2;
}


Have any question realated to this Article?

Ask Our Community Members