Cheap water level sensor

I had a water leak in our airing cupboard cold water header tank a few weeks ago. The ballcock valve was leaking and whoever installed the tank had put the overflow pipe HIGHER than the inlet pipe, not a real problem but the inlet seal was leaking - no real damage done thankfully.

I have been looking around for solutions to sense the level for an alarm system.

I was looking through my components the other day and had a "aha" moment when I saw one of these:

.

I intend gluing this to the inside of the tank at the alarm level with the barrel pointing down then wire the terminals to an ESP32 running Micropython. The ESP32 has a "wake-on-touch" function so this will probably run for a long time on a battery until (I hope never) the water rises and "shorts" the barrel contacts, the ESP32 wakes up and sends an MQTT message to node-red.

I haven't tested it yet but I am pretty sure it will work fine, I'll let you know.

3 Likes

Water can be surprisingly non-conductive just when you need it not to be . Especially if the contacts have any possibility of getting oxidised. But give it a go and let us know.

2 Likes

The touch sensors of the esp32 react rather on changes of capacity than conductance (so they can work behind glass). One wire and some aluminum foil should be enough for some tests.

A touch sensor system is built on a substrate which carries electrodes and relevant connections under a protective flat surface. When a user touches the surface, the capacitance variation is used to evaluate if the touch was valid.
https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/touch_pad.html

But how to charge water? What we know from our mobile device is that the screens react on raindrops. Another thing I like to experiment with sometimes in the future :wink:

Well I'm happy to report that the principle works!!!!!
I get a reading of 560 in free air and 360 in water. The best thing is that you only need one wire going to the sensor, I wired it to the barrel of the adapter.

I also used the male version of the adapter

[EDIT}
I have been using this Micropython code to test it and it works perfectly:

import machine
from machine import TouchPad, Pin
import esp32

# touch pins are calibrated at boot time, don't hold the ESP32 while booting!!!!!

def loop():
 t = TouchPad(Pin(14))       # assign touch pin 14 to t
 t.config(500)               # configure the threshold at which the pin is considered touched
 esp32.wake_on_touch(True)   # enable wake_on_touch
 machine.lightsleep()        # put the MCU to sleep until a touchpad is touched
 # ESP32 in lightsleep mode
 print(t.read())             # print the touch value
4 Likes

Interesting solution, thanks for sharing.

I used an ultrasonic sensor HY-SRF05 to measure the water level in a tank.
That way all the electronics were far away from the water.

Kind regards,
Urs.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.