How to build a smart controller for drip irrigation and automatic plant watering.
There are few areas of the globe that don’t have to be concerned with water shortages, few agricultural centres, large, or small, that don’t need to concern themselves with efficiently delivering regular watering to their crops. There are few farmers, homesteaders or amateur gardeners, who would say no to a drip irrigation system that effectively watered their carefully nurtured plants, and did not waste valuable water.
By 2025, an estimated 1.8 billion people will live in areas with water scarcity. Two-thirds of the world’s population will live in water-stressed regions. (Source: National Geographic).
What if, not only can you have drip irrigation, you can monitor, and control water usage across your crops? Reacting to weather conditions, in real time, with just the right amount of water through a cloud based, android compatible application. What if, the circuit could also control the addition of fertilizer, remotely?
Drip irrigation is growing in popularity for small, and large agricultural growers. Through drip irrigation, water is delivered directly to the root zone, preventing runoff, and avoiding watering bare soil areas.
Drip irrigation is thought to be 90-95 per cent efficient versus 30-60 per cent for sprays and rotors.
Drip irrigation also improves soil aeration to aid plant root growth. Watering can be targeted to plant roots, or above plant, to those crops which respond well to overhead watering. Drip irrigation saves water, money and time, reducing the need for manual labour for watering processes.
Though drip irrigation provides a watering solution, and conserves water, there has been research that suggests plants consume additional water via drip irrigation. Though it’s also safe to say that plants which consume more water overall deliver higher yields, it’s another reason to ensure that drip irrigation is truly water saving and productive.
What if there is a solution for water saving, cloud controlled, drip irrigation suitable, and accessible for nearly any farmer?
There is – by using this DIY smart controller for cloud controlled drip irrigation, and plant watering!
Onto building the smart controller…
What were the problems we needed to solve?
- Irrigate, but prevent water wastage due to excessive evaporation.
- Not all plants need the same amount of water, so we should be able to water accordingly.
- Compensate for hot days by increasing the quantity of water for the day.
- Monitor water usage to understand seasonal trends for water usage.
We solved these problems with our smart controller for drip irrigation by:
- Reducing the amount of water needed for irrigation, by using an automatic drip irrigation system with a cloud interface for scheduling early morning watering cycles.
- Splitting the farm into multiple zones, and utilising an Android interface for the supervisory controls logic, to water each zone based on a separate schedule.
- Utilizing an on-board temperature sensor to log data to the cloud, and use this for understanding temperature trends. Using weather data to preview conditions for the next few days.
- Pioneering the use of drip irrigation at the Michigan Urban Farming Initiative for collecting farm data, for analysis.
We created a plant watering system, controlled remotely by an Android application, for water scheduling, data logging, and system monitoring.
So how will it help, really?
Having a drop irrigation system, controlled by an application, via the cloud, gives remote control of watering from any, internet connected location. If your irrigated fields are any kind of distance from your home, base, or your simply away from your farm, a system likes this lets you react, in real time. If rain is forecasted you can pause irrigation until it’s needed again without needing to be on-site. You can adjust the scheduling of your irrigation remotely to meet weather conditions and growing needs.
It’s not just about control though, you can monitor water usage to manage your water source, and any related costs. If water is scarce, you can make sure every drop counts, scheduling for the best times of day, and manually overriding the system if some maintenance work needs to be done. Water is scarce, no matter where you are in the world. Even those of us lucky to have water on tap 24/7, should make every effort to conserve EVERY drop.
Automatic Drip Irrigation at the Michigan Urban Farming Initiative
“We used to just switch on the water and let it run for long time. Lots of water was wasted, and we weren’t sure if all the plants were getting enough water.” - Jeffery Pituch, MUFI
As a part of the volunteering effort, we wanted to get a drip irrigation network up and running at the Michigan Urban Farming Initiative. And, not just a regular network, but a smart internet controlled one! The work on the farm began in Fall 2016, and we currently have a 0.5-acre farm under drip irrigation. The goal is to have the full one acre farm under the drip irrigation network before the notorious Michigan winter sets in. Winter is coming, and there isn’t much time!
The Michigan Urban Farming Initiative is an all-volunteer 501(c)(3) non-profit organization that seeks to engage members of the community in sustainable agriculture. It is based in Detroit's North End community. The primary focus of MUFI is the redevelopment of a three-acre area in Detroit's North End, which is being positioned as an epicenter of urban agriculture. You can find more information on their webpage here: http://www.miufi.org/about
May 2016 Oct 2016.
How was the control system setup?
Our goal was to get a drip irrigation network up and running at the Michigan Urban Farming Initiative. Apart from the drip tapes, and pump setup, we also came up with a controller for scheduling the farm watering. In this section, I will give you a few more details about the controls architecture. The controller is a distributed control system and has four main components:
- Arduino Uno and circuit board
- Android Phone/Tablet as a part of the controller
- ThingSpeak IoT interface.
- Android App on User’s device for remote operation
Here is a high-level diagram to give a little bit of perspective:
- The Uno, being the versatile open source prototyping platform, was chosen for doing the low-level interaction with the solenoid valves and water pump.
- The Uno interfaces with the Android phone using Bluetooth. It receives the switch on and switch off signal from the phone, and periodically sends sensor data back.
- For the hardware connections and the sensors, I also created a small PCB for a cleaner look.
- Since cost was a concern, further improvements were made to reduce costs for the design, including a 50% size reduction for the PCB layout. A few of the “instructables” that were extremely helpful for me have been listed below:
- a. Use of an ATMEL328 instead of the full Arduino Uno to save costs. Check out this tutorial: Instructable tutorial: How to make Arduino from scratch
- b. Use of a separate PCB for the SSR board: Instructable: Build a Solid State Relay board
(Any Android phone/tablet will do. We used the Samsung Galaxy Core Prime.)
- The phone runs an Android app, and has the scheduling logic for the three farm zones.
- The phone is responsible for interfacing with ThingSpeak Cloud, and displaying controller status, and other farm data to the user.
- It also has an override button for manually operating the pump, and solenoid valves. This comes in handy if you want to do some maintenance work, or manual mode operation.
- This is the key component for ensuring that the system can be remotely operated.
- The ThingSpeak channels serve as the data store for all the scheduling data. And ThingSpeak is a free service, which is great!
- The Android App syncs this data periodically, so that the controller gets the updated information, in case a user has modified the schedule.
- Data becomes powerful when you can extract meaningful insights from it. Apart from the data storage, ThingSpeak also allows you to add custom MATLAB code that can be run on the cloud. This way, we can run analysis algorithms in the cloud itself, based on the farm data.
- Currently, jut to test things out, I am logging the farm temperature, and calculating the GDD i.e. Growing Degree Days for the farm.
- Based on this information, or just the logged temperature, we can also modify the schedule, or react to an event using one of the many ThingSpeak apps. I haven’t started using this yet, because we would like to collect data first, and then start doing the controls. We think that “Diagnose before you prescribe” is a good practice to follow.
- Another nice thing about the ThingSpeak service is that you can make the channels either private or public. For example, for the first zone of the farm, I have made the data public and you can view the water schedule and the temperature profile here.
- I have described only a small subset of the capabilities that I am using. But MathWorks has some great examples for you to get started on the ThingSpeak page. https://thingspeak.com/pages/learn_more
Android App for remote operation:
- The Android app was created using Android Studio.
- We did the android version, because, we are using the exact same front end for the controller and user. More information and snapshot of the app is in the timeline section below.
A brief timeline of the project in pictures
- Oct 2015 - First “Lab” test: Back in the day, the project started in an elaborate in-house test facility:
- Nov 2015 - Field test 1: Followed by a small proof of concept layout in a section of the farm. This is at the Michigan Urban farming facility in Detroit’s North End:
- April 2016 - Planning: The reason we started small was so that we could test various drip fittings and understand the pros and cons of different types of fittings. Going through this exercise also allowed us to get some hands on experience of working on a real farm and laying down the drip network!
- May 2016 - Farm setup: Once we locked down the parts, it was time to get half of the farm set up. We had to ensure that the sections are of similar size. Measure twice, and cut once was put in effect, and the results were well worth the effort.
- June 2016 - Field Test 2: With the hardware section complete in early summer of 2016, it was time to bring out the star attraction – the controller! We tested out the first version of the controller in the field with the partial drip network (0.25 acre) in place. While there were some issues with the pump sizing, the overall result was a huge success when the control system worked as expected. We had underestimated the total pressure loss in the system, and had to get a slightly larger pump to ensure that the farthest end of the farm also received adequate water. A visit to the local hardware store fixed that.
Abhishek Bhat and Jeff Pituch on farm
- Sept 2016 - Controller electronics: The PCB layout was created using Fritzing. This is by far the simplest software I have used. While this tool isn’t meant for heavy duty PCB design, it worked for my application. http://fritzing.org/home/ . With that out of the way, the only thing left to do was get the PCB printed, and set it up in a fancy box:
Controller with waterproof enclosure PCB + solid state relays
- June 2016: Ongoing - Android App Interface: The controller version of the android app is used with the PCB, while the user version is intended to be installed on a user’s phone/tablet:
- Dec 2016 - Cloud connectivity with ThingSpeak: ThingSpeak is an open IoT platform with MATLAB analytics. https://thingspeak.com/
https://thingspeak.com/channels/68082
- May 2017 - Smaller PCB: New iteration of the controller with 3d printed enclosure and a smaller PCB
- June 2017 – Installation: The system has been installed on the farm, and will be extended to the remaining 0.5 acres when the groundwork and laying down of the drip tapes is competed.
Currently, we are working on converting the remaining 0.5 acres to drip irrigation. By the end of the setup, we will also share the PCB layout, the 3D printed enclosure design, and the Android App online for others to recreate the setup. The goal is to ensure that similar projects can be undertaken in other communities.
There is a video that will be released soon that shows the full system and project in action. Stay tuned. If you would like more information, reach out in the comments section, and I can share my experiences with you.
Top Comments