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 voltage 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: This project is available also in Fritzing web site. Hardware set-up
Following hardware is required to build the experiment:
Confused about all acronyms? Here is a brief explanation: GND is the ground line, 3V3 and Vcc are the positive supply line, GPIO34 is the ADC1 channel 6 input (GPIO is generic purpose Input/Output). The following picture shows the breadboard for the contactless water level sensor: ESP32 software
Before writing software make sure to have installed the software development environment, downloadable from Arduino Software web site. It may be needed to download some library if not already present. Libraries are required also to manage the external devices. The sketch is based on sine generator created by Krzysztof. The loop() function implements the water sensor functionality.
Download the complete sketch here and enjoy it. |