Contents

Interfacing XKC-Y26-V Non-contact Liquid Level Sensor with Arduino

XKC-Y26-V Non-contact Liquid Level Sensor Features

The XKC-Y26-V Non-Contact Liquid Level Sensor is a digital output sensor that detects the presence of liquid. There is an LED on the module, which will turn on if liquid is detected, otherwise it turns off. There is also a screw on the body of the module that you can use to adjust the sensitivity of the sensor. This sensor is suitable for dangerous applications such as detection of toxic substances, strong acids, strong alkalis, etc.

XKC-Y26-V Non-contact Liquid Level Sensor Pinout

This Module has 4 wires:

  • VCC: Module power supply – 5V to 24V – Brown
  • OUT: Sensor Output – Yellow
  • GND: Ground – Blue
  • Mode: Mode pin (If it is Low, the output will be Active Low and if it is High, output will be Active High. If it is not connected, the output remains Active High)

You can see the pinout of this module in the image below.

Required Materials

Hardware Components

Arduino UNO R3 × 1
XKC-Y26-V Non-contact Water Liquid Level Sensor × 1
Male to Male jumper wire × 1

Software Apps

Arduino IDE

Interfacing XKC-Y26-V Non-contact Liquid Level Sensor with Arduino

Step 1: Circuit

The following circuit show how you should connect Arduino to XKC-Y26-V sensor. Connect wires accordingly.

Step 2: Code

Upload the following code to your Arduino. After that, open Serial Monitor.

   /*
  Made on Jan 12, 2020
  By MehranMaleki @ Electropeak
  
Home
*/ #define Liquid_Detection_Pin 2 //Output pin on sensor void setup() { Serial.begin(9600); pinMode(Liquid_Detection_Pin, INPUT); } void loop() { if (digitalRead(Liquid_Detection_Pin)) { Serial.println("Liquid Detected!"); } else { Serial.println("No Liquid!"); } delay(1000); }

In the code above, the digital output will be checked every second and the detection or non-detection of liquid appears in the Serial Monitor.

The output is as follows:

Liked What You See?​
Get Updates And Learn From The Best​

Comments (6)

  • Luka Weber Reply

    Hi, thanks for this tutorial, great! Can you please support me with my little different setup? I have a water container 500lt, 1.7m high, and I will control the waterpump with TWO of the Level Sensors, one for the top water level and one for the bottom water level. The waterpump is 80 meters away at the water well, and there is a relais installed and a 3-wire cable between.

    The system should act like:
    – if the bottem level is reached (no water) -> 220V external Water pump goes on (via relais)
    – if the top level is reached with water: -> 220V Water pump stops
    How does the Circuit looks like? Can I connect 2 water level sensors to 1 ardunio board? How does the code looks like I have to use?
    Thank you VERY MUCH! Greetings from Italy, Luka

    PP: Your link to the Male to male jumper does not function

    April 13, 2025 at 7:13 pm
    • Mohammad Damirchi Reply

      Hello Luka,
      We have some Water Level Controller Module you can buy and use directly without any coding.
      But if you want to use Arduino for this project, you can connect both sensors to digital pins on the Arduino. Then use the digitalRead() command to check each sensor’s state. Based on which one is active, you can set another pin HIGH or LOW to control your Relay Module accordingly.

      April 15, 2025 at 6:13 am
  • Luka Weber Reply

    Hello Mohammad, thanks for the friendly and fast replay. Great! I do NOT want to use Arduino. In this case I just need:
    1x XH-M203 Automatic Water Level Controller Module
    2x Y26-V Non-contact Water Liquid Level Sensor
    right?
    If I order it, can you provide me with the wire diagram for this setup (1 controller/2sensors)?
    Many thanks, Luka

    April 15, 2025 at 8:25 pm
    • Mohammad Damirchi Reply

      Hi,
      You can get information about running the first type of Automatic Water Level Controller Module from this link

      April 16, 2025 at 11:25 am
  • Luka Weber Reply

    thanks Mohammad, helpful documentation! One last question: can I use an other Level Sensor instad of P100 Liquid Level Sensor? f.e. XKC-Y26-V Non-contact Liquid Level Sensor, you have mentioned above? I don’t like to use a sensor in the watertank. Again, many thanks, Luka

    April 16, 2025 at 7:01 pm
    • Mohammad Damirchi Reply

      My pleasure, Luka – happy to help!
      I’ve tested the M04 Non-Contact Liquid Level Module with this system, and it works properly.
      When using this type of sensor, make sure to locate the GND pin on the sensor side of the Automatic Water Level Controller Module. Connect the sensor’s output pin to the appropriate input on the controller, and you can power the sensor using the same power supply as the controller.
      Important note: All modules must share a common GND connection.

      April 20, 2025 at 6:10 am

Leave a Reply

Your email address will not be published. Required fields are marked *