BonsaiBot Mark IV (photos below) was put into service tonight after a week of development and testing. It measures and reports on soil moisture and waters the Bonsai when it is too dry. The code is at GitHub. No documentation or circuit diagrams yet, but that is coming.
The sensor is made of two nails, spaced about 2 cm apart, which are driven into the soil of the pot, one near the corner, the other near the trunk. Wires lead from the nails to an Arduino Uno, with connections to ground and analog pin 0. Using a voltage divider with the soil as one resistance, a 100 KOhm resistor as the other, the Arduino monitors the voltage drop between the junction of the two resistors and ground. A measure of “wetness” ranging from 0 to 100 is derived from this reading and displayed on an LCD. Using a knob, aka potentiometer the user can set a wetness level at which watering begins.
Watering is controlled by a relay connected to one of the digital output pins. The relay operates a valve connected to a water bottle whose bottom it about 10 cm above the top of the Bonsai’s soil level. When watering begins, it runs until the measured moisture level is “wet.” At the moment, watering is set to wetness 65, which is “dry’. (Between “wet” and “dry” is “moist”). Water is administered for one second every ten seconds so as to give plenty of time for it to be absorbed. Seems to work.