Friday, March 29, 2024

Fully Non-Invasive Liquid Level Detection

By Geetali Saha

The non-contact liquid level sensor uses the sensing capacitance of water to detect the presence of liquid approaching the sensor. The sensor has a specific static capacitance due to the distributed capacitance. When the liquid level slowly rises close to the inductor, the parasitic capacitance of the liquid will be coupled to the static capacitor, causing the final capacitance of the inductor to become more significant.

The capacitance signal is then input to the controller IC for signal conversion. The change in capacitance is converted into a proportional variation of the electrical signal, and then the algorithm detects and judges the degree of the change. When the amount of change exceeds a certain threshold limit the liquid level is considered to reach the sensing point. The same is authenticated in the proposed setup through a buzzer (provision for relay and/or LED interface is possible via mode selection). For the sensor detecting liquid, Arduino gives a signal to the buzzer and even XKC-Y25-NPN has an inbuilt LED for detecting the same.

Full Video Description:


Further, on the XKC-Y25-NPN sensor a notch is available to change the sensitivity of the sensor, you can rotate the notch clock-wise to increase the sensitivity and anti-clockwise to decrease it. No contact with liquid makes the module suitable for hazardous applications such as detecting toxic substances, strong acids, strong alkali, and all kinds of liquid in an airtight container under high pressure given the container is non-metallic, this liquid sensor is easy to use and easy to install. The sound of the buzzer is set at a higher frequency which catches attention of the operators when the liquid is detected. The waterproof sensor is also compact and requires very less space to operate.

Fig 1 Author’s prototype of the proposed set up to detect liquid level in a transparent setup
Fig 1 Author’s prototype of the proposed set up to detect liquid level in a transparent setup

For the present experimental setup, we have used the XKC-Y25 NPN sensor with its inbuilt LED connected with the Arduino UNO R3 and buzzers to sense the liquid level. Fig 1 depicts the Author’s prototype to detect liquid level in a transparent container and Fig 2 shows the block diagram representation of the same. Fig 3 shows the circuit diagram.

Fig 2 Block Diagram of the XKC Y25 NPN Liquid level Sensor
Fig 2 Block Diagram of the XKC Y25 NPN Liquid level Sensor
Table 1: Bill of Materials
1] XKC-Y25 NPN sensor (MOD 1)
2] Arduino UNO R3 (MOD2)
3] Buzzer (B1)

 

- Advertisement -
Table 2: Board Labels and Pin Functions of Arduino Uno
Board label Pin function ARDUINO
GND GROUND GND
5V 5V Power Input 5V
OUT Output of the sensor PIN A2
MODE Signal selection line GND
Input of Buzzer PIN 8

Specifications of the Sensor:

  • Operating Voltage (In VCC): DC 5 – 24 V.
  • Current consumption: 5 mA.
  • Output voltage (high level): In VCC.
  • Output voltage (low level): 0V.
  • Output current: 1 – 50 mA.
  • Response time: 500 ms.
  • Operating Temperature: 0 – 105 ºC.
  • Range for thickness of induction (sensitivity): 0 -13 mm.
  • Humidity: 5% – 100%
  • Material: ABS.
  • Waterproof performance: IP67.
  • Dimension: 28 x 28 mm / 1.1 x 1.1 inches.

Fig 3 represents the proposed system

Fig 3 Circuit Diagram of the proposed system
Fig 3 Circuit Diagram of the proposed system
Fig 4 Wiring of the proposed Liquid level detection on breadboard.
Fig 4 Wiring of the proposed Liquid level detection on breadboard.

The proposed setup involves the testing of the sensor with the help of Arduino programming. Fig 5 shows the screenshot of the code used for detecting liquid. An integer “x” is defined which stores the value of the input read from the output of XKC Y25 sensor and whenever the value of the integer becomes greater than zero, it indicates that there is liquid detected. Therefore, an if/else condition is used to trigger buzzer output.

If the value of integer “x” = 0 the serial monitor will print “NO LIQUID” and output of the buzzer is kept low. If integer “x” is not equal to 0 then output of buzzer is made high and “LIQUID DETECTED” is printed on serial monitor. The value of the threshold in the sensor can be changed with the help of the sensitivity screw and the same is exhibited later in Fig 9 with an opaque container having greater wall thickness as compared to the transparent container.

- Advertisement -
Fig 5 Screenshot of the source code
Fig 5 Screenshot of the source code
Fig 6 Wiring port definition and Terminal wiring sequence of the sensor XKC Y25 NPN
Fig 6 Wiring port definition and Terminal wiring sequence of the sensor XKC Y25 NPN
Fig 7 Normally Open or normally Closed output selection
Fig 7 Normally Open or normally Closed output selection

Product Applications: [NPN output drives small electric relays (coil current ≤ 100mA)]

  1. When the black line is suspended, it is normally open output:

If liquid is sensed→the transistor is turned on and closed;
And the relay is energized and closed;
When no liquid is sensed→the transistor will be cut off;
And the relay will not be closed when the power is turned off.

  1. When the black wire is grounded (connected to the negative pole of the power supply 0V), it is a normally closed output:

If liquid is sensed→the transistor will be cut off;
And the relay will not be closed when the power is turned off;
When no liquid is sensed the transistor is turned on and closed;

And the relay is energized and closed.

Fig 8 Typical connection of an electric relay or an indicator light for interfacing
Fig 8 Typical connection of an electric relay or an indicator light for interfacing

Fig 8 shows the connections for both normally open and normally closed conditions for an electric relay or a light indicator. Other variants of this same sensor work at higher voltages.

Fig 9 shows the working of the proposed setup for opaque containers (with greater material thickness) by varying the sensitivity of the sensor, which actually makes this sensor more attractive as it is a totally non-invasive approach. The serial-monitor prints “LIQUID DETECTED” as soon as the sensor detects the liquid and the buzzer makes a beeping sound. The output of the sensor is read by the Arduino on Analogue-read pin and it initiates buzzer conditional action accordingly.

Fig 9 Operation of the sensor using opaque containers
Fig 9 Operation of the sensor using opaque containers

Arduino Code:

int x =0;
void setup() {
Serial.begin(9600);
pinMode(A2, INPUT);
pinMode(8, OUTPUT);
}

void loop() {
x = analogRead(A2);
if (x == 0){

digitalWrite(8, LOW);
Serial.println(“NO LIQUID”);}
else {
digitalWrite(8, HIGH);
Serial.println(“LIQUID DETECTED”);}
delay(200);
}

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators

×