As we have seen in this log, ESP 32 must manage the filling of the small tank at the top of the tower with a 5V submersible pump in the main tank.
The ESP 32 must however know the filling rate of the small tank as the disks must not run without water otherwise they will be damaged and the pump must be stopped when the small tank is full.
To do this we will use only two wires and the touch sensor technology of the esp32. The esp32 has 10 pins that allow measuring the change in capacitance between the panel (sensor) and the environment. If you want to know more about how it works.
This is the top tank cover to which the pcb is screwed.
The blue arrow shows the bottom sensor.
The red arrow shows the top sensor.
The white arrow shows the connection on the PCB.
The usb port at the top right of the PCB allows connection to the pump
The code :
This function returns a value between 100 and 0. By dipping a wire into the water the value will drop to around 10 allowing us to know if the high sensor or the low sensor is in the water. Before each activation of the disks, the bottom sensor of the tank is checked if it is not in the water then the pump is activated. A blocking loop will check the filling of the tank up to the low sensor if after 15 seconds the low sensor is not reached, the main tank is empty or the pump has a problem (the activation of the discs will not be performed). If the low sensor is reached, the blocking loop is exited leaving the pump activated. In the main loop if the pump is activated the high sensor will be mesured to know when to stop the pump. While waiting for the end of the filling process the discs will be safely activated.
During the activation of the discs, the low sensor will be measured every 2 minutes in order to know when to fill the pump which is necessary when the user sets the disks to long activation periods.