Component guide · Beginner · 4 min read
XKC-Y25 and XKC-Y26 Non-Contact Liquid Level Sensor

NPN, PNP and Wiring
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
The XKC-Y25 and XKC-Y26 detect liquid through the wall of a plastic or glass container, up to about 20 mm thick, using capacitance. Stick one on the outside of a tank at the level you want to detect and it switches when liquid reaches it. No hole, no corrosion and no contact with the liquid. NPN, PNP, logic (V) and RS485 versions suit microcontrollers and PLCs.
Key specs at a glance
- Principle
- Capacitive, through non-metallic walls
- Wall
- Up to about 20 mm plastic or glass (not metal)
- Supply
- 5 to 12 V (Y25/Y26), 24 V versions available
- Outputs
- NPN, PNP, high/low logic (V), RS485
- Response
- About 500 ms
- Tube sensors
- DFRobot versions clip onto tubes under or over 10 to 11 mm OD
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1XKC-Y25 NPN Intelligent Non-Contact Liquid Water Level Sensor – IP67 ABS₹565
Option 2XKC-Y25 PNP Intelligent Non-Contact Water Level Sensor – 50cm Cable₹589
Option 3XKC-Y25-V Intelligent Non-Contact Liquid Water Level Sensor – RS485, IP67₹649
Option 4XKC-Y26 NPN 24V Intelligent Non-Contact Liquid Level Sensor 50CM₹994
Option 5XKC-Y26 NPN Intelligent Non-Contact Liquid Level Sensor 50CM Cable – 5-12V DC₹819
Option 6XKC-Y26 PNP Intelligent Non-Contact Liquid Level Sensor 50CM₹769
What the XKC-Y25 non-contact liquid level sensor is
The sensor learns the empty state at power-up, so power it on with the tank at its empty point or recalibrate with the adjust wire if your version has one. Thick walls, metal tanks and foam reduce reliability.
NPN outputs pull low when liquid is present (add a pull-up to 3.3 or 5 V); PNP outputs drive high, suited to PLC inputs. The V version gives a direct logic level, the easiest for Arduino.
XKC-Y25 non-contact liquid level sensor pinout
The pins on the XKC-Y25 non-contact liquid level sensor and what each one does.
| Pin | Function |
|---|---|
| Brown | + supply (5 to 12 V or 24 V) |
| Blue | Ground |
| Yellow | Output (NPN, PNP or logic) |
| Black | Mode select on some versions (output polarity) |
- Brown
- + supply (5 to 12 V or 24 V)
- Blue
- Ground
- Yellow
- Output (NPN, PNP or logic)
- Black
- Mode select on some versions (output polarity)
Wiring the XKC-Y25 non-contact liquid level sensor
An NPN output with a pull-up to 3.3 V is safe for an ESP32. A PNP output from a 12 V supply needs a divider or optocoupler before a microcontroller pin.
| XKC-Y25 non-contact liquid level sensor pin | Arduino Uno | ESP32 |
|---|---|---|
| Brown (+) | 5V | 5V (VIN) |
| Blue (GND) | GND | GND |
| Yellow (OUT) | D2 (with 10k pull-up for NPN) | GPIO 27 (NPN with 10k pull-up to 3V3) |
- Brown (+)
- Arduino Uno:
- 5V
- ESP32:
- 5V (VIN)
- Blue (GND)
- Arduino Uno:
- GND
- ESP32:
- GND
- Yellow (OUT)
- Arduino Uno:
- D2 (with 10k pull-up for NPN)
- ESP32:
- GPIO 27 (NPN with 10k pull-up to 3V3)
Example code
Swap the logic for PNP or V versions, which go HIGH when liquid is present. Use two sensors for low and high levels to avoid rapid switching.
const int LEVEL = 2, PUMP = 7;
void setup() {
pinMode(LEVEL, INPUT_PULLUP); // NPN: LOW when liquid present
pinMode(PUMP, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool full = digitalRead(LEVEL) == LOW;
digitalWrite(PUMP, full ? LOW : HIGH);
Serial.println(full ? "FULL, pump off" : "Filling");
delay(500);
}Setup and tuning
press flat against a clean wall using the supplied pad and strap.
power on with no liquid at the sensor height.
will not work through metal; use a float switch instead.
reads status over Modbus for long cable runs.
What you need
Shop this list17 of 18 found in our store · ₹12,742
XKC-Y25 NPN Intelligent Non-Contact Liquid Water Level Sensor – IP67 ABS: the part this guide coversXKC-Y25 NPN Intelligent Non-Contact Liquid Water Level Sensor – IP67 ABS₹565
XKC-Y25 PNP Intelligent Non-Contact Water Level Sensor – 50cm Cable: another version this guide coversXKC-Y25 PNP Intelligent Non-Contact Water Level Sensor – 50cm Cable₹589
XKC-Y25-V Intelligent Non-Contact Liquid Water Level Sensor – RS485, IP67: another version this guide coversXKC-Y25-V Intelligent Non-Contact Liquid Water Level Sensor – RS485, IP67₹649
XKC-Y26 NPN 24V Intelligent Non-Contact Liquid Level Sensor 50CM: another version this guide coversXKC-Y26 NPN 24V Intelligent Non-Contact Liquid Level Sensor 50CM₹994
XKC-Y26 NPN Intelligent Non-Contact Liquid Level Sensor 50CM Cable – 5-12V DC: another version this guide coversXKC-Y26 NPN Intelligent Non-Contact Liquid Level Sensor 50CM Cable – 5-12V DC₹819
XKC-Y26 PNP Intelligent Non-Contact Liquid Level Sensor 50CM: another version this guide coversXKC-Y26 PNP Intelligent Non-Contact Liquid Level Sensor 50CM₹769
XKC-Y26 PNP Intelligent Non-Contact Liquid Level Sensor 50CM Cable: another version this guide coversXKC-Y26 PNP Intelligent Non-Contact Liquid Level Sensor 50CM₹769
XKC-Y26-V Non-contact Water Liquid Level Induction Switch Detector Sensor 5-12V DC: another version this guide coversXKC-Y26-V Non-contact Water Liquid Level Induction Switch Detector Sensor 5-12V DC₹859
DFRobot Gravity Non-contact Digital Water / Liquid Level Sensor for Arduino – XKC-Y25-T12V Chip: another version this guide coversDFRobot Gravity Non-contact Digital Water / Liquid Level Sensor for Arduino – XKC-Y25-T12V Chip₹1,469
DFRobot Gravity Capacitive Non-contact Liquid Level Sensor (3mm TR, IP67): another version this guide coversDFRobot Gravity Capacitive Non-contact Liquid Level Sensor (3mm TR, IP67)₹1,153
DFRobot Non-contact Capacitive Liquid Level Sensor for Container OD > 11mm – Digital Switch Output: another version this guide coversDFRobot Non-contact Capacitive Liquid Level Sensor for Container OD > 11mm – Digital Switch Output₹1,489
DFRobot Non-contact Capacitive Liquid Level Sensor for Tube OD≤10mm – Digital Switch Output: another version this guide coversDFRobot Non-contact Capacitive Liquid Level Sensor for Tube OD≤10mm – Digital Switch Output₹1,489
Generic 24V Capacitive Contactless Externally Liquid Level Sensor – 35cm Cable: another version this guide covers24V Capacitive Contactless Externally Liquid Level Sensor – 35cm Cable₹419- Uno R3 development board: the controller used in the wiring tableFind this part
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389
5V relay module with optocoupler: to switch a pump or valve5V Relay Module with Optocoupler₹74
R385 diaphragm water pump 12V: a pump to controlR385 / R365 Diaphragm Water Pump 12V₹220
Buzzer module 3.3-5 V: for an audible alarmBuzzer Module 3.3–5V₹27
Alternatives and when to choose them
- Float level switch: mechanical switch inside the tank.
- Liquid level sensors: all level methods compared.
- Photoelectric level sensor: optical point level.
Common mistakes to avoid
- Mounting on a metal tank.
- Power-up with liquid already at the sensor, so it learns the wrong state.
- PNP 12 V output straight into a GPIO.
- Thick or foam-insulated walls.
Frequently asked questions
Does it work through glass?
Yes, glass and plastic up to about 20 mm.
NPN or PNP?
NPN with a pull-up for Arduino; PNP for most PLC inputs.
Can it measure continuous level?
No, it detects a single point; use several for steps.
Will water vapour trigger it?
Usually not; heavy condensation can.
What about thin tubes?
Use the DFRobot tube versions sized for the tube diameter.
Parts for this guide
Projects that use it
Put this into practice: 9 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.


