Water level monitor in waterwell

The water level monitor project is a type of data recording and storage project that can be used for extended daily water level development statistics. This makes it possible to determine the months of the year when there is a lack of water in the wells and the opposite, when there is enough water, or even an excess. It is also possible to integrate extended control of power elements - pumps, waterworks, solenoid valves, which can be used to water the garden and beds - to irrigate or to pump water and use it as a utility for flushing, washing. The basic version project used only logging data to MySQL databases at regular intervals of several minutes.

To record the water level (but also the height of another variable, such as snow, coal, wood), I used the ultrasonic distance sensor HC-SR04, which is characterized by high reliability and simple operation and low consumption. It can measure 3-450 centimeters. It uses ultrasound at a frequency of 40kHz with a transmission pulse of 10 microseconds. Based on the time from receiving the reflected wave, it is possible to calculate the distance of the object from which the wave is reflected by the formula.

The description shows that it is possible to measure a maximum well with a height of 450 cm. The sensor is placed at the top level, preferably at the center of the well. In order to make the measurements as accurate as possible, a total of 5 measurements are taken that are averaged. However, since the measurement result is rotated - the distance from the top is measured and not from the bottom, it is necessary to subtract the result from the maximum height (450cm - or another at the shallow well) and create an absolute value. This way we can determine the height of the water in the well. If we know the diameter of the well and the height of the water column, we can also determine liters of water to a reasonable extent.

In order to be able to adapt the project to transfer by different technologies, I have made several source codes that enable these technologies and microcontrollers to transfer:
Arduino + Ethernet (Wiznet W5100/Wiznet W5500)
ESP8266 (Wemos D1, Wemos D1 mini, NodeMCU, Generic module) - WiFi
ESP32 (Generic, devkit v1-v4, Lolin32) - WiFi
() Sigfox Wisol - IoT (requires more demanding initial configuration + HTTPS callback)
) NB-IoT
(*) GSM

    • any microcontroller
      All technologies allow transfer to a web interface where data is processed, stored in a MySQL database and archived for more extensive statistics. From the Arduino with an Ethernet shield, an HTTP request is executed to pass the data to the web interface. With the use of ESP boards, or the Sigfox module, or GSM, NB-IoT can execute the HTTPS request to send data to the web interface.

      The web interface uses Google charts to represent data for 2 hours, 24 hours, 7 days, and 30 days in bar graphs. With the option to display the graph for the selected month or day. This makes it possible to view the differences between years, months and days and to evaluate the yield of the well, and whether it is gaining in volume or drying out due to the years.

      Part of the system is also a real-time table, which always displays the latest data with a tendency to water level. For longer-term statistics and averages, Google uses alarm clocks to visualize peaks and minima, averages over 24 hours / 7 days / 30 days. The login system with the possibility of changing data is a matter of course, including the logging of IP addresses that have connected or not connected to the system due to bad data entry.
      More about the project can be found on my site: https://arduino.php5.sk/studna-voda.php?lang=en

It is a shame that you write here in English, but your code is...not. If you want to get some respect, consider that.