#411 Ten Fluid Level (Water Level) Sensors and how to use them (Arduino, ESP32, ESP8266)
Summary
TLDRThis video explores various sensors for measuring liquid levels, from simple threshold sensors to advanced ultrasonic and pressure sensors. It discusses mechanical and electronic sensors, their mounting inside or outside tanks, and considerations for corrosion resistance and contamination. The video also covers different interfaces like open collector and current loop, and provides insights on connecting these sensors to microcontrollers. It's a comprehensive guide for those looking to monitor liquid levels in different applications.
Takeaways
- 🔍 The video discusses various methods and sensors for measuring liquid levels in different settings, such as home appliances, rural water tanks, and industrial chemical storage.
- 🏡 Two main motivations for the video are presented: monitoring liquid levels remotely in a cottage and avoiding coffee machine water shortages at home.
- 🔄 The video introduces 10 different types of sensors, including threshold sensors, distance sensors, and pressure sensors, each with their unique applications and mounting requirements.
- 🛠 Mechanical threshold sensors are explained, which work by making contact with the liquid and can be made of metal or plastic, raising concerns about corrosion and contamination.
- 📶 Electronic threshold sensors using capacitive or resistive methods are discussed, with an emphasis on their compatibility with plastic tanks and their open collector (OC) output.
- 💧 The importance of considering corrosion resistance and non-contamination when selecting sensors that come into direct contact with liquids is highlighted.
- 📊 For more precise liquid level measurement, the video covers distance sensors that use ultrasonic waves or laser light, and the challenges they face such as corrosion and signal reflection.
- 🔧 Pressure sensors are introduced as an indirect method to measure liquid levels by calculating the pressure at the bottom of a tank, with considerations for sensor placement and compatibility.
- ⚙️ The video also touches on the technical aspects of interfacing sensors with microcontrollers, including the use of resistors, voltage dividers, and analog-to-digital conversion.
- 🔗 The video concludes with a call to action for viewers to share their experiences with different sensors, emphasizing the value of collective knowledge in solving practical problems.
Q & A
What types of liquid level measurement sensors are discussed in the video?
-The video discusses sensors that react to fluid level thresholds, sensors that measure the exact fluid level, sensors mounted inside and outside of tanks, and sensors for the top and bottom of tanks.
What are threshold sensors, and how do they function?
-Threshold sensors detect when a particular fluid level is reached. They come in two types: mechanical switches or electronic sensors, which can use capacitive or resistive methods. They need to be in contact with the liquid to function.
What are the potential issues with mechanical sensors in liquid environments?
-Mechanical sensors can corrode when in contact with liquids, and their material may contaminate the liquid, particularly if they rust.
How do open collector (OC) outputs work and why are they beneficial?
-Open collector outputs allow the sensor's output voltage to be independent of the sensor’s supply voltage. By adding a resistor, the output can be controlled and customized, providing flexibility when dealing with varying voltage levels.
What are the differences between time-of-flight sensors using ultrasound and laser light?
-Ultrasound sensors use slower sound waves, while laser light sensors (often called LIDAR) use faster light waves. Both measure the distance between the sensor and the liquid surface, but are affected by factors like evaporation, pollution, and tank geometry.
How can pressure sensors be used to measure fluid levels?
-Pressure sensors measure the pressure at the bottom of the tank, which correlates to the liquid level based on the specific weight of the fluid. They need access to the tank's lowest point or can be placed directly in the fluid with a long cable.
What are the benefits of using current loop interfaces for long-cable sensors?
-Current loop interfaces are robust and efficient for sensors with long cables. They only require two wires to both power the sensor and transmit data, making them straightforward and reliable.
What measures can be taken to prevent sensor corrosion and contamination?
-Sensors that come into contact with liquids should be corrosion-resistant and not contaminate the tank’s contents. For internal sensors, materials must be selected carefully, especially in sensitive environments.
What is the advantage of reducing the number of sensor readings in systems where fluid levels don't change rapidly?
-By reducing the number of sensor readings, energy consumption is minimized, which is particularly important for electronic sensors that consume power while measuring. This can extend sensor and system longevity.
What mounting considerations should be taken into account for different sensor types?
-Different sensors require specific mounting locations. For example, time-of-flight sensors should be mounted on top of the tank to point towards the liquid surface, while pressure sensors must be mounted at the bottom or submerged.
Outlines
☕ Monitoring Liquid Levels with Sensors
The speaker introduces the concept of measuring liquid levels in various contexts, from coffee machines to water tanks and chemical industries. The video aims to demonstrate 10 different sensors used for this purpose, along with tips and insights into sensor technologies. Two key motivations for the video are mentioned: a request from a colleague to monitor liquid levels remotely in a cottage using LoRa technology, and a personal coffee machine issue. The speaker also hints at addressing various types of sensors, mounting methods, and how to connect them to microcontrollers.
📏 How Threshold Sensors Work
This section explains how threshold sensors work, focusing on mechanical and electronic versions. The speaker highlights three mechanical sensors (two made of metal and one plastic) and emphasizes their need to be in contact with the liquid, which can lead to corrosion or contamination. The description also touches on how to read these sensors using a microcontroller and resistor. Electronic sensors, such as capacitive ones, can be mounted outside plastic tanks. Open collector outputs are introduced, offering flexibility in managing output levels without depending on the sensor’s VCC voltage.
🔋 Flexibility of Open Collector Outputs
The speaker elaborates on the flexibility of open collector outputs, which allow for different output levels based on the voltage applied to the resistor. This section shows how to get either 3.3V or 5V output depending on how the resistor is connected, making it possible to power devices such as LEDs or relays. Additionally, the speaker explains the advantages of using these sensors to detect low or high liquid levels in tanks. Resistive moisture sensors are introduced as another option for measuring levels, but with warnings about corrosion and contamination.
📡 Measuring Liquid Levels with Sensors
This section dives into sensors that measure exact liquid levels, discussing two main methods: using distance sensors or pressure sensors. The speaker details the time-of-flight principle, either with ultrasound or laser light (LIDAR), and the potential challenges like corrosion, tank geometry, or pollution affecting readings. They also touch on different types of sensors, including waterproof ultrasonic ones, and the importance of testing sensors in specific environments. The focus shifts to pressure sensors, emphasizing their use for measuring liquid levels indirectly based on fluid pressure at the tank's bottom.
🌊 Using Pressure Sensors for Accurate Liquid Monitoring
Here, the speaker continues explaining the use of pressure sensors to measure liquid levels by placing them inside or outside the tank. Pressure sensors must be selected based on their suitability for liquids (not airspeed), and accuracy can be measured using internal or external ADCs. The section also explains how current loop interfaces are advantageous for long cables and robust data transmission. The speaker gives a formula for calculating the appropriate resistor to convert current to voltage and highlights the need for protection against corrosion for both the sensor and the cable.
🧪 Conclusions and Learnings on Liquid Level Sensors
The final section summarizes the key takeaways from the video, highlighting the differences between digital and analog output sensors. Digital sensors react when a specific fluid level is reached, while analog sensors provide a proportional signal. The speaker stresses the importance of mounting sensors correctly—inside, outside, at the top, or bottom—and ensuring they are resistant to corrosion and contamination. Various sensor interfaces, including current loop and open collector outputs, are explained. The speaker closes by inviting viewers to share their experiences with different sensors to build collective knowledge.
Mindmap
Keywords
💡Liquid Level Sensors
💡Threshold Sensors
💡Mechanical Switches
💡Capacitive Method
💡Open Collector Output
💡Moisture Sensors
💡Time of Flight Sensors
💡Pressure Sensors
💡Current Loop Interface
💡Microcontroller
Highlights
Measuring liquid levels is a common problem across various settings, from coffee machines to industrial chemical tanks.
The video showcases 10 different sensors for liquid level measurement, each with unique applications and methods.
Threshold sensors are available in mechanical or electronic forms, with the latter using capacitive or resistive methods.
Mechanical sensors must be in contact with the liquid, raising concerns about corrosion and contamination.
Electronic sensors offer the advantage of not needing contact with the liquid, reducing the risk of contamination.
The video demonstrates how to read mechanical sensors using a 10k ohms resistor and an input pin on a microcontroller.
Open collector output sensors are highlighted for their flexibility in output voltage levels, independent of the sensor's VCC.
The video explains the use of moisture sensors for threshold measurement, especially suitable for small tanks.
Electronic sensors consume energy during measurement, but power consumption can be managed with smart switching.
For precise liquid level measurement, distance sensors using ultrasound or laser light are discussed.
The video addresses the challenges of ultrasonic sensors, including corrosion and signal reflection issues.
Pressure sensors are introduced as an indirect method to measure liquid levels by calculating fluid pressure at the tank's bottom.
The video provides practical advice on mounting sensors, considering factors like tank geometry and liquid surface conditions.
Current loop interface is recommended for sensors with long cables due to its robustness and simplicity.
The video concludes with a call to action for viewers to share their experiences with different sensors, fostering a community of knowledge exchange.
The video provides a comprehensive overview of fluid level sensors, their interfaces, and practical considerations for various applications.
Transcripts
measuring levels of liquids is a common
problem
where i live it's probably more the
water level of the coffee machine
in rural areas the level of a water tank
and in the industry the level of
chemical substances
there are many different ways to get
this job done
if you stick around i will show you 10
different sensors and as usual we will
learn some new tricks crazy youtubers
here is the guy with the swiss accent
with a new episode and fresh ideas
around sensors and microcontrollers
remember if you subscribe you will
always sit in the first row
two things motivated me to begin this
video
the first was a colleague who manages a
remote cottage
he asked me if it would be possible to
use laura to monitor two critical levels
of liquids from remote instead of always
driving to the cottage
the second motivation was completely
different
during my home office days i drink a lot
of coffee my wife works out of home and
does not often use our coffee machine
but she hates it if the machine is out
of water when she wants to brew her only
cup of coffee in the morning because i
did not fill it up the day before
of course this is the mistake of the
coffee machine
it only shows the empty tank if you
start the next one
inferior engineering which brings me
into deep trouble as you can imagine
so i need a proactive water level sensor
anyway in this video we will cover much
more
sensors that react on fluid level
thresholds
sensors that measure the fluid level
sensors that have to be mounted inside
and sensors that are mounted outside the
tanks
sensors for the top
and for the bottom of the tanks
and as usual you get some background
info on the sensors
interfaces i will not test the accuracy
of the sensors in this video but i will
show you how you can connect them to a
typical microprocessor
let's start with the threshold sensors
they come in two varieties with a
mechanical switch or with electronics
the electronic sponge uses either the
capacitive or the resistive method
these are three typical examples of
mechanical sensors two of them are made
of metal
and the third of plastic
all have to be in contact with the
liquid to work
which can create a few problems
first does the liquid corrode the
sensors and second
can the material of the sensors
contaminate the liquid
particularly if they start to rust if
any of the above questions have to be
answered with yes we have to use
different sensors
but first how can we read these sensors
very simple if we connect them through a
10k ohms resistor to vcc we can read the
voltage level with an input pin
be aware that they bounce so you have to
take measures against it in software
the easiest is just to wait a few
milliseconds before the next reading
while open they do not need energy and
even could be used to switch your mcu on
and off
this sensor uses electronics and the
capacitive approach
it has to be mounted outside the tank
but it only works with plastic tanks
this sensor will be used for my coffee
machine project by the way
it is rated from 5 to 24 volts and has a
so-called open collector or oc output
because this is a commonly used concept
we have a look at it
most mcus or sensors provide two output
levels for low and high in our case 0
and 3.3 or 5 volts
this is simple and for many applications
the right approach
this sensor is different
do you know why they choose this
interface
let's assume we power the sensor with 5
or even 12 volts
then the output voltage for high also
could be 5 or 12 volts and we would have
to deal with it at a later stage
usually we would use a voltage divider
to reduce the voltage to the appropriate
level
the open collector output offers a
different solution
what happens if we add a resistor and
connect it to 3.3 volt then the output
voltage will be 0 when the transistor
conducts and 3.3 volts when open
if we connected the resistor to 5 volts
we would get 0 or 5 volts you see the
output level is independent from vcc of
the sensor
and if the transistor is strong enough
we can replace the resistor with an led
or a relay
a typical pin of an esp32 only can
source or sync 12 milliampere
open collector outputs usually are rated
higher
this sensor supports 50 milliampere for
example
here are examples of mounting these
sensors to detect low or high fluid
levels and they even suggest a solution
for metal tanks
we could also use the moisture sensors
discussed in video number 207
for threshold measurement
and for small tanks even to measure the
level
they have to be placed inside the tank
and these resistive sensors need a
conducting fluid
everything said about corrosion and
contamination applies here too
just remember these sensors corrode very
fast
electronic sensors other than their
mechanical counterparts use energy while
measuring if the levels do not move fast
you can reduce the number of readings
and switch your sensors vcc with a pin
of your mcu and only switch it on for
the measurements
if your sensor does not consume more
than 12 milliampere you can connect it
directly to an esp output pin
if it needs a higher current you have to
add a p channel fit to switch it
but what if you need more than a low or
a high level
then we basically have two possibilities
we measure the exact liquid level using
distance sensors or measure the pressure
at the bottom of the tank
the pressure method is called an
indirect method because it does not
measure the fluid level
but you can calculate it if you know the
specific weight of the fluid
we know two ways of measuring distance
both use time of flight
one uses the slower waves of ultrasound
and the other the fast waves of laser
light
the laser type sometimes is called lidar
for both methods the sensors must be
mounted on top of the tank and point
into the direction of the liquid surface
one thing of caution standard ultrasonic
sensors will corrode if water evaporates
for example and both sensors suffer from
pollution created if condensed vapors
clock them
i assume that a time of flight sensor or
a waterproof ultrasonic sensors like
this one should survive a few years but
you have to try in your particular
situation
another problem with ultrasonic sensors
is when signals are reflected by places
other than the surface of the liquid
these effects are influenced by the tank
geometry and the surface of the inner
tank
this may be the reason for the unique
design of this sensor
how do we connect these time-of-flight
sensors to our mcus
for most of them you find a library and
example projects on the internet
so i will not cover it here
you find the led lidar in video number
119 and the ultrasonic sensors in videos
number 40 and 190.
the range of the lidars is either 2 or 4
meters the ultrasonic sensors promise a
range up to 7 meters but i would not
trust these values and try the sensors
in your environment particularly the
laser sensors can be influenced by
sunlight
consider also the minimum measuring
distance and mount your sensors at least
at this distance from the maximum liquid
level
if the tank is closed at the top maybe
you cannot mount one of those sensors
fortunately there is another possibility
we measure the pressure at the bottom of
the tank
we get lots of pressure sensors make
sure you get one for liquids and not for
airspeed like this one
and because the sensor usually is in
contact with the liquid the same rules
apply as for the internal level sensors
this is an example of such a sensor it
can measure up to 30 psi
which means around 20 meters of water
this sensor runs on 5 volts and outputs
a voltage between 0.5 and 4.5 volts
so we can read it either with an
internal adc or if we do not trust its
accuracy with an external adc as shown
in video number 340.
obviously with pressure sensors we need
access to the tank's lowest point
if there is no such possibility we have
another possibility we can use a
pressure sensor inside the liquid at the
bottom of the tank
therefore it needs a long cable of
course the sensor and the cable have to
be protected against corrosion and
contamination
this sensor by the way uses a so called
current loop interface which is a
brilliant idea for sensors with long
cables it only needs two wires to power
the sensor and transmit the data
this sensor can be powered by 12 to 24
volts and returns its values as a
current between 4 and 20 milliampere if
we connect a resistor in series to the
sensor we get a voltage that is
proportional to the pressure
and if we connect the resistor to the
ground we can easily measure this
voltage with an adc the resistor can be
calculated with ohm's law if we want 3.3
volts at 20 milliampere we get a value
of 165 ohms
if we want to calibrate it to a lower
pressure it becomes higher of course
these are all possibilities i wanted to
cover
maybe you add other ones i forgot or i
do not know
and it would be fantastic if you shared
your experience with the different
sensors i'm sure that together we will
have a lot of knowledge
what are the learnings
we get fluid level sensors with digital
as well as analog output signals
digital if they react when a particular
level is reached and analog if they
output a signal proportional to the
fluid level
sensors can be mounted inside or outside
of the tank
if they contact the fluid they have to
be corrosion resistant and must not
contaminate the tank's content
each sensor type has one mounting
location time of flight sensors have to
be mounted on top and pressure sensors
at the bottom for example
different sensors use different
interfaces the current loop is robust
and straightforward for long cables and
analog readings open collector is a very
flexible way to connect different things
to the output pin as well as create
different output voltages
that was all for today as always you
find the relevant links in the
description
i hope this video was useful or at least
interesting for you if true please
consider supporting the channel to
secure its future existence thank you
bye
5.0 / 5 (0 votes)