Soil moisture system based on ESP8266 Wemos D1 Mini.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Soil moisture system

IoT soil moisture system based on ESP8266 Wemos D1 Mini. Use resitance soil moisture sensors, data are send to Blynk. Project is free to use, coded in C++, created in Visual Code with PlatfomIO IDE.

To build a project, you need to download all the necessary libraries and create the settings.cpp file in the src folder:

// Watering system project settings
struct Settings
    const char *ssid = "WIFI ssid";
    const char *password = "WIFI password";
    const char *blynkAuth = "blynkAuth";

Soil moisture sensor corrosion problem

After some time you realize that the sensor provides drier and drier results, even if the soil is wet. It is because of corrosion caused by electrolysis. The copper atoms on the positive electrode are being ionised, transported via the soil's water content across to the negative electrode where they are being deposited and returning to being copper atoms. This explains why the negative electrode looks surprisingly clean for having been buried - the top layer of atoms are recently deposited and likely very pure (in picture). To avoid this you have some choices:

  • Use AC instead of DC
  • Use capacitive sensors instead of resistance (they are more expensive)
  • When use DC, power on sensor only when data are readed. It will reduce the speed of corrosion (as electrolytic corrosion will be faster than that of unpowered copper) but it will not prevent it in the long-run. I use MOSFET for switch ON/OFF sensors

Electrolysis corrosion

Currents list:



PCB circuit: