Water Level Sensor

Water Level Sensor

Introduction

In this experiment, we will use a water level sensor to detect the presence of water at various levels in a container. This sensor can be useful in applications such as automatic water level control in tanks.

Water Level Sensor

Components Needed

Circuit Setup

  1. Connect the VCC pin of the water level sensor to the 5V pin of the Arduino.
  2. Connect the GND pin of the sensor to the GND pin of the Arduino.
  3. Connect the Signal (S) pin of the sensor to pin A0 on the Arduino.

Check the connections and ensure the sensor is positioned in a water container.

Water Level Sensor Circuit Setup

Code for Water Level Sensor

Upload the following code to your Arduino to read the water level:


const int sensorPin = A0; // Pin connected to the water level sensor
void setup() {
    Serial.begin(9600); // Start serial communication
}
void loop() {
    int sensorValue = analogRead(sensorPin); // Read the sensor value
    Serial.println(sensorValue); // Display the water level in the Serial Monitor
    delay(500); // Delay for stability
}
            

Explanation

The sensor detects the water level based on electrical conductivity. The analog value is read by the Arduino and displayed on the Serial Monitor, indicating the water level.

Troubleshooting