Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
Hello geeks, welcome to our new project. Here, we are going to make a very useful project which we can use for ourselves or we can use this as a product as well on an industry level.

In this project, we are going to make a water level indicator. We all know it is one of the most essential products because there are many water tanks in every house or office, and most of them are not easily accessible to check the level of water in it and I think most of us faced the problem such as shortage of water as we do not have anything to monitor the exact amount of water available in the tank and this causes many problems on our daily lives.

Where To Buy?
No.ComponentsDistributorLink To Buy
1LEDsAmazonBuy Now
2Arduino UnoAmazonBuy Now

Software to install

As we are going to make this project in the simulation first, for that, we will use the Proteus simulation tool. It is a tool used for electronic projects in which, we can run the real-time simulation of any electronic project and we can debug it in real-time without making any damage to real components.

Proteus has a very big database for electronic components which comes in the installation package of Proteus, but still, sometimes we have to install packages or libraries for some modules which are not pre-installed in it.

As in this project, we are going to use Arduino which is not pre-installed in the Proteus software. So we can download the Arduino module package from the link given below:

Components Required

In this project, we will use the following components
  • Arduino UNO
  • LEDs
  • Water level indicator

Components details

Arduino UNO

  • Arduino UNO is an open-source microcontroller of the Arduino family.
  • We have used this as the main controller of this project.
  • Using this we can measure the readings of the water level sensor and indicate the user accordingly.
  • It has 14 digital input/output pins which can be used for controlling any digital components or can be used to read digital sensors.
  • It has 6 analog input /output pins which are used for analog read and write functions.
  • The ADC used for analog pins is 10 bits which range from 0-1023.

Note- While uploading the code on the Arduino UNO, disconnect any wire which is connected to Rx(D0) and Tx(D1) pins, otherwise it will give an error while uploading the code.

Water Level Sensor

  • The water level indicator works on the principle of the potentiometer.
  • It has three pins as Vcc, Gnd, and Signal.
  • There are two kinds of exposed copper strips on the sensor which are Vcc and sensor line.
  • When it emerges in the water tank, the conductivity increases and the resistance decreases due to that, it increases the output voltage on the sensor pin of the water level sensor.
  • The output value of the sensor changes with the height of the water level in the water tank.
  • And this gives the analog output so that we will use the analog pin of the Arduino UNO for reading the sensor value.
  • As this will have analog values, we have to calibrate the sensor before using it in the project.
  • We will talk about calibration later in the article.

LEDs

  • LED stands for light-emitting diode.
  • They are used for indication purposes in this project.
  • LEDs are like normal diodes, they will allow the current to pass from only one direction.
  • They come in different colors and the color of LEDs differs as per the used material in its manufacturing.
  • There are two terminals in the LEDs, the larger one is the cathode and another one is the anode.
  • Using the length of the terminals, we can figure out the polarity of the LED but if in case both terminals are the same size then there is a flat side on the LED, that side is the negative terminal and another is the positive terminal.

Project overview

The water level indicator works on the principle of change in the resistance of the water level sensor due to a change in the amount of water in the container.

Basically, there are two parallel strips in the water level sensor, one for the power supply and another is for the sensor strip. As we know, water is a conductor of electricity so when we increase the amount of water in the container then more length of the sensor emerges in the water and that will increase the conductivity between the strips therefore, it increases the voltage on the sensor pin as well. We will read that voltage on the Arduino UNO.

To get the exact amount of water level in the container, we have to calibrate the sensor with the water because we can not be assured that the output voltage will be the same for every water because we know that there are lots of materials dissolved in the water so it will vary for a different source of water, therefore, we have to calibrate it first.

For calibration of the sensor, we will take a container with the water and we will read the values from the sensor by changing the level of water in the container. We will perform this action till the container gets filled with water and we will note down all the reference values and mark them as thresholds for each level.

As in this project, we are making it in the simulation so it would not be possible for changing the values as per the water level therefore we have used the potentiometer and we have chosen the threshold values randomly.

No need to worry while making this project with the real components as the sensor values from the water level sensor will be in the same format as the output of the potentiometer.

Now that we know the working principle of the water level indicator let’s go for the circuit diagram of the project.

Circuit diagram

As we know the required components which we are going to use in this project.

  • First of all, start a new project in the Proteus simulation software.
  • Import all the listed components in the Proteus workspace.
  • For sensor simulation, we will import one potentiometer.
  • Connect the output pin of the potentiometer with the analog pin of the Arduino UNO. In this project, we are using the A0 pin.
  • And other pins with the ground and 5volt Vcc.
  • Now start connecting the LEDs, for controlling the LEDs, we will use the digital pins of Arduino and they are D2, D3, D4, D5 pins.
  • While connecting the LED pins, keep the sequence the same otherwise there will be an error in the indication of levels.
  • Connect the positive terminal of the LED with the digital pins of the Arduino and the negative pins with the ground.
  • Now we have completed the connection of our project. Let’s move to the coding side of this project.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project

Arduino code of water level indicator

For coding, we will use the Arduino IDE. It is a built-in IDE for Arduino developments.

Arduino code is divided into mainly three parts: declaration of function and variables, second is void setup section, and third is void loop.

First of all, declare the variables and pin number which we are going to use in this project.

  • Declare five variables for storing the pin numbers of LEDs and one variable for storing analog pins for reading the sensors.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project

Void Setup()

  • This is the most important function in Arduino programming because our code will not compile successfully without using this function in the code.
  • When Arduino code starts this is the first function that runs.
  • This function runs only once when the code restarts.
  • So here, we will write the code which requires only one time to run.
  • In this function, we will basically declare the pin modes of the pins which we will use in the project.
  • Declare the pin mode of LEDs as output mode and sensor pin as input mode. Because we want to control the LEDs so that they must be in output mode and to read data from the sensor as input then it should be declared as input mode.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project

Void loop()

  • This is the second most important function of Arduino code structure.
  • This function also must be in the code without it our code will not compile successfully.
  • In this function, we will write the main application code which we want to run continuously.
  • First of all, we will read the sensor value because we will make the decisions on the sensor values.
  • And for debugging purposes, we will print that value on the serial monitor.
  • As the sensor will give the analog output data, we will use the analogRead function for reading the sensor data.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • After reading the sensor value, set the LEDs as per the threshold which we have calculated while calibrating the sensor for each level.
  • We will divide the values into five conditions for each level we set the LEDs accordingly.
  • First, we write the condition for when the container is full then, let’s assume the value will be more than 760. Then switch on all the LEDs.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • After that, set the condition for the second level when the sensor value is lesser than 760 but greater than 720. Here we will set the 5th LED to low state and other LEDs to a high state.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Next check the condition for the third level when the sensor value is in the range of 615 to 720 and here we will set the 5th and 4th LED to low state and other LEDs to a high state.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Next check the condition for the fourth level when the sensor value lies in the range of 615 to 410. Here we will set the 3rd, 4th, 5th LEDs to low state and the rest two LEDs to a high state.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • After that, check the condition for the fifth level when the sensor value lies in the range of 410 to 250, and here we will set 5th, 4th, 3rd, 2nd LED to low state and remaining one LED to a high state.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Last check the condition for when the container is almost empty when the sensor value lies in the range of 250 to 0. Here we will set all five LEDs to a low state.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • After that give a delay of 1 second for settling of sensor values and calibration.

Results and working

Now we have completed our code and circuit, it's time to run the project.

  • To run the simulation, we have to include the hex file of the Arduino code.
  • We will generate the hex from the Arduino IDE.
  • To generate the hex file, go to the Sketch >> Export compiled binary, after that, it will compile the code and in the project folder, there will be two files one is binary and the other is hex file.
  • Now we have to include the hex file in the Arduino module in the Proteus software.
  • Click on the Arduino UNO module, then a window will pop up where you can add the hex file of the project.
  • Now we are all set to run the project, click on the Run button in the software to start the simulation.
  • To change the water level in the simulation, we will change the value on the potentiometer and as the values from the potentiometer change then the LEDs will also respond accordingly.
  • First check the condition when the water level is very low, mostly when the container is empty.
  • When the water level is very low then there will be very less conductivity or maybe no conductivity, in this case, the output voltage from the sensor will be very less.
  • So in this condition, all LEDs will be off.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • In the image, we can see that the voltage at the analog pin is 0.5 volts.
  • Now when the water level increases then in that condition the conductivity will also increase so does the output voltage from the sensor.
  • So let’s increase the water level to the first level.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Here we can see the output voltage increased to 1.5 volts and the first led is glowing.
  • Now similarly increase the water level for next levels.
  • Check water for the second level. The output voltage is iincreased to 2 volts.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Now check for the next level.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project
  • Now check for when the container is filled. Then all LEDs will glow.
Water level indicator using arduino, water level indicator project, tank water level, water level project with arduino, proteus simulation of water level indicator, water level arduino project

Conclusion

I hope we have covered all the points related to this project, and I think it will be very useful in daily life and it will give us ease of monitoring water in our water tanks. After this project, we don’t have to take the headache of how much water is available in our tank. And please let us know in the comment section if you have faced any issues while making it and also how you are going to use it in real life.

Thanks for reading this article. All the best for your projects.