Devices & Components
Arduino Uno Rev3
Water Level Sensor Depth of Detection Water Sensor for Arduino
Software & Tools
Arduino IDE
Project description
Code
Program of Water Level Sensor with Arduino UNO R3
arduino
1//Coded and Tested By: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher 3 4int value = 0; // holds the value 5int data = A0; // sensor data pin used 6 7void setup() { 8 9 pinMode(data, INPUT); 10 Serial.begin(9600); //start the serial console 11} 12 13void loop() { 14 15 value = analogRead(data); //Read data from analog pin and store it to value variable 16 17 if (value<=100) 18 { 19 Serial.println("Water Level: Empty"); 20 } 21 else if (value>100 && value<=400) 22 { 23 Serial.println("Water Level: Low"); 24 } 25 else if (value>400 && value<=450) 26 { 27 Serial.println("Water Level: Medium"); 28 } 29 else if (value>450){ 30 Serial.println("Water Level: High"); 31 } 32 delay(1000); 33}
Program of Water level Sensor (Plotter) with Arduino UNO R3
arduino
1//Coded and Tested By: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher 3 4const int sensorPin= A0; //sensor pin connected to analog pin A0 5int liquid_level; 6 7void setup() { 8 Serial.begin(9600); //sets the baud rate for data transfer in bits per second 9 pinMode(sensorPin, INPUT);//the liquid level sensor will be an input to the arduino 10} 11 12void loop() { 13 liquid_level= analogRead(sensorPin); //arduino reads the value from the liquid level sensor 14 Serial.println(liquid_level);//prints out liquid level sensor reading 15 delay(3000);//delays 3 Seconds 16}
Program of Water Level Sensor with Arduino UNO R3
arduino
1//Coded and Tested By: 2//Sheekar Banerjee, AI-ML-IOT Solution Engineer and Researcher 3 4int value = 0; // holds the value 5int data = A0; // sensor data pin used 6 7void setup() { 8 9 pinMode(data, INPUT); 10 Serial.begin(9600); //start the serial console 11} 12 13void loop() { 14 15 value = analogRead(data); //Read data from analog pin and store it to value variable 16 17 if (value<=100) 18 { 19 Serial.println("Water Level: Empty"); 20 } 21 else if (value>100 && value<=400) 22 { 23 Serial.println("Water Level: Low"); 24 } 25 else if (value>400 && value<=450) 26 { 27 Serial.println("Water Level: Medium"); 28 } 29 else if (value>450){ 30 Serial.println("Water Level: High"); 31 } 32 delay(1000); 33}
Downloadable files
Circuit Diagram of Water Level Sensor with Arduino UNO R3
Circuit Diagram of Water Level Sensor with Arduino UNO R3

Circuit Diagram of Water Level Sensor with Arduino UNO R3
Circuit Diagram of Water Level Sensor with Arduino UNO R3

Comments
Only logged in users can leave comments