How to use XKC-Y25-V Liquid Sensor with Arduino


In this post, we introduce How to use XKC-Y25-V Liquid Sensor with Arduino, a remarkable device based on capacitance detection technology. This innovative sensor simplifies the process of liquid detection by allowing you to discern the presence of liquids merely by bringing the sensor in proximity to a container.

Hardware Required

You will require the following Hardware Components for interfacing the XKC-Y25-V Liquid Sensor with Arduino.

Components#Buy From Amazon
Arduino UNO1Buy Link
XKC-Y25-V Liquid Sensor1Buy Link
LED 5mm1Buy Link
9v DC Adapter (Optional)1Buy Link
Jumper WiresFewBuy Link
Breadboard1Buy Link

What is the XKC-Y25-V Liquid Sensor?

The XKC-Y25-V is a liquid level sensor designed to detect the presence or absence of various liquids. Its simple yet effective design makes it an invaluable tool for applications ranging from water-level monitoring to the prevention of liquid spillages. But what makes it stand out in the sea of sensors?

Pinout of XKC-Y25-V Liquid Sensor


Pin Configuration of XKC-Y25-V Liquid Sensor

Pin NamePin Type
VCCPositive supply Pin
GNDGround Pin
OUTIt can have the output at a high level (equal to the input voltage) or low (zero)
MODEWhen you connect the MODE pin high, you will have the same value as the input voltage at the output


  • Material Compatibility: Crafted from corrosion-resistant materials, ensuring durability in contact with different liquids.
  • Detection Range: The sensor boasts a versatile detection range, making it suitable for both high and low liquid levels.
  • Indicator LED: A built-in LED provides a visual cue when the sensor detects the presence of liquid.
  • Simple Interface: With just three pins, integrating the XKC-Y25-V into your Arduino project is a breeze.
  • Wide Voltage Range: The sensor operates within a broad voltage range, enhancing its compatibility with various Arduino boards.


  • Compact Design: The XKC-Y25-V’s compact form factor allows for easy integration into confined spaces.
  • Adjustable Sensitivity: Fine-tune the sensor’s sensitivity to match the characteristics of the liquid you’re working with.
  • Indicator LED Control: Use the indicator LED not just for signaling detection but also as part of your project’s visual feedback system.
  • Quick Response Time: The sensor reacts swiftly to changes in liquid levels, ensuring real-time monitoring.
  • Versatile Applications: From water tanks to automated beverage dispensers, the XKC-Y25-V adapts to diverse liquid-sensing needs.

Circuit Diagram

The following circuit shows you the connection of the Project, How to use XKC-Y25-V Liquid Sensor with Arduino Please make the connection carefully


Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow


//For more Projects:

#define pinobuzzer 7
#define pin sensor 5

int value;

void setup()
  pinMode(7, OUTPUT);
  pinMode(5, INPUT_PULLUP);

void loop()
  //Reads the liquid sensor
  value = digitalRead(pinosensor);

  //If it is 0, activate the buzzer
  if (value <= 0)
    digitalWrite(pinobuzzer, HIGH);
    digitalWrite(pinobuzzer, LOW);

  //Shows the sensor value in the Serial Monitor
  Serial.print("Sensor: ");

  //Wait 200ms and repeat the process


  • Smart Plant Watering System: Keep your plants thriving by creating an automated watering system that triggers when soil moisture levels drop.
  • Leak Detection Alarm: Safeguard your home by setting up a leak detection system that alerts you the moment liquid is detected.
  • Fish Tank Water Level Monitor: Ensure your aquatic friends swim in the right conditions by monitoring and maintaining the water level in your fish tank.
  • Hydroponic System Control: Optimize your hydroponic setup by integrating the XKC-Y25-V to monitor nutrient levels and ensure a healthy growth environment for your plants.


As your XKC-Y25-V Liquid Sensor takes its place in your Arduino project, envision the possibilities it unlocks. From alerting you about a full water tank to preventing liquid spillage, this sensor is a silent guardian, ensuring that your projects sail smoothly on the waves of liquid awareness. So, dive in, experiment, and let the XKC-Y25-V bring a new tide of functionality to your Arduino endeavors.

Leave a Comment