2015 Ninth International Conference on Sensing Technology
Garden Watering System Based on Moisture Sensing Ibrahim Al-Bahadly and Jonathan Thompson School of Engineering and Advanced Technology Massey University, Palmerston North, New Zealand
Finally, the future potential of the product will be outlined, listing some suggestions on how the product could be improved and completed to a level where garden centres could begin using it.
Abstract - Garden centres supply many different plants which will have varying watering needs. Each plant must receive the correct amount of water. Too much water may starve the plant’s roots of oxygen and cause them to rot; too less water and the plant will not receive the nutrients in needs to survive. A garden centre must cater to each plant’s watering needs in order to maintain a high level of health in their plants. Currently, many garden centres use a timer-controlled sprinkler system to water t heir plants. This has a disadvantage in that the timer system has no means of measuring the moisture level of the soil, which may lead to over-watering of certain plants. This paper presents a system that is capable of measuring the amount of moisture in the soil and determining whether or not the soil required water. The system utilizes a Dual Output Tap Timer, consisting of two motorized water valves, to simulate a garden centre’s sprinkler system. A Teensy 2.0 microcontroller acted as the control system, controlling the motorized valves and reading signals from two simple moisture sensing circuits. The testing of the system proved that plants can be watered based on the moisture level of the soil. It also showed that the soil probes needed to be much more reliable in order for the system to be successful.
Garden centres supply many different types of plants, and have a responsibility to properly cater to each plant’s needs whilst they are in the garden centre’s care. Selling plants in bad condition reflects poorly on the competency of the business and its staff, so it is imperative that each plant receives the correct amount of water for that particular type of plant. The amount of water each plant needs varies between each plant type [1]. For example, a cactus will require less water than a rose bush. Providing incorrect water amounts to a plant, whether over- or under-watering, can be detrimental to the plant’s health. Too much water may cause a plant’s roots to begin rotting, and reduce the amount of oxygen that can reach the roots; too less water will starve the plant from necessary nutrients [ 2]. Currently, many garden centres use a timer system to control water flow through a sprinkler system [3]. This method is likely to incorrectly water plants due to the fact that there is no means to monitor the moisture content of the soil. For example, if a garden centre experienced a heavy rainfall minutes before the sprinkler system was set to activate, the system would still activate at its predetermined time and water the plants in the garden centre, despite the fact that the plants received an adequate amount of water from the rainfall. This leads to overwatered plants being sold to customers, which reflects poorly on the garden centre’s reputation.
Keywords-automated watering system, moisture sensing. I.
INTRODUCTION
Plants are an important part of everyday life. Many people enjoy the aesthetic qualities they bring to a house or garden and frequent visit their local garden centre in order to purchase these plants. These customers rightly expect a high level of quality in the plants they purchase from garden centres, which places pressure on garden centres to care for their plants and maintain their health. One major part of achieving this is by supplying the correct amount of water to each plant. This project attempted to create a product which would aid garden centres in their responsibility to cater to their plant’s different watering needs.
This project aimed to create a prototype that could demonstrate the concept of watering plants based on moisture level readings from the soil. The project’s solution had to be affordable in order to attract wide range of garden centres, not solely large corporate centres. However, the product needed to be as reliable as possible. If the product were to fail, many plants in the garden centre would not receive the water they need, and their health would begin to suffer.
This report will begin by discussing the context around the project, and the aims which were hoped to be achieved during the extent of this project. Next, the project’s design process will be covered in detail, explaining the design of the chassis, the electronic circuit, the software, the waterproof casings and the final assembly. The testing and results of each section of the project and the final assembly will also be discussed.
978-1-4799-6314-0/15/$31.00 978-1-4799-6314-0/15/$31. 00 ©2015 IEEE
Additionally, the product needed to be easily integrated into garden centre’s current watering systems. This included powering the product from the mains voltage, to which a garden centre would have easy access, and controlling
263
2015 Ninth International Conference on Sensing Technology
water flow via digital outputs. The digital outputs from the product can easily be used to control solenoid water valves, or any other means of controlling a sprinkler s ystem.
II.
The Teensy 2.0 is a 29-pin microcontroller with an AVR core. The code is written in the C programming language and programmed via a USB cable. The Teensy 2.0 features 12 Analogue-to-Digital Converters (ADCs), 25 digital Inputs/Outputs (I/O), and 7 Pulsed-Width Modulation pins (PWM). The proposed system required 6 I/O pins and 2 ADC pins, so the Teensy 2.0 was more than adequate for the requirements.
DESIGN AND DEVELOPMENT
A. Chassis A Dual Outlet Tap Timer [as showen in figure 1] was used as a base on which the rest of the system was designed. The device consisted of a timing circuit, a dual motor gearbox with two DC motors, two motor-controlled valves to control the flow of water through two outlets, and microswitches located next to each valve to indicate when a valve was open or closed.
The Teensy is normally powered by the 5 volts supplied by a computer via the USB connection. This was not suitable for this project, however, so a track on the Teensy’s printed circuit board (PCB) was scratched out to prevent the microcontroller from receiving power from its USB connection and forced it to be powered solely from an external power supply. Two rows of male header pins were soldered to the Teensy, and two rows of female header pins were included into the circuit into which the Teensy could be connected. A decoupling capacitor with a value of 100 nF was added across the Teensy’s power supply in order to filter out any electrical noise that may have occurred on the power supply.
Figure 1. Dissected Dual Outlet Tap Timer. The timing circuitry was removed to be replaced with a circuit specifically designed for the proposed system. The valves, gearbox, motors and switches were used for the work. The new circuit and the project’s casing were designed to be attached to the original chassis. B. Electronics
1) Microcontroller This protoype utilized a Teensy 2.0 microcontroller [see figure 2] to monitor soil moisture levels and control the valve motors. Figure 3 shows the schematic diagram of Teensy 2.0.
Figure 3. Schematic of Teensy 2.0
2) Motor Driver The L293D, a 4-channel motor driver integrated circuit (IC), was used to control the motors used to open and close the water valves. The L293D was chosen because it is very simple to use and was easier than making two motor control circuits with basic electronics components. The L293D is controlled by the Teensy by simply placing a high or low voltage signal onto the IC’s control pins. Figure 2. Teensy 2.0
978-1-4799-6314-0/15/$31.00 ©2015 IEEE
264
2015 Ninth International Conference on Sensing Technology
Figure 6. Motor driver soldered onto PCB. 3) Moisture sensor Research was done into different moisture sensing circuits in order to use a simple and cheap circuit. This was done to keep the prototype within budget. The schematic of circuit that was used in the prototype is shown in figure 7. While figure 8 shows the moisture sensor circuit on PCB.
Figure 4. Pin layout of L293D motor driver.
The input pins shown in Figure 4 are used to control the motor’s direction. The motor’s terminals are connected to the output pins. Figure 5 shows the schematic of the motor driver. A 16 pin IC socket was soldered onto the PCB and the L293D was plugged directly into the socket as shown in figure 6. This was done simply to protect the IC in case the PCB needed to be re-designed. Desoldering an IC would potentially damage it from excessive heat from the soldering iron. Again, a 100 nF decoupling capacitor was placed across the IC’s power pins to filter out any electrical noise on the power supply.
Figure 7. Schematic of moisture sensor. Probes were connected to the transistor’s base pin and Vcc. By placing the probes into soil, the resistance between them varied depending on the amount of moisture in the soil. This varied the bias voltage on the base of the transistor, which, in turn, varied the amount of current flowing through the transistor’s collector. One of the Teensy’s ADC pins was connected to the transistor’s collector. This provided the Teensy with an analogue voltage representing the moisture level of the soil. The potentiometer on the transistor’s base provided a means to adjust the circuit’s sensitivity.
Figure 5. Schematic of motor driver.
Figure 8. Moisture sensor circuits soldered onto PCB.
978-1-4799-6314-0/15/$31.00 ©2015 IEEE
265
2015 Ninth International Conference on Sensing Technology
In order to ensure that the soil had reached an acceptable level of moisture, insulating heatshrink was added to the probes, leaving the last 5mm of tie wire exposed [see figure 9]. This caused the probes to only detect moisture at the tip of the probes, ensuring the water had soaked a decent amount into the soil.
of the PCB, with the motor and switch connectors on the left edge, the soil probe connectors on the right edge, and the DC power connector on the top edge.
Figure 11. PCB design.
Figure 9. Illustration of soil probe.
The PCB was made by an electronics technician at Massey University. Holes were drilled for each component and for screws to pass through the PCB and the electronic components were soldered onto the board. The board was then mounted onto the gearbox of the original product as shown in figure 12.
4) Power supply The maximum current draw for the circuit was calculated to be about 700 mA. A DC adapter was used that was capable of supplying 1.2 amps at 5 volts, which was more than adequate for the requirements of this prototype. A large 1000 uF capacitor was placed across the circuit’s power supply tracks in order to filter out any electrical noise on the power supply and keep the voltage level as smooth as possible. In order to protect the product and the user of the product from any risk of electric shock due to water-caused short circuits, a fuse was added to the circuit and a Residual Current Device (RCD) [see figure 10] was used when powering the product from the mains power supply.
Figure 12. Soldered and mounted PCB. C. Software The Teensy microcontrollers use the C programming language, and are programmed by using a TeensyLoader [4] application, provided by the Teensy website. The code for this project was written in AVR Studio 4. A program called Blinky [5] was used as a base for the rest of the code. Blinky simply configured the clock speed for the Teensy’s CPU to be 16 MHz. The rest of the code was written specifically for the proposed system.
Figure 10. Power supply section of PCB.
The code consisted of a series of methods; each one assigned a particular task. To begin with, methods were written to set up the Teensy’s inputs and outputs and the Teensy’s ADC pins. This was accomplished by referring to the Teensy’s datasheet and setting the appropriate bits in the appropriate registries high or low.
5) Printed Circuit Board A Printed Circuit Board (PCB) was designed to be mounted onto the gearbox in place of the original product’s PCB [see figure 11]. Measurements were made to ensure that screw holes in the PCB lined up with the screw holes in the original chassis. Connectors were arranged along the edges
978-1-4799-6314-0/15/$31.00 ©2015 IEEE
266
2015 Ninth International Conference on Sensing Technology
Next, a set of methods were written to read and write values on the input and output pins. This included reading the analogue voltages on the ADC pins (the signals from the soil probes), reading the status of the microswitches, and writing signals to the motor driver to move each motor forward or reverse. These methods were used as building blocks for other methods.
This was accomplished with one of the testing programs used to test the Teensy’s outputs. Some adjustments were made to the program to turn the motors the correct direction. This was done because the microswitches were placed in such a way next to the valves so that the valves could only turn one way or else the microswitch lever would get snapped off.
Methods were then written to open and close each water valve. This was done by commanding the valve’s motor to turn forward, whilst monitoring the valve’s microswitch for indication of the valve being open or closed. These methods were used to write a method for watering plants, called ‘waterPlantOne’ and ‘waterPlantTwo’. The plant watering methods begin by reading the appropriate ADC signal to determine the moisture level of the soil around the targeted plant. If the moisture level was below a certain threshold, the water valve was opened until the moisture level rose above the moisture threshold. The same process was applied to the next water valve.
After the testing was completed, the motors were connected to the PCB and operated correctly. C. Moisture Sensor Many tests were performed during the design stage of the moisture sensing circuit, shown in figure 13, in order to determine which circuit gave the best results. A crude set of probes were made and placed into a small pot of soil. An oscilloscope was used to view the circuit’s output while water was added to the soil.
Lastly, time delay methods were written to cause the program to “wait” for a certain amount of time (seconds, minutes or hours), before resuming the program. These methods were mostly used during the testing of t he code.
III.
TESTING AND RESULTS
A. Microcontroller The Teensy microcontroller was tested by plugging it into a breadboard. Each aspect of the controller, such as the ADCs and the input and output pins, was tested separately. Many aspects of the software were also te sted during this process.
Figure 13. Testing of moisture sensor circuit.
The ADCs were tested by connecting a potentiometer to the ADC pin and varying the analogue voltage on the ADC pin. The ADC value was observed by programming the Teensy to print the ADC values to a command prompt using an application called HID Listen [6], provided by the Teensy website.
This testing stage was done with very dry soil because it occurred at a dry time of year. The results from this test were satisfactory, and the circuit was used in the final PCB. However, the final testing stage was performed after winter, and all available soil was very damp. A bag of lawn soil was purchased in an attempt to obtain dry soil for testing purposes. The lawn soil was not overly dry, but, with some adjustments to the moisture threshold in t he code, it was dry enough to continue testing.
The Teensy’s on-board LED was used extensively during the testing stage as an indicator for sections of the testing code. For example, the LED would be used to indicate when the ADC signal passed above a certain threshold, or when a microswitch was opened or closed. This provided a visual indicator of the performance of the c ode.
After the PCB was completed, both soil probes were tested by dipping the probes into a shallow container of water and using the Teensy’s LED as an indicator as to whether or not the moisture threshold had been exceeded. This test was very useful to determine the correct operation of the moisture sensors. However, it was discovered that the second soil probe was more sensitive than the first soil probe. This was most likely caused by differences in electronic component tolerances, particularly that of the transistor’s current gains. If the second soil probe’s transistor had a higher current gain than the first transistor, the second soil probe would be more sensitive than the first soil probe.
After the PCB was constructed, a simple program was written to cycle a high through the Teensy’s outputs that controlled the motor driver. An oscilloscope was used to observe each output’s correct operation before connecting the motor driver IC to the PCB. B. Motor Driver Due to past experience using the L293D, not much testing was required. However, correct operation was observed before connecting the motors to the motor driver’s outputs.
978-1-4799-6314-0/15/$31.00 ©2015 IEEE
267
2015 Ninth International Conference on Sensing Technology
IV. D. Final Assembly The final assembly [see figure 14] was tested outdoors by filling two pots with lawn soil, placing a probe into each one, and positioning a hose over each pot. The hoses were connected to the prototype’s outlets, and a hose connected to the main water supply was connected to the prototype’s inlet.
CONCLUSION
Different plants have different watering requirements. Garden centres have a responsibility to cater to the watering needs of many types of plants. Current watering systems in many garden centres are simply timer-controlled sprinkler systems. This method is prone to over- or under-water some plants as there is no means of monitoring the moisture content of the soil. This project created a prototype that demonstrated that soil probes can be used to measure the amount of moisture in soil and determine whether or not the soil requires watering. The prototype proved that this concept is completely viable. However, in order to be a reliable system, a reliable moisture sensing circuit is required. A simple circuit is not accurate enough to be used in a professional garden centre. Future developments to be made on this work include adding a user programmable aspect to the device, allowing the users to program their own moisture thresholds for group of plants, and adding a system to allow many soil probes to send signals to the microcontroller. This could be achieved by multiplexing the soil probes, reading their signals one at a time.
Figure 14. Final assembly testing arrangement. This testing process took a long time as there were several adjustments required in the code. A slightly miswritten section of code for setting up the Teensy’s inputs was causing problems between reading the two analogue signals from the soil probes. Additionally, several adjustments were made to the code’s moisture threshold to compensate for the over-sensitivity of the moisture sensing circuitry. The code used for the final assembly test simply called the ‘waterPlantOne’ method and the ‘waterPlantTwo’ method after a ten second delay. The ten second delay was added to allow time for beginning a video recording of the testing process.
With the correct adjustments and developments, this system has the potential to improve the health of plants by accurately and reliably providing the correct amount of water to each group of plants, and will prove to be a valuable resource for garden centres. This system also has the potential to be affordable enough for many garden centres, large and small. The product can be interfaced with a garden centre’s current sprinkler system, meaning the garden centre must only pay the cost of the control system, the soil probes, and the installation costs. REFERENCES
After an extensive period of tinkering, adjusting the code, and positioning the hoses correctly over the soil pots, a successful test was performed. After the ten-second delay, the Teensy read the ADC value from the first soil probe. If the moisture level was beneath the predetermined threshold, the first water valve was opened, allowing water to flow into the first pot. The monitoring of the moisture sensor’s ADC value was continued until the moisture level fell beneath the threshold. Then the water valve was closed, cutting off water flow to the pot. The same process was applied to the second pot and soil probe.
[1] LaLiberte, K.. When to Water. In Gardeners. Retrieved October 30, 2013, from http://www.gardeners.com/When-toWater/8108,default,pg.html [2] Hunter, K. (2010). Guidelines for Watering Indoor Plants. In Colorado State University Extension . Retrieved October 30, 2013, from http://www.coopext.colostate.edu/4dmg/Plants/guidline.htm#Signs of dehydration and overwatering. [3] Watering. In Paeroa Garden Centre. Retrieved October 30, 2013, from http://www.paeroagardencentre.co.nz/kbasedetail.php?kid=26 [4] TeensyLoader (retrieved October 31, 2013), http://www.pjrc.com/teensy/loader.html [5] Blinky (retrieved October 31, 2013), http://www.pjrc.com/teensy/gcc.html [6] HID Listen (retrieved October 31, 2013), http://www.pjrc.com/teensy/hid_listen.html
This successful test was conclusive in proving the project’s concept: that soil could be watered depending on moisture readings from that soil. However, the testing also showed that, in order for the system to be reliable, a much more reliable moisture sensor is needed. This would greatly improve the system overall operation and ensure that it delivers the correct amount of water to the plants.
978-1-4799-6314-0/15/$31.00 ©2015 IEEE
268