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
Software Apps
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: