The greenhouse controller is designed to water plants growing in soil when the soil gets too dry. It uses two electrodes buried in the soil to measure the conductivity of the soil and then opens electric ball valves for a set amount of time if the soil is sensed to be dry. The conductivity of soil is directly related to its water content. The controller is designed to control three zones. Each zone has one valve and two soil sensors. The controller averages the readings from the two sensors in each zone to ensure accuracy.
When building this project cost was a major consideration. The total cost was under $150. The controller uses a generic Arduino UNO clone and a quad relay board to control the zone valves. The valves operate on 12VDC which is the main power source. The Arduino has a built in voltage regulator which steps this down to 5VDC for the logic. The set points are changed via a 2x16 character LCD screen connected using I2C and adjustments are made with four buttons. Two of the buttons are used to cycle through the menus and two are used to change the setting.
The soil probes consist of two 3” stainless steel machine screws hooked up to an analog input on the Arduino through a voltage divider. The voltage divider is necessary in order to take an accurate measurement of the soil conductivity. The electrodes are powered with a simulated alternating current created by using a digital pin and an analog pin. A reading is taken by setting the digital pin to an output and turning it on. After waiting a few milliseconds for the voltage to stabilize, the analog pin is used as an input to read the voltage. Once the reading has been taken the digital pin is set to be an input and the analog pin is set as an output.
This simulated AC is important for a number of reasons. If a DC current was used electrolysis could rapidly degrade the electrodes. When stainless steel electrodes are used for an electrolytic reaction they release chromium which is highly toxic. An AC current minimizes this effect. AC current also ensures accuracy of readings by avoiding soil ionization and buildup on the electrodes. Even with an AC current it is important to minimize the time the sensors are powered. For this reason they are only turned on when taking readings. Readings are currently taken once every 15 minutes and last only a few milliseconds. The frequency of readings is a matter of preference and could be reduced further if so desired.
I will add more information on this project in the future. Feel free to email me if you are interested in this project.