Introduction
This non-contact liquid level switch can be triggered when the liquid level fall below the sensor attached to the outside surface of a non-metal container.
Unlike traditional liquid level sensors, it does not need to be immersed into liquid. So, in this way, liquid will not be contaminated and the life of the sensor will not be reduced so fast because of the contact between liquid and sensors.
The sensor is very sensitive and stable, and the output current is upto 100mA which can directly drive a relay.
You can use this switch to monitor the condition of your water machine or make a water-drinking reminder by attaching it to the surface of your cup.
Specification
- Power supply: +5V
- Working current: 25μA
- Working temperature: -25~125℃
- Detectable wall thickness: 1~3mm
- Dimension(mm ± 1): 16.5 x 8.5 x 5.5 (Not include the cushion on the sensor)
- Cable length: 30cm ± 1cm
Tutorial
Requirements
Hardware
- DFRduino UNO R3 (or similar) x 1
- Non-contact Liquid Level Switch x 1
- M-M/F-M/F-F Jumper wires
Software
Connection Diagram
NOTE: Please keep the container empty or keep the liquid level lower than the sensor installation place before supply power EVERY TIME. This sensor has a power-on zero calibration. It will detect liquid level Zero position once it gains the power supply. |
NOTE: The sponge is to make it flexible to use most of the glue or a doble sided tape on the sponge to stick it to the non-metal container, if your container is too thick (over 8mm), you can remove the sponge and use a proper glue/ tape to fix it on the container.
Sample Code
void setup(){
//start serial connection
Serial.begin(9600);
pinMode(2, INPUT);
pinMode(13, OUTPUT);
}
void loop(){
//read the switch value into a variable
int sensorVal = digitalRead(2);
//print out the value of the liquid level
Serial.println(sensorVal);
if (sensorVal == HIGH) {
digitalWrite(13, LOW);
}
else {
digitalWrite(13, HIGH);
}
}
Expected Results
FAQ
Q&A | Some general Arduino Problems/FAQ/Tips |
---|---|
A | For any questions, advice or cool ideas to share, please visit the DFRobot Forum. |