Claire Corlett

Fish Food, Fish Tanks, and More
Water level/fluid level capacitive sensor – How it works and how to make one

Water level/fluid level capacitive sensor – How it works and how to make one


Hello everybody and welcome back to my channel. I have this tank where I harvest water coming
from the air conditioner in summertime for watering potted plants. While this is useful to save drinking water,
it may be a source of inconvenience when I forget to check the level of the water into
the tank. Pushed by the need to resolve this and an
other much worst and quite disgusting problem in a manhole that collect sewage, I went to
the idea to make a capacitive level sensor for liquids. Unlike sensors based on a float or based on
ultrasound, capacitive sensors have no moving parts, so they are very reliable. Even conductive sensors have no moving parts
but they are sensitive to corrosion and current leakages in case other electric devices are
in contact with the water esample, a pump. These sensors are useful wherever the level
of water or other liquids such as cutting fluid, have to be monitored and controlled
such as in hydroponics, in watering systems, machine tools, and so on. Capacitive sensors work exploiting the variation
of the dielectric coefficient when the water (or an other liquid) raises and occupy the
space between the two sensor’s plates that constitute a capacitor. In fact the sensor is basically made of two
plates that are connected to a conditioning circuit which measures the capacitance. Well, you have to know that admittance sensors
also exist. Indeed admittance sensors are pretty similar
to capacitive sensors, the only difference is in the circuit that instead of measuring
the capacitance, sends a fixed frequency alternating signal detecting the variation of impedance,
since the impedance of a capacitor is given by its capacitance at a given frequency. I’ve said this because you might be confused
when you’ll see my circuit where I exploit the variation of the frequency of an oscillator
to infere the capacitance. So beside to the mentioned method that indirectly
measure the capacitance through admittance, there are other three methods:
one is to look at the time a capacitor takes to be charged from a given voltage to an other,
providing a source of constant charges or, in other words, a constant current source,
and the time required is taken to calculate the capacitance. A similar method is to look at the voltage
the capacitor reaches on a fixed amount of time. And the last method is to look at the frequency
of an oscillator, which oscillates by the mean of a resistor and a capacitor, where
the capacitor is the unit under test. The frequency of such an oscillator is obviously
given by the resistance of the resistor and the capacitance of the capacitor under test. I preferred this last method because it is
simpler to implement and offers the convenience to easy conditioning the signal into a variable
voltage that, in turn, may be used to drive the input of an analog to digital converter
of a microcontroller such as Arduino or an ESP8266. So let’s dive into the construction of this
water level sensor. I’ve used two stripes of aluminum to form
the plates of a capacitor that will be located into a plastic pipe. Because the stripes don’t have to enter in
contact with the fluid, which may be conductive such as in the case of water, I have covered
the stripes with a layer of bi-component polyester resin and on top of it a further layer of
acrylic. I’ve not covered about five centimeter at
one end of each stripe because that will become the terminal contact to be connected to the
circuit. The stripes has been placed into this PVC
electrical conduit and kept in place using hot glue. To be sure to have the right gap between the
two stripes I’ve temporarily put this dense sponge in between. A better design would have been to use an
aluminium pipe, also connected to ground, and a inner rod to form the other plate of
a coaxial capacitor. The external aluminium plate would work as
shield from induced electric fields making the oscillation more stable. My first idea for the sensor was originally
intended to gauge the level of sewage into a manhole, but eventually I changed my mind
and re-purposed this one to sense the level of the air conditioner water tank, because
the gap between the plates is too narrow and I’ve thought that, because the sludge, it
would have not lasted long without clogging. I will show that sensor and its operation
in the next episode. Allright, now the sensor is ready, and the
next step is to check how it works. First we need to figure out the theoretical
capacitance of the sensor in both fully immersed in water and dry conditions. The capacitance can be calculated by dividing
the area of one of the two stripes (representing the plates of the capacitor) over the distance
of the stripes. This ratio is then multiplied by the permeability
(or dielectric constant) in vacuum, and by the relative dielectric constant of the resin,
approximately 3, which covers the plates. Even though between the plates there is air
too, we do not need to multiply also by the dielectric constant of air because it’s close
to 1. This gives us a capacitance of 29 pico-farad
when the sensor is dry. Calculating the capacitance when the sensor
is fully immersed in water is easy, just use the length of the stripe that will be immersed
to calculate that area, divide by the same gap distance, and multiply by the same dielectric
constants as when the sensor is dry, and by the dielectric constant of water, which is
approximately 80, a pretty sharp difference in respect to air. This gives us a capacitance of 2.4 nano-farad. To be precise the remaining part of the sensor
that remains not immersed should be calculated as we did in the dry condition, and added
to the just calculated capacitance of the part that is immersed, however since the remaining
part is very small and the difference between the air and water dielectric constants is
so large, we can safely disregard this part. In this section of this breadboard I’ve put
the circuit shown in this scheme. It is an oscillator followed by a pulse generator. The length of the pulses is designed to be
shorter of the shortest cycle of the oscillator when the sensor is completely dry, namely
when the capacitance is at its lowest value and hence the frequency is at its maximum. The sensor is represented by this capacitor
in the schematic. Now let’s test the circuit. When the sensor is dry the frequency is 80.6
kilo-hertz. Calculating the capacitance based on the frequency
we have a total capacitance of 84.4 pico-farad, subtracting the 22 pico-farad capacitor of
the circuit, the result is a capacitance is 62.4 pico-farad, which is quite different
from the calculated value of 29 pico-farad. Why this difference? I think it depends by the parasitic capacitance
of the circuit in the breadboard that I know is about 30 pico-farad, so if we add further
30 pico-farad, the likely parasitic capacitance, the final result is close to the theoretical
value. Now let see what happen when we plunge the
sensor into the water. …and we see the frequency remarkably changes. When completely immersed the frequency drop
at 2.9 kilo-hertz and the resulting capacitance is around 2 nano-farad, which is really close
to the theoretical value. This is the signal at the output of the pulse
generator, as you can see the length of the pulse is constant but the frequency vary. After the pulse generator, the signal is forwarded
to this stage, which converts the frequency into voltage, and then to this stage which
detects when the voltage crosses the threshold set by the potentiometer, switching the LED
and the buzzer to beep an alarm, and perhaps a relay to control something else. The analog signal after the frequency-voltage
converter can also be delivered to the analog input of an Arduino or an ESP8266 to monitor
the tank level with a smartphone, and record the daily average and seasonal total amount
of water produced. For the sake of reliability instead of building
the circuit on a prototype board I’ve etched a piece of copper clad board, drawing the
traces by hand with printing ink. While this method does not yield a professional
looking board, to me is still less messy than using a prototype board. No through holes, the components are surface
mounted …yeah, you know, advanced surface mounting
technology. The end terminal of the sensor is secured
with this PVC cap, hold in place with epoxy. I’ve prepared this enclosure out of a chunk
of plastic pipe and capped with this PMMA disc that I’ve turned with the drill to perfectly
fit the pipe. The circuit is then connected to the sensor
and to the power supply that is provided by this 5V switching wall wart that I’ve salvaged
from an old cell phone. Now it’s time to test the final assembly. [Music] By the mean of the potentiometer the threshold
can be adjust at the desired level. The positive feedback resistor (27 kilo-ohm)
helps to avoid oscillations when the water level is just at the threshold, providing
a stable on/off switching. Next time I will make a special pressure capacitive
sensor to detect the level of, well, disgusting stuff, so I invite you to stay tuned, subscribe
and click the bell icon to receive the notification when I’ll post a new video. Also don’t forget to like and share. Ohh I had to connect a relay in output to
stop the air conditioner! [Music] For now, that’s all folks! Thanks for watching. [Music]

44 comments on “Water level/fluid level capacitive sensor – How it works and how to make one

  1. You could calibrate an existing sending unit from a fuel tank. Attached to a gauge it would give an accurate reading of the fluid level. Or, just a float attached to a switch that triggers a warning light when the fluid level in the tank is too high or too low.

  2. Remark. Because the dielectric constant of water changes with temperature this sensor provides a reliable measure as long as the water has a limited variation in temperature. In the case the water has variable temperature (say from 20C to 90C / 68-194F) a pressure sensor is better suited. (Pipe-pressure, the same that I'm gonna make for gauging the level of the sludge into a manhole.)

  3. Very nicely explained.
    What is the effect of the thickness of the Aluminum strips?
    Would a thin copper foil work (instead of the Aluminum strips)?

  4. will this work for fuel level measurement…n can u tell about the resin used is it necessary to use for above application?? thanks in advan
    ce @Accidental Science

  5. Excellent video and thank you for the information. Did not know Inspector Jacques Clouseau was still around. You sound just like him.

  6. I want to replicate this project. Can you please answer few of my queries? It would also help other, those who visit this video!
    1. Can I attach the probe separately with a wire and keep the circuit at a distant?
    2. Which wire should I use? Twisted pair or Single core shielded?
    3. Can I use this same circuit for moisture count in soil?

  7. Hi, did you manage to build the pressure capacitive sensor? I can't seem to find that upload.

  8. Can i use this sensor for more than one meter and can u explain the way and the code for using this sensor with arduino thank u so mach for this great information

  9. hi , I liked the the capacitance sensor that you made. Would it be possible for you to share the electronic circuit diagram with specifications of components needed? I am looking for making similar type of application for fuel level gauging. If you have any suggestions you are welcome.

  10. Very informative video! I have a 20gal chlorine tank used for well water treatment and would like to use an ESP 8266 to send an MQTT message to my node-red/raspberry Pi system so as to flash one of the lights in my living room which is connected to a Sonoff Basic running Tasmota.

    Flashing the ESP 8266-01 or some other variant to send a MQTT message at some level {approx 20% full} might tax my limited programming skills however.

  11. hello, i want to know how to build the circuit for the probe, i already have the custom made probe, but i have problem to extract the reading of the water level using the probe, i have no idea how to build the circuit since i have to use arduino as the microcontroller? can you help me? you can reach me through my email : [email protected] thank you

  12. Hi,
    Would you like to share the PCB layout for diy purpose? And the Arduino program too. Thanks in advance.

  13. can your sensor detect the level of fluids with varying dielectric constants , from high to low.. this is for detection of human blood levels

  14. Very nice, very nice video with a lot of useful info and also the necessary theory behind. I wish you would have spent a little longer on the math and on the circuit components.

    This said, why not make the circuit with a proper CAD and use the transfer method? Also, I think disconnecting AC whit a relay when the tank is full is a poor failover method. Why not create some sort of passive overflow system that safely discards the excess water? It could be a series of pipes that passively discharge extra water or simply positioning the tank on a drain.

    Last question: will water collected from a condenser be slightly acidic? Is aluminum a good material for this or would something like a stainless steel be better?

  15. I built similar tubes a few years ago using copper tape and pvp pipe. It was for an aquaponics setup and designed so that the exposed portion was the hollow center and could be easily cleaned with a pipe cleaner brush. I appreciate your coverage of the maths in this and your rapid pcb production technique is spot on!

  16. Very knowledgable video. I learn so much from this.. Thank you so much for make this video.. you are awesome

  17. I used a common electrical cable with two internal wires as a sensor, I melted the tip of the outer sheath to isolate the two cables, and as an electronics I used a common 555 whose oscillation frequency is read by arduino, works perfectly even as a sensor of soil moisture 🙂

  18. hi,great work
    i have one question
    i want to make a sensor like this for my own lab
    first i wanted to use arduino to read the data(by means of charge and discharge time)
    but i think its better to use the frequency method
    but i cant make the exact circuit
    can you send a technical drawing of the circuit?
    i want to connect the point you mentioned in video to arduino
    thank you very much

Leave a Reply

Your email address will not be published. Required fields are marked *