Introduction

This is a non-contact liquid level sensor with status indicator and adjustable sensitivity. It can be used in liquid detection of non-metallic container or pipe(outer diameter>11mm), suitable for all types of detection of curved or flat surfaces, arcs, cylindrical containers or piping fluids. The status feedback of the sensor can be given in real-time. Besides that, the sensor comes with a 4pin sensor adaptor that can directly collect digital signal, convenient for connecting with Arduino or other main-controllers. This liquid level sensor can be widely used in liquid detection of a tank, water dispenser, etc.

Specification

Board Overview

Liquid Level Sensor with Cable Adapter Module

Sensor with adapter

4P Adapter Pinout

4pin Adapter Pinout

Num Label Description
1(Left, Brown) VOUT Liquid Sensor Power Positive, +5V~+12V
2(Left, Blue) GND Liquid Sensor Power Negative
3(Left, Black) IO1 Liquid Sensor Forward/Backward output select
4(Left, Yellow) IO2 Liquid Sensor Level Signal Output
1(Right, Red) VIN Power Positive
2(Right, Black) GND Power Negative
3(Right, Blue) IO1 Liquid Sensor Forward/Backward output select
4(Right, Green) IO2 Liquid Level Signal Output

Liquid level detection of flat non-metal container

Liquid level detection

Sensitivity Adjustment

Sensitivity Adjustment

Use a screwdriver to rotate the sensitivity knob(on the right of the sensor) anti-clockwise to increase the sensitivity; rotate clockwise to decrease it.

Tutorial

Requirements

Arduino Debug1

Note: If the indicator light is normal when using method 1 on Arduino UNO, and the serial port printing data is wrong or the delay is too long, please use method 2 to debug

The liquid level sensor will output high/low level to determine the liquid level of a container, and its status can be checked via serial monitor.

Connection Diagram1

Connection Diagram

Sample Code1

/*!
 * @File  DFRobot_Level_Sensor.ino
 * @brief  Detecting the liquid level of non-metallic containers,and check the status of sensor through serial port
 * @copyright  Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
 * @licence  The MIT License (MIT)
 * @author  [liunian](nian.liu@dfrobot.com)
 * @version  V1.0
 * @date  2020-08-13
 */
int inPin = 8;
boolean running = 0;//when running=1, the liquid is detected, print out 1, otherwise, print out 0; running=0, the liquid is detected, print out 0, otherwise, print out 1.
int modePin = 9;

void setup()
{
  Serial.begin(9600);
  pinMode(inPin, INPUT);
  pinMode(modePin, OUTPUT);
  digitalWrite(modePin, running);
}

void loop()
{
  Serial.println(digitalRead(inPin));
  delay(100);
}

Function: when running=1, the liquid is detected, print out 1, otherwise, print out 0; running=0, the liquid is detected, print out 0, otherwise, print out 1.

Expected Results

Result

Arduino Debug2

Note: If the indicator light is normal when using method 1 on Arduino UNO, and the serial port printing data is wrong or the delay is too long, please use method 2 to debug

The liquid level sensor will output high/low level to determine the liquid level of a container, and its status can be checked via serial monitor.

Connection Diagram2

Connection Diagram

Sample Code2

int  inPin = 0;
int  i = 0;
boolean running = 0;
/*when running=1, the liquid is detected, print out 1, otherwise, print out 0; 
running=0, the liquid is detected, print out 0, otherwise, print out 1.*/
int modePin = 15;
void setup()
{
  Serial.begin(9600);
  pinMode(inPin, INPUT);
  pinMode(modePin, OUTPUT);
  digitalWrite(modePin, running);
}
void loop()
{
   i = readSensor(inPin);
   Serial.println(i);
   delay(100);
}

bool readSensor(uint8_t pin)
{
  int val = analogRead(pin);
 // Serial.println(val);
  if(val>950){
    return true;
  }else{
    return false;
  }
}

Function: when running=1, the liquid is detected, print out 1, otherwise, print out 0; running=0, the liquid is detected, print out 0, otherwise, print out 1.

Expected Results

Result

FAQ

  1. The liquid level sensor doesn't work when powered on (the indicator keeps off when the liquid level reached the sensing point, and it has no response to the sensitivity adjustment.).
    1) The sensor may not be in a good connection with the power source, please check the power connection.
    2) The power cable may be reversely connected, please check it.
    3) The power module is broken, change the power module and try again.
    4) The sensitivity may be too low, increase the sensitivity to a suitbale value.

  2. The indicator keeps on all the time.
    1) The sensitivity is too high, please adjust it to a suitabe value.
    2) The init parameter is revised abnormally, in this case the sensor needs to be returned to the factory for restarting init.
    3) There are impurities or other metal objects contacted with the sensor closely, please clean the sensor and keep it away from any metal objects.

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents

DFshopping_car1.png Get Non-contact Capacitive Liquid Level Sensor from DFRobot Store or DFRobot Distributor.

Turn to the Top