Water Level Monitoring using ESP8266 and Arduino IoT Cloud

(Last Updated On: November 9, 2021)

Water level monitoring through Arduino IoT:

Water Level Monitoring using Nodemcu ESP8266 and Arduino IoT Cloud- Every beginner or intermediate level programmer wishes to make the water level monitoring system using Arduino or ESP8266, or ESP32, or any other controller board. I myself have made different versions of the water level monitoring system links to those articles are given below. Now day’s water wastage is very common issue in our society and also industries. Due to the advancement of technology human life has become easier and this project is also related to automation and control through which we will monitor the level of the water. The main concern of this project is to monitor the level of water through ultrasonic sensor. The sensor fetches the level information and send to NodeMCU ESP8266 which can be monitored through the Arduino IoT Cloud. As a beginner you can start with the standard HC-SR04 Distance Sensor and when you have learned the very basics then you can use the Waterproofed Ultrasonic Sensor.  This project consists of:

  • ESP8266 NodeMCU
  • Ultrasonic Sensor

Previously I built the water level monitoring system using Nodemcu ESP8266 and Blynk application; I also built the water level monitoring system using ESP32 and ToF10120 Laser Distance sensor. If you are a beginner and you are just starting with the Water level monitoring project then I highly recommend you should read my article on water level monitoring using Arduino and LEDs.

Anyways, the Arduino IoT cloud is becoming very popular and it’s far more simpler than the other IoT platforms. You can read my getting started tutorial on the Arduino IoT Cloud which explains the extreme basics.


Amazon Links:

Nodemcu ESP8266 WiFi Module:

HC-SR04 Ultrasonic Sensor:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



Ultrasonic sensor HC-SR04:

Ultrasonic Module HC-SR04 Distance Sensor can measure the distance to an object by using echo. It can measure the distance between the sensor and the object by the time from the sound wave of a specific frequency to the time when the sound wave is heard to bounce back.

HC-SR04 Ultrasonic Distance Sensor is perfect for all kind of projects that need distance measurements, e.g. avoiding obstacles. HC-SR04 provides 2cm-500cm non-contact measurement function, the ranging high accuracy can reach to 3mm.

Ultrasonic Sensor Module Working Principle:

Pull the Trig pin to high level for more than 10us impulse, the module start ranging.

The module automatically sends eight 40KHz square wave to detect whether a signal is returned.

Finished ranging, if you find an object in front, Echo pin will be high level, and based on the different distance, it will take the different duration of high level.

So we can calculated the distance easily.

The distance = ((Duration of high level)*(Sonic :340m/s))/2.

 Distance L = 1/2 × T × C

Water Level Monitoring

Technical Parameters

  1. Use voltage: DC 5V
  2. Quiescent current: less than 2mA
  3. Level output: high 5V low 0V
  4. Induction angle: no more than 15 degrees(<15°)
  5. Detection range: 0.78~196 in/ (2cm~500cm)
  6. High accuracy: up to 0.12 in/(0.3 cm)
  7. Trigger Input Pulse width: 10uS
  8. Dimensions: 1.3 x 0.4 x 0.1 inch/3.03 x 1 x 0.25 cm (L*W*H)


Circuit Diagram of water level monitoring through Arduino IoT:

As we know that the ultrasonic sensor consist of four pins which are:

  • VCC
  • Ground
  • Trig
  • Echo

The Echo pin will be used as input which will be connected with digital pin 6 and trigger pin will be connected with the digital pin 7 of the NodeMCU.

Four LEDs will be used to monitor the level of the water which will be connected with the digital pin 0, digital pin 1, digital pin 2 and digital pin 3. These LEDs will show the level high, ,medium and low.

Water Level Monitoring

After you have connected all the electronics as per the circuit diagram which you can see above. The next step is to design the application using the Arduino IoT Cloud. There are things which I have covered in the getting started tutorial and I highly recommend you should read that article otherwise you will face some issues while uploading the code. “Arduino IoT Cloud Getting Started Tutorial”.


Application design in Arduino IoT Cloud Platform:

This project is based on the Arduino IoT Cloud through which we will monitor the level of the water. In this project, we have used the gauge which will tells us the percentage of the water present in the tank whose values can be adjusted according to the size of the tank. Then we have added leds in the application which will shows us the status of the leds.

So in order to create the application we will open the Arduino IoT Cloud. First of all we will create the variables as we are using four leds so therefore we will create four variables which will be used for the leds in the application. So click on the add variable and create the variable with the name led1 and click on the add variable.

Water Level Monitoring

Similarly in the same way we will create three variables with the name led2, led3 and led4.

Then to control the gauge we will create the variable with the name water level which will shows us the percentage of the level of the water.

Water Level Monitoring


Then we will click on the add device and add the type of the device which we will be used during the creation of the device we will save the secret key which we will use in the  network creation.

Water Level Monitoring

Then we will create the network by entering the SSID, password and secret key which we have copied during the creation of the secret key.

Water Level Monitoring



Dashboard design:

Then we will click on the dash board and add the widgets which we will be using in the project. So first of all we will add the led which will be used as a status and link it to the led1 variable.

Water Level Monitoring

In the similar way we will add another three leds and link to the variables.

Water Level Monitoring

Then we will add gauge which will show us the percentage of water and link it to the water level variable.

Water Level Monitoring

So the application is created and now we will write the code. We will click on the sketch button to write code.


Water Level Monitoring Complete Code:

Then we will select the board and port and upload the code to the NodeMCU ESP8266 and we will monitor the water level on the Arduino IoT Cloud using our computer or you can also find the same application on your cell phone which is automatically generated. I have to remind you once again, read my article “Getting started with the Arduino IoT Cloud”, or you can also watch the video given below.


Arduino IoT Cloud Getting Started Tutorial:

https://youtu.be/5jl6PMYwRYA

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

%d bloggers like this: