Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
37 views1 page

System Monitoring and Controlling Water Level

The document describes an Arduino-based system for monitoring and controlling water levels using sensors and an LCD display. It includes code that reads the water level from three sensors, activates corresponding LEDs, and controls a motor based on the detected water level. The system categorizes the water level as HIGH, AVERAGE, LOW, or NO WATER and displays this information on the LCD.

Uploaded by

Farhan Hariz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

System Monitoring and Controlling Water Level

The document describes an Arduino-based system for monitoring and controlling water levels using sensors and an LCD display. It includes code that reads the water level from three sensors, activates corresponding LEDs, and controls a motor based on the detected water level. The system categorizes the water level as HIGH, AVERAGE, LOW, or NO WATER and displays this information on the LCD.

Uploaded by

Farhan Hariz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

System Monitoring And Controlling Water Level

//source: https://www.electroschematics.com/9964/arduino-water-level-sensor/
#include
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
byte sensorPin[] = {8, 9, 10};
byte ledPin[] = {11, 12, 13}; // number of leds = numbers of sensors
const byte sensors = 3;
int level = 0;
int motor = A4;

void setup() {
for(int i = 0; i < sensors; i++) {
pinMode(sensorPin[i], INPUT);
pinMode(ledPin[i], OUTPUT);
}
pinMode(motor, OUTPUT);
lcd.begin(16, 2);
}

void loop() {
level = 0;
for(int i = 0; i < sensors; i++) {
if(digitalRead(sensorPin[i]) == LOW) {
digitalWrite(ledPin[i], HIGH);
level = sensors - i;
} else {
digitalWrite(ledPin[i], LOW);
}
}
lcd.clear();
lcd.print("Water level");
lcd.setCursor(0,1);
switch(level) {
case 1:
lcd.print("HIGH");
digitalWrite(motor, HIGH);
break;
case 2:
lcd.print("AVERAGE");
digitalWrite(motor, LOW);
break;
case 3:
lcd.print("LOW");
digitalWrite(motor, LOW);
break;
default:
lcd.print("NO WATER");
digitalWrite(motor, LOW);
break;
}
delay(50);
}

You might also like