Project tutorial

Fluid Level Indicator and Controller © GPL3+

A feedback control system which can control the given fluid level and display us the water level in a tank.

  • 1,002 views
  • 4 comments
  • 7 respects

Components and supplies

Apps and online services

About this project

The below diagram displays the ultrasound sensor and the Arduino. The model made was for presentation purpose only.

Introduction

Level indicator is mostly used in all industrial sectors. We can also implement the same for small scale working or domestic purposes. We have constructed a fluid level sensor which helps us to read continuous data. It gives us the value of how much fluid is occupied in the tank. The system we have created is a feedback system which not only gives us a the amount of fluid occupied but also controls it by using pump.

Construction

The above figure is a simplified block diagram of the system I have created. The Arduino is the micro controller that we are using. The ultrasound sensor HC-SR04 is connected to Arduino. The sensor is mounted on the top of the tank. I have used two submersible pumps for model. The submersible pumps are uni-directional, i.e., it can transport fluid from one direction to another only. We could use a bi-directional pump which can be operated in both directions. Both the pumps get signal from the Arduino. The pumps requires 12v to operate, therefore we have to use a motor driver too. (The motor driver is not shown in the block diagram.)

Working

For easier understanding, we'll divide the model into different sections:

  • Sensing system
  • Control system

Sensing

The sensing system has an ultrasonic sensor HC-SR04. The ultrasonic range goes above 20 kHz. This sensor has a Transmitter and a Receiver. The Transmitter produces an frequency of 40 kHz; this ultrasonic wave is bounced back from the fluid level and is received by the receiver. This sensor has 4 pins: ground is given to Arduino ground and VCC can be +3.3v or 5v. The trigger pin is used to give a trigger signal to the transmitter. The echo pin is used to receive the echo from the ultrasound. From this we get a time period of the ultrasound to produce and receive. We need to convert time into distance. The following is shown below:

 duration = pulseIn(echoPin, HIGH); 
// Calculating the distance 
distance= duration*0.034/2; 

Control System

The Arduino receives the data from the sensor and then it gives the desired signal to the pumps. We can set our given level from the code. If the level crosses the given threshold the pump in the tank is given a signal and it starts to pump the water out of the tank until its under the threshold. When the level falls below the mentioned threshold the pump in the reservoir starts pumping fluid to the tank. The tank and only one pump will be used.

Future Improvements

We can improve the efficiency of the project by the following:

  • We can use a bi-directional pump which can be located outside the tank, then only one pump have to be used.
  • We can display the result on an OLED or on a LCD screen.
  • We can also store data on cloud if connected to IOT.
  • We can control the fluid level and also check the fluid level from an application if connected to IOT.
  • We can also provide a safety buzzer when the tank overflows, we can also modify the code to avoid overflow of the tank.

Schematics

water_level_bb_joEgADwfHj.jpg
Water level bb joegadwfhj

Code

water level controllerArduino
int tankPump=3;
int reserviorPump=2;
int trigPin = 9;//white
int echoPin = 10;//brown
long duration;
int distance;


void setup(){
  Serial.begin(9600);
  pinMode(tankPump,OUTPUT);
  pinMode(reserviorPump,OUTPUT);
 pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
}

void loop(){
ultrasound();
pump();
}

void ultrasound(){
  
  digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
Serial.print("Distance:");
Serial.println(distance);
delay(1000);
}


void pump(){
  if (distance > 10){
    digitalWrite(tankPump,HIGH);
  digitalWrite(reserviorPump,LOW);
  }
  else{
    digitalWrite(tankPump,LOW);
  }
  if(distance < 6){
    digitalWrite(reserviorPump,HIGH);
    digitalWrite(tankPump,LOW);
  }
  else{
    digitalWrite(reserviorPump,LOW);
 }
 }

Comments

Similar projects you might like

Development Board for AtTiny MCU

by Vincenzo G.

  • 197 views
  • 0 comments
  • 6 respects

Version 2.0 Advanced Attendance System (Without Ethernet)

Project tutorial by GadgetProgrammers

  • 3,237 views
  • 5 comments
  • 46 respects

The Magnetic Field and RGB Tester

Project tutorial by Kutluhan Aktar

  • 498 views
  • 0 comments
  • 6 respects

How To Use DS18B20 Water Proof Temperature Sensor

Project showcase by IoTBoys

  • 291 views
  • 0 comments
  • 4 respects

Control LED Using Your Voice Command

by IoTBoys

  • 1,253 views
  • 1 comment
  • 12 respects
Add projectSign up / Login