Today was filled with epic success, as the gardening bot is complete and fully functional!
With the back of the bot (the watering part) completed and in place from yesterday, today we focused on the front of the bot (the sensor part) and the programming details. Initially, we attempted to construct a form of "drill" to poke a hole in tightly-packed soil, so not to break the sensor as it entered the soil and read the moisture values. However, this design, reworked multiple times, proved itself to be wholly impractical and difficult to construct. In the end we decided to veto the drill and simply use the bot only in soft soil. For the mechanics of the sensor itself, we connected it to a servo that rotated about 20 degrees, lowering the sensor into the soil accordingly.
A few screws, bolts, and wires later, the mechanics were complete! On to the program. Here is a picture of the block diagram for our program, as well as a basic explanation of how it works:
(Note: the program to lower the sensor into soil isn't included in this picture, but it's just to the left of the while-loop)
Once the servo has lowered the sensor, it constantly reads values of moisture content based on the material it's touching (air, soil, water, etc.). To give some context, the sensor registers air at about -12, moist soil at about 12, and the skin on a human hand at about 36. Within the program, if it's true that the moisture content reads below 5, the front servo will rotate back from 20 degrees to 0 degrees, returning the sensor to its initial position. The back servo will rotate from 14 degrees to 0 degrees, lifting the cover on the hole in the water bin, releasing water into the soil. If it's false that the moisture content reads below 5, the front servo will still rotate back from 20 degrees to 0 degrees, returning the sensor to its initial position. The back servo, however, will either move to 14 degrees or stay at 14 degrees, acting as a cap on the hole and preventing water from being released from the bin.
Here are some videos of our bot in action! The first video is using real moist soil but leaving the back bin empty. The second video is using our hands to provide the moisture for the sensor, but having the plastic bin filled with water to test the effectiveness of the cap.
With such a large task undertaken, (well, for someone who has never worked with robotics before embarking on this internship) I compare the completion of this bot to the pride of a new parent. XD Our robot deserves a big hug for working so well~ ^_^