An Automated Water Tank Controller

[Jumpor] lives in a part of India where the water infrastructure is a little frustrating to use. Water gets delivered to underground tanks outside of homes, and must then be regularly pumped into rooftop tanks prior to use inside the building. Typically, this pumping is handled manually—by switching on a pump and running it until water comes out of an overflow pipe to indicate the rooftop tank is full. [Jumpor] decided to improve this wasteful and time consuming process with a little automation project.

The build is based around an ESP32 microcontroller. It’s hooked up to an ultrasonic sensor which can measure the water level inside the rooftop water tank. When the sensor detects the level descending below a set point, the microcontroller fires a relay to trigger the lift pump to fill up the tank. Once the sensor detects the tank is full, the pump is shut off, saving liters of water compared to waiting for water to pour out of the overflow as an indicator of the same.

It’s a simple enough project, but [Jumpor] was sure to include the important practical considerations. Since the rig was being installed in a rental, it was desirable to not make any permanent modifications to the water system. Thus, a fresh cap for the water tank was modified to host the electronics and level sensor, such that the original could be replaced at a later date. Due consideration was also paid to things like avoiding crossing the minimum detection threshold of the sensor, which could lead to accidental overflows if not managed correctly.

The aim of this project was to ease the day to day burden of maintaining a basic utility. That’s the sort of project we love to see around these parts.

25 thoughts on “An Automated Water Tank Controller

        1. It’s actually in a box separated from the koi by a net, so it’s more like algae buildup and leaves and the fact I can’t seem to get quality float sensors, they’re all cheap and nasty.

          1. Stainless steel hydrostatic pressure gauges are pretty cheap and resilient against bio-fouling – and they’re very simple to clean. Their biggest threat are animals that chew on the cables, thinking they’re plant roots.

      1. Ultrasonic is good, no water contact or moving parts. Float switches could directly control a pump. Of course if it gets stuck, the pump runs all night until the well runs dry or it sucks mud, etc. Redundancy – two float switches in series would be a good idea. Also, capacitive switch right through the wall of the container is a thing too. Seemed it was more a video about the interface.

          1. Yep
            From experience, the bare PCB module sensors you get off of online places will not hold up long in those environments.

            That’s the perk of a float sensor. They are very reliable.

            For example: millions of toilets
            Also: the gas gauge on your car

          2. The ubiquitous cheap ultrasonic sensor board (HC-SR04) definitely can’t handle that environment over the long term, but its waterproof derivatives, one of which is used in this project, is designed for exactly that environment and still pretty cheap.

            Fancier ultrasonic sensors are used industrially to measure the level of much, much nastier liquids (and solids) than water.

  1. Hmm. I’ve been looking for something like this for my camper for a while.

    I bet it would work just as well for the gray water tank so I know when it needs dumped as well.

  2. I’ve got the waterproof version of the ultrasonic sensors on my water tanks. I can confirm that condensation is indeed an ongoing issue with this – it will throw off readings every few samples. Mine just feeds to an MRTG graph though, so I can see the longer term trend.

  3. I also built and successfully implemented an ultrasonic sensor-based water level controller. However, I’m still facing one practical issue. During the rainy season, evaporated water droplets tend to form on the face of the ultrasonic sensor, causing it to give erratic readings.
    Have you encountered the same issue in your project? If so, what technique did you use to overcome it?

  4. The underground tank makes sense, since it keeps cool there (bacteria). But why then the rooftop tank, that heats up? I mean, it needs no pump from there, since the water falls down to the faucet. But if you still have to pump it up anyway, keep it runnning in a loop to the underground tank (reservoir) only, so people can just plug in?

    1. Usually these on-demand water systems use an air bladder to maintain pressure in the system to get instant water out of the tap, and the pump turns on when needed.

      However, if you don’t have power you get no water, so the rooftop version implements a mini water tower for reservoir, so you can get water during a blackout.

  5. A stainless steel hydrostatic pressure sensor would cost more than the ultrasonic sensor (30€ vs. 7€) but it would be more accurate and reliable in a clean water tank with no blind spots, temperature compensation or internal reflections for error sources. The output would be 4-20 mA current loop or analog voltage, making it very simple to interface with a MCU.

    Considering the total cost of the build, it wouldn’t be too expensive.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.