Another illustration how to wire and build a simple water level, rainfall, leakage & water overflow detection. As you can see the first diagram below its uses a water sensor module which can be plug easily or build your own water sensor. The water sensor detects water by having a series of exposed traces connected to ground and interlaced between the grounded trace. The sensor trace has a week pull-up resistor of 1M ohms. The resistor will pull the sensor trace value of HIGH until a drop of water shorts the sensor to the grounded trace with the digital IO pins of the Microcontroller you can detect the amount of water induced contact between the grounded and sensor trace.
Required Component
- Arduino UNO, MEGA, NANO, PRO, DEU, LEO Microcontroller, ESP8266 ( Arduino IDE Integrated )
- Water Sensor Module
- Jumper Wire / DuPont Wires
- Solderless Breadboard
Wiring Diagram for Water Detection
Sketch Code
1 |
14CORE | Test Code for Water Detection Sensor const int LedOutput = 5; const int WaterSensor = 13; void setup() { pinMode(LedOutput,OUTPUT); pinMode(WaterSensor,INPUT); } void loop() { if(!digitalRead(WaterSensor)){ digitalWrite(LedOutput,HIGH); } else{ digitalWrite(LedOutput,LOW); } } |
Wiring Diagram for Flood, Water Level Indicator
Sketch Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
// Water Level const int level1 = 5; const int level2 = 6; const int level3 = 7; const int level4 = 8; //Alarm int alarm = 3; //Light Indicator int InLight1 = 10; int InLight2 = 11; int InLight3 = 12; int InLight4 = 13; void setup(){ pinMode(alarm, OUTPUT); // Set Alarm/Buzzer as Output pinMode(InLight1, OUTPUT); // Set Light 1 Indicator as Output pinMode(InLight2, OUTPUT); // Set Light 2 Indicator as Output pinMode(InLight3, OUTPUT); // Set Light 3 Indicator as Output pinMode(InLight4, OUTPUT); // Set Light 4 Indicator as Output pinMode(level1, INPUT); // Set sensor 1 as input pinMode(level2, INPUT); // Set sensor 2 as input pinMode(level3, INPUT); // Set sensor 3 as input pinMode(level4, INPUT); // Set sensor 4 as input } void loop(){ if(! digitalRead(level1)){ digitalWrite(InLight1, 1); } else{ digitalWrite(InLight1, 0); } if(! digitalRead(level2)){ digitalWrite(InLight2, 1); } else{ digitalWrite(InLight2, 0); } if(! digitalRead(level3)){ digitalWrite(InLight3, 1); } else{ digitalWrite(InLight3, 0); } if(! digitalRead(level4)){ digitalWrite(InLight4, 1); digitalWrite(alarm, 1); } else{ digitalWrite(InLight4, 0); digitalWrite(alarm, 0); } delay(500); } |
Wiring Water Level, Rainfall, Leakage, Flood Meter Sensor with Arduino Microcontroller