Water Level Sensor-1
Water Level Sensor-1
Lab
Experiment No. 10
CO Mapped: CO2 LEVEL: Apply, Analyze
OBJECTIVE: To learn interfacing of water sensor and programming of Nodemcu for Blynk IoT
cloud configuration.
Theory:
Water Level Sensor is a water level sensor for Arduino or NodeMCU boards. The
obtained values are analog values. It can be used with Arduino or NodeMCU immediately. It is
used to warn of low or high water levels. This sensor has relatively high sensitivity. It can be
applied to measure rainfall, warn of water levels, etc.
Working Principle: -
The resistance of the sensor varies inversely with the height of th e water as follows:
The more “immersed” the sensor is, the better the conductivity and therefore the “lower
resistance” it will have. The less “immersion” the sensor has, the lower the conductivity will be,
and the higher the resistance will be.
The Blynk IoT Platform is an all-in-one software designed for the prototyping,
deployment, and remote management of connected devices, regardless of scale. This post will walk
you through the updated steps to help you begin upgrading your projects with Blynk.
Procedure:
3. Give Name-Water Level Sensor Click on Hardware ESP8266 and click on Done.
5. Click on Gauge setting and click on Create DataStream. Click on the Virtual Pin.
Change in PIN-> V0 and MAX-> 180 and create it. Click on Choose DataStream
and select Gauge (V0) and Save it.
7. Click on Developer Zone-> Home button and copy Template ID and Template Name.
Code
void setup()
{
char auth[] = "BeLDqQd8g25lAkePa7VylJYO-ycOyzGY";
char ssid[] = "***********";
char pass[] = "**********";
pinMode(sensorPin,INPUT);
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
int waterLevel = analogRead(sensorPin);
int output_val=map(waterLevel,0,1023,0,100);
Serial.print("Water Level:");
Serial.println(output_val);
Blynk.virtualWrite(V0, waterLevel);
Results:
Conclusion:
The real-time water level monitoring system using NodeMCU and the Blynk IoT platform. The
setup enabled wireless data transmission and user-friendly, making it an efficient and scalable solution
for smart water management.