Adafruit's basic tutorial for monitoring soil moisture is in this guide.
This page expands that project to log plant data to a spreadsheet. It includes the soil moisture level as measured in the soil moisture tutorial via a capacitive touch pad connected to a piece of metal in the soil of the plant. Measuring the temperature and light levels gives a complete picture of the plant's progress.
The CircuitPython code is the same as the previous example with these changes:
- The soil moisture is read on a capacitive touch pad connected to a nail in the soil
- The moisture data is a fourth column in the spreadsheet.
Here is the code:
Here I used Microsoft Excel to hold the data this time. The time units were from 613 to 698 seconds after the board was powered. That forms the x-axis values. The plots are the light (varies the most), temperature and soil moisture (which usually don't vary much over a few minutes).
This code provides a complete plant monitoring solution. You can monitor the light and temperature and how moist the soil is over time.
The code could be expanded to possibly self-water. You would need a soil moisture value at which you consider the soil to be dry. We have found that 1500 is a good baseline that you can use based on the type of plant and it's requirements.
You would check if the moisture was < 1500, then do something that releases a determined amount of water (which again varies by the plant type, pot, etc.) to water the plant appropriately.