Blog

Water Level Depth Detection Sensor

Water Level Depth Detection Sensor

Liquid Measurement for Arduino and IoT Projects

Introduction

The Water Level Depth Detection Sensor is a reliable tool for measuring liquid levels in tanks, wells, and other containers. Using exposed parallel traces, it measures water levels through conductivity with a simple analog output that varies with immersion depth.

Water Level SensorKey Features

💧 Depth Measurement

Measures water level up to 40cm (depending on model)

🔌 Simple Interface

Analog output proportional to water level

Low Power

Operates at 3.3V-5V with minimal current draw

🔧 Easy Installation

Mounts vertically with standard bolts

Technical Specifications

Operating Voltage 3.3V – 5V DC
Output Signal Analog (0-VCC)
Measurement Range Up to 40cm (model dependent)
Current Consumption <20mA
Operating Temperature 10°C – 30°C (for optimal performance)
PCB Material FR4 with gold-plated contacts
Dimensions 60mm × 20mm × 5mm (typical)

Pin Configuration

Water Sensor Pinout
Pin Label Description Arduino Connection
1 VCC Power (3.3V-5V) 5V
2 GND Ground GND
3 OUT Analog output A0
Note: The sensor should be mounted vertically with sensing traces facing downward

Wiring with Arduino

// Basic Connections:
// VCC → 5V
// GND → GND
// OUT → A0 (analog input)

// For best results:
// - Keep sensor vertical
// - Avoid touching the sensing traces
// - Calibrate with known water levels
Important: Do not expose the electronics (top portion) to water – only the sensing traces should be submerged

Basic Water Level Example

// Water Level Sensor Basic Example
const int sensorPin = A0;

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

void loop() {
  int sensorValue = analogRead(sensorPin);
  
  // Convert analog reading to voltage
  float voltage = sensorValue * (5.0 / 1023.0);
  
  Serial.print("Sensor Value: ");
  Serial.print(sensorValue);
  Serial.print(" | Voltage: ");
  Serial.print(voltage);
  Serial.println("V");
  
  delay(1000);
}

Advanced Features

Depth Calibration

// Convert readings to depth (cm)
float readDepth() {
  int raw = analogRead(sensorPin);
  // Calibration values (adjust based on your sensor)
  float depth = map(raw, 0, 1023, 0, 40); // 40cm max depth
  return constrain(depth, 0, 40);
}

Low Water Alarm

// Check for low water level
bool checkLowLevel() {
  int threshold = 200; // Adjust based on your setup
  return analogRead(sensorPin) < threshold;
}

void loop() {
  if (checkLowLevel()) {
    digitalWrite(ALARM_PIN, HIGH);
  }
}

Moving Average

// Smooth readings with moving average
const int numReadings = 10;
int readings[numReadings];
int index = 0;

int smoothReading() {
  readings[index] = analogRead(sensorPin);
  index = (index + 1) % numReadings;
  
  int total = 0;
  for (int i = 0; i < numReadings; i++) {
    total += readings[i];
  }
  return total / numReadings;
}

Percentage Calculation

// Calculate tank percentage full
float getPercentage() {
  int dryValue = 50;   // Sensor value when dry
  int wetValue = 800;  // Sensor value when fully submerged
  
  int raw = analogRead(sensorPin);
  float percent = map(raw, dryValue, wetValue, 0, 100);
  return constrain(percent, 0, 100);
}

Troubleshooting

No Output Change

  • Check water is contacting the sensing traces
  • Verify wiring connections
  • Ensure power supply is adequate

Inconsistent Readings

  • Clean sensing traces (mineral buildup)
  • Implement software smoothing
  • Check for water turbulence

Corrosion Issues

  • Consider gold-plated sensors for harsh environments
  • Apply conformal coating (except sensing area)
  • Use in clean water when possible