Water Level/Depth sensor | ESP8266 | NodeMCU

Water Level Sensor interfacing with ESP8266


In this tutorial, we will discus about water level sensor and determine how to connect it to a ESP 8266 for measuring water level in a jar.



Water flow sensor contains traces arranged side by side intervened. These are power and sense traces. 
It has 3 terminals. S + and -. S provides an analog signal which can be connected to ADC pin in a  micro controller and use the readings to measure threshold. When this sensor is immersed in water containing minerals, when sensor is powered the power traces becomes conductive. The more the sensor is in water the less resistance it will have. You can think of the sensor as a potentiometer.  When sensor is dry the resistance is maximum. 

Now lets test calibrate this sensor in a jar. 


Connections
ESP8266                Water level sensor
    A0                                    S
    3.3V                                 +
    Gnd                                  -

Setup



Code
int sensorPin = A0; 
int sensorValue = 0;

void setup() {
  Serial.begin(115200);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  Serial.print("Sensor returned value is ");
  Serial.println(sensorValue);
  delay(10000);
}

First lets calibrate with no water. 



Now lets fill jar with half water. 


Now lets fill it with full water


Now you can use these values as thresholds to estimate water level.

Trouble shooting
1. Do not fill water to immerse complete sensor. Water to be filled only till traces are immersed.
2. Water needs to contain some minerals for conductivity.

Comments

Popular posts from this blog

1 channel power relay module with adjustable timing cycle explained | HCW-M421

Microphone Sound Sensor explained | HW-484 | Interfacing with ESP 8266

ESP 01 Programming Made easy | Arduino IDE | USB to UART CH340 Tutorial | IOT first step