The basic operation of the software is very straightforward: check threshold, check sensors, if they're both lower than the threshold, open valve, wait, close valve, wait, repeat. Nevertheless, we had to consider many factors when designing this project, such as programming language, GUI layout, and control scheme. Below are our major software considerations for the design.
This choice was effectively made for us when we decided to use the Raspberry Pi as our microcontroller. Python is the preferred programming language for the Pi, so--with no prior experience--we wrote our program in it. It turned out to be fairly intuitive since we had some background with C programming.
Tkinter is the Python graphical user interface programming module, which comes pre-loaded on the Raspberry Pi. Using it we were able to design an app to run the WASP that worked seamlessly with the touchscreen, as well as our control program.
We opted to have the system poll the sensors hourly. We wanted to have something regular, but there was no need to poll any faster because soil moisture typically moves quite slowly.
We programmed in a 'manual watering' button and a 'stop watering' button to allow the user to override the system, if desired.
Rather than have a rigid system that was only suitable for a narrow class of plants, we wanted the WASP to be flexible and adjustable by the user to suit nearly any type of plant. We programmed a slider into the GUI that allows the user to select from the full range of the sensor, from desert to swamp.
To avoid overwatering, we added an 8 hour delay after the WASP waters, where it does not check the sensors. Since water often percolates slowly through soil, we wanted to eliminate the possibility of false dry readings when water has simply not reached the sensor yet.