Contactless water level sensor
This experiment shows that it is possible to detect water level without any electrical contact using ESP32 module, OLED and two aluminium foils.
In this sketch, the ESP32 module generates a sine wave that is transferred by a capacitor to an analog input of the ESP32 connected to a voltage divider. The capacitor is built using two aluminium foils and a glass filled with water. The glass is useful for the experiment, while in the real life there will be a plastic pipe. Make sure that there is no electrical contact between the two aluminium foils.
The peak-to-peak value measured during each sampling window provides an indication of the presence of the water in the glass (or in the plastic pipe). At the end of each sampling window, the peak-to-peak value is smoothed by a Moving Average filter before being displayed as progress bar on OLED display