Techatronic
Published

Water Level Indicator Using NodeMCU

This project is about the water level indicator which we made using nodemcu and water level sensor.

BeginnerFull instructions provided2 hours8,507
Water Level Indicator Using NodeMCU

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
water level sensor
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×3
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
5 mm LED: Red
5 mm LED: Red
×1
5 mm LED: Green
5 mm LED: Green
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
SparkFun RGB LED Breakout - WS2812B
SparkFun RGB LED Breakout - WS2812B
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Code snippet #1

Plain text
 // TECHATRONIC.COM  
 int val = 0 ;  
 void setup()  
 {  
   Serial.begin(9600); // sensor buart rate  
   pinMode(14,HIGH);  // Red led Pin Connected To D5 Pin   
   pinMode(13,HIGH);  // Green Led Pin Connected To D7 Pin   
   pinMode(12,HIGH);  // Yellow Led Connected To D6 Pin    
 }  
 void loop()   
 {  
  int s1=analogRead(A0); // Water Level Sensor output pin connected A0  
  Serial.println(s1);  // See the Value In Serial Monitor     
  delay(100);      // for timer  
  if(s1> 400 )  
   {   
    digitalWrite(14,HIGH);   // Red led ON   
   }   
  else   
   {   
   digitalWrite(14,LOW);    // Red led OFF  
   }   
  if(s1>540 )   
   {   
   digitalWrite(12,HIGH);   // Green led ON   
   }  
   else   
   {   
   digitalWrite(12,LOW);   // Green led OFF   
   }   
   if(s1>580 )   
   {  
   digitalWrite(13,HIGH);  // Yellow led ON   
   }  
   else  
   {  
   digitalWrite(13,LOW);  // Yellow led OFF   
   }  
  }  

Code snippet #2

Plain text
 // TECHATRONIC.COM  
 int val = 0 ;  
 void setup()  
 {  
   Serial.begin(9600); // sensor buart rate  
   pinMode(14,HIGH);  // Red led Pin Connected To D5 Pin   
   pinMode(13,HIGH);  // Green Led Pin Connected To D7 Pin   
   pinMode(12,HIGH);  // Yellow Led Connected To D6 Pin    
 }  
 void loop()   
 {  
  int s1=analogRead(A0); // Water Level Sensor output pin connected A0  
  Serial.println(s1);  // See the Value In Serial Monitor     
  delay(100);      // for timer  
  if(s1> 400 )  
   {   
    digitalWrite(14,HIGH);   // Red led ON   
   }   
  else   
   {   
   digitalWrite(14,LOW);    // Red led OFF  
   }   
  if(s1>540 )   
   {   
   digitalWrite(12,HIGH);   // Green led ON   
   }  
   else   
   {   
   digitalWrite(12,LOW);   // Green led OFF   
   }   
   if(s1>580 )   
   {  
   digitalWrite(13,HIGH);  // Yellow led ON   
   }  
   else  
   {  
   digitalWrite(13,LOW);  // Yellow led OFF   
   }  
  }  

Code snippet #3

Plain text
 // TECHATRONIC.COM  
 int val = 0 ;  
 void setup()  
 {  
   Serial.begin(9600); // sensor buart rate  
   pinMode(14,HIGH);  // Blue led Pin Connected To D5 Pin   
   pinMode(13,HIGH);  // Red Led Pin Connected To D7 Pin   
   pinMode(12,HIGH);  // Green Led Connected To D6 Pin    
 }  
 void loop()   
 {  
  int s1=analogRead(A0); // Water Level Sensor output pin connected A0  
  Serial.println(s1);  // See the Value In Serial Monitor     
  delay(100);      // for timer  
  if(s1>400 && s1<500 )  
   {   
    digitalWrite(14,HIGH);   // Blue led ON   
   }   
  else   
   {   
   digitalWrite(14,LOW);    // Blue led OFF  
   }   
  if(s1>500 && s1<550 )  
   {   
   digitalWrite(12,HIGH);   // Green led ON   
   }  
   else   
   {   
   digitalWrite(12,LOW);   // Green led OFF   
   }   
   if(s1>550 )   
   {  
   digitalWrite(13,HIGH);  // Red led ON   
   }  
   else  
   {  
   digitalWrite(13,LOW);   // Red led OFF   
   }  
  }  

Code snippet #4

Plain text
 // TECHATRONIC.COM  
 int val = 0 ;  
 void setup()  
 {  
   Serial.begin(9600); // sensor buart rate  
   pinMode(14,HIGH);  // Blue led Pin Connected To D5 Pin   
   pinMode(13,HIGH);  // Red Led Pin Connected To D7 Pin   
   pinMode(12,HIGH);  // Green Led Connected To D6 Pin    
 }  
 void loop()   
 {  
  int s1=analogRead(A0); // Water Level Sensor output pin connected A0  
  Serial.println(s1);  // See the Value In Serial Monitor     
  delay(100);      // for timer  
  if(s1>400 && s1<500 )  
   {   
    digitalWrite(14,HIGH);   // Blue led ON   
   }   
  else   
   {   
   digitalWrite(14,LOW);    // Blue led OFF  
   }   
  if(s1>500 && s1<550 )  
   {   
   digitalWrite(12,HIGH);   // Green led ON   
   }  
   else   
   {   
   digitalWrite(12,LOW);   // Green led OFF   
   }   
   if(s1>550 )   
   {  
   digitalWrite(13,HIGH);  // Red led ON   
   }  
   else  
   {  
   digitalWrite(13,LOW);   // Red led OFF   
   }  
  }  

Credits

Techatronic
72 projects • 127 followers
Electronic engineer

Comments