ESP8266IOT Projects

IOT Water level monitoring using Ultrasonic Sensor

IoT Water Level Monitoring:

 

IOT Water level monitoring using Ultrasonic Sensor- In today’s tutorial, you will learn how to make an IoT water level monitoring system using the HC-SR04 ultrasonic sensor, Nodemcu esp8266 wifi module, and Blynk application. This project is based on two-way communication, you can monitor the Water level in real-time and you can also control the water pump. The lamp indicator represents the water pump.

You might be wondering, why am I using the Arduino board with the Nodemcu ESP8266, if the same thing can be done using only the Nodemcu module. Well, in this tutorial, my main concern is to also explain how you can do Serial communication between the Arduino and Nodemcu Module.

allpcb circuit

 This is the 2nd version of the water level monitoring system. While in version 1 of the water level monitoring system I used only the LEDs to show the percentage of water available in the Water tank. As today’s episode is based on version 1,  so I highly recommend you should watch my previous tutorial on the water level monitoring system using led’s , because in this episode I will only explain the modifications.  This Tutorial covers

  1. Complete circuit diagram explanation.
  2. Blynk Application designing
  3. Arduino and Nodemcu programming and finally
  4. Testing

You can also ready my article on IoT based Water level monitoring and automatic water pump control system using the ESP32 WiFi + Bluetooth Module, Waterproof Ultrasonic Sensor, and the New Blynk V2.0 more…

read my article on Wireless water level indicator “communication range 1.5Km.


Amazon Links:

12v Adaptor:

HC-SR04 Ultrasonic Sensor:

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.


Circuit Diagram:

iot water level

Circuit Diagram of the IoT water leveling monitoring system

This circuit is designed in Cadsoft eagle 9.1.0 version. if you want to learn how to make a schematic and PCB then watch my tutorial. As you can see the circuit diagram of the water level monitoring system is really simple. The trigger pin of the ultrasonic sensor is connected with pin number 7 of the Arduino. While the echo pin of the ultrasonic sensor is connected with pin number 6 of the Arduino. The VCC and GND pins of the ultrasonic sensor are connected with the Arduino’s 5v and ground pins. LED3 to LED7, These are the 5 led’s which will be used to display the percentage of water available in the water tank. The first led will show 20 %, the second led will show 40% and so on. So the last led will show 100%.  These are the current limiting resistors which are connected in series with these 2.5v LEDs. These LEDs are connected with the Arduino’s analog pins A0 to A4…

The circuit in the upper left corner is the 5v regulated power supply based on the lm7805 voltage regulator. This 5v power supply will be used to power up the Nodemcu esp8266 wifi module. Two 470 UF capacitors are connected at the input and output of the 7805 voltage regulator. A 330-ohm resistor is connected in series with the led. This is a current limiting resistor.  J1 is the dc female power jack where you can connect a 12v adaptor or battery. A wire from the output of the voltage regulator is connected with the Vin pin of the Nodemcu module.

The tx and Rx pin’s of the Nodemcu are connected with pin2 and pin3 of the Arduino. So the Nodemcu will communicate serially with the Arduino through pin2 and pin3. Pin2 is the Rx and pin3 is the tx, which will be defined in the programming using the software serial library.

This is a 12v SPDT type relay which will be used to control the water pump. But for the demonstration purposes, I will connect an indicator lamp. This relay will be controlled using pin number 13 of the Arduino.


Note: this old version of the Blynk app is no more functional. For the blynk mobile App setup and Blynk.cloud dashboard setup ready my article on the New Blynk V2.0. In this article I have explained how to migrate your projects from Blynk 1.0 to the new Blynk V2.0. You can also watch the video.

Blynk application for the water level monitoring:

IoT water level monitoring system, Blynk application designing

First of all, open the Blynk application…..

iot water level

set the project name as Water tank…..

iot water level

Click on the choose device and select nodemcu….

iot water level

make sure you set the connection type to wifi….

iot water level

then click on the create button…

iot water level

an authentication token will be sent on your email id, which will be then used in the programming, simply copy and paste it in programming …

iot water level

iot water level

iot water level

Now click on the screen and search for the level v widget and add it…..

iot water level

Click on the level v widget set the title as water level.

iot water level

now click on the pin and select virtual pin v2…

set the minimum value to 60 and maximum value to 0…

iot water level

then click on the push and select 1 second….

now again click on the screen and this time add the numeric input…

Click on the numeric input and set the title as water pump…

now click on the pin and select virtual pin v10…

iot water level

you can change the font size if you want, let’s select the large type…

set the minimum value to 10 and the maximum value to 11…

iot water level

so now our Blynk application is ready.

Iot water level Programming:

For the step by step program explanation watch video Tutorial given at the end of this article.

Water Level Monitoring Arduino Programming:


IoT water level monitoring system Nodemcu Programming:

Watch Video Tutorial:

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...

Related Articles

12 Comments

  1. Hi Sir Good Afternoon i am trying to interface the water level sensor using Arduino nano for harvesting the fish Aquarium automatic water level detecting and filling the water below average of water but, the tank depth was 45CM the sensor size only the 5 cm how to apply the same application using long height sensor OR if any chance to increase the size of sensor please reply this question sir thank you

    1. Ultrasonic Sensor has a long detection range. You can watch my other tutorial on water level monitoring system in which I have used LEDs for different levels. that tutorial will help you.

  2. Hi Sir Good Afternoon i am trying to interface the water level sensor using Arduino nano for harvesting the fish Aquarium automatic water level detecting and filling the water below average of water but, the tank depth was 45CM the sensor size only the 5 cm how to apply the same application using long height sensor OR if any chance to increase the size of sensor please reply this question sir thank you

  3. Hi, sir, I have tried your 1st water level indicator by pro mini. I have used only 3 nos of led for testing purposes. But it indicates only one led out of three led. The other two led indicates but very very dim and o/p voltage of Arduino for this two is 0.15 volt during on condition. Where’s 3.4 volt o/p of 1st led during on condition. The all three led off condition Arduino o/p is 0 voult. I have change by another new pro mini but same thing happened. Checked every loose connection but not found. I have upload the program to pro mini by uno. After uploading the tx led of uno is glowing continuesly. Now without your help I can’t compete this project. …… Susabhan.

  4. Hello, I’m trying to get more decimal places in my reading. Will changing “int distance” to a float do this? Is there anywhere in the code where changes would be needed aside from the first declaration I mentioned?

    Thanks!

  5. Saya mencoba nya tapi terdapat error di proram arduino Uno nya pesan error ‘getValue’ was not declared in this scope

  6. Arduino: 1.8.14 Hourly Build 2020/12/15 11:33 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

    water_level_test:7:25: fatal error: SimpleTimer.h: No such file or directory

    #include <SimpleTimer.h>

                         ^
    

    compilation terminated.

    exit status 1

    SimpleTimer.h: No such file or directory

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

Leave a Reply

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

Back to top button