- For our project, we will be designing a method of watering various plants autonomously. We will do this by using a raspberry pi to monitor the moisture level in the soil and determine how much water should be added to the different types of plants. This will be done with a moisture level sensor designed for the arduino but that should work with the pi as well (we will need an analog to digital convertor for this). If water must be added, a solenoid also controlled by the pi will be opened and water will flow from the the water source to the plant until a sufficient level of moisture is detected by our moisture sensor in the soil. In order to water various plants and respect the differing needs of water for each plant we will 3D print a spigot for the water source that splits the water path into two directions. Each path will have its own solenoid that will open and close based on the specific plants needs. connected to the solenoids and the spigot will be drip irrigation tubing with button drippers attached to the sides of the tubing. We will also be using the raspberry pi to create a web based application (using Amazon AWS and PyCharm) for our system that will record logs of amount of water used, when water was used and moisture level in the soil. This application will solely be used for viewing results that will be updated every time the plant is watered. It will also be updated when the water level is critically low.
- Matt Wilson
- Sean Rogers
- Natalie Ng (TA)
- We would like to make a system that is both cost and water efficient.
- We would like to build on our understanding of coding and learn new techniques that will be useful to us as engineers.
- We want this system be compact enough so that it would be easy to install.
- Overall make everything run smoothly and give ourselves plenty of time to test out our project.
- Allow for the system to detect the water level in the water source.
- Learning how to design a web based app with the raspberry pi.
- Learning how to code in python and interfacing with the pi.
- Designing a mechanical component that does not take up too much space.
- Using the time we have efficiently and not digging ourselves into a hole.
- FC-28-D Soil Moisture Sensor - $5.00
- ADC for Raspberry Pi (MCP3008 - 8 Channel 10-Bit ADC with SPI interface) - $3.75
- Drip Irrigation Tubing (50ft) - $7.66
- 1.25 Gallon Plastic Water Bottle - $7.26
- Drip Irrigation Button Dripper - $7.37
- Potting Mix - $4.89
- One Pot - $1.26
- Water Level Sensors - $39.95
- Peristaltic Pump - $24.95
- 12V Power Source - $7.48
- Hosting Service - $7.67
- Raspberry Pi - Provided
- Breadboard - Provided
- Power Source - Provided
- Home Depot Sales Tax - $0.75
- Adafruit Shipping - $7.17
- Amazon Shipping - Free
- Total - $125.16
Design and Solutions
We started this project by looking at different sensors we could use for the system. We ended up ordering a moisture sensor, water level sensor, 12V relay(information about setting this up can be found here: 12V Relay Tutorial
), and a peristaltic pump. All of our purchases for the project can be found on the budget page. For the project to work, we also needed an analog to digital converter. This is because the raspberry pi is not able to take analog inputs on its own so the ADC is needed to convert the digital values into analog values. The circuit diagram to the right shows exactly how to wire all the sensors and how to connect the relay with the pump (this is also shown in our How To). We needed to use a relay because the water pump that we were using is powered by more than 5v, which is all the raspberry pi can supply. Once the wiring is correct and you have all the components, Implement the code SoilSolutions.py from our repository (Soilsolutions Repository
) onto your raspberry pi. Once you have finished this part, you can now move on to the website portion of the project. For the website part of this project, we used Amazon Web Services to host our website.
The first thing to do is make an AWS account. Once that has been done you should navigate to the services tab in the top right of the menu and find Elastic Beanstalk under the tab Compute. Click create environment and make sure you select web server environment. You can name your environment whatever you like. Under Platform, choose preconfigured platform and select Python as the platform you wish to use; also select sample application as the application code (this can be changed from the console menu). Once you environment is created and you are the console menu, you now need to upload and deploy a zip file for your website to be run on. This zip file will contain your python code, html code, css code, and anything else you need to make your website. The code i used is on the GitHub link above. The codes that were zipped together were application.py, requirements.txt, soilsolutions205.db, splash.html, dataview.html, and soilsolutions.css. Once you zip those files together, you can upload and deploy that zip file to the AWS server and once it has finished upload, you can click on the URL at the top of the console and access your website. If you would like to make the homepage of the website look different, you can edit our splash.html code and upload a new zipfile with a new splash.html. At this point nothing is being updated, but you can check that the table is there by entering your URL with the following "/get?id=test" this will show the data points in a table with all there values as test. This is because of the application.py code that defines test and what the values will be when id = test. Because the pi has not been involved, we need to implement a way to update the pi. This is done by adding the code input_data.py into our application.py code(we have already done this). This basically sets the pis ID value to whatever ID you make it and updates the data values based on the results of your sensors. We set our pis ID to 1 (see application.py) so when we type in the browser URL + /get?id=1 it will return the values for our pi. This is the end of the steps for the website. It is secure in a sense that nothing but your pi can affect the data but not secure because anyone can input your ID number and see your data.
The project was a success and we completed it with many of our goals satisfied. The website portion of the project was completed but was delayed until after the demonstration. All of the sensors were working and producing values that coincided with our expected results. The website is now functional and is secure from any outside sources trying to distort values but there is no password protection on the values themselves (meaning anyone can view anyones values). All of our modules were completed and we were proud of our results but our projected did consist of a couple of technical difficulties along the way. The original way we were going to dispense the water was with Solenoids and 3D printed parts that connect them. This became very unreliable due to not being able to achieve the minimum pressure on the solenoids needed to stop leakage. As a result we decided to ditch the solenoids last minute and use a peristaltic pump that was much more reliable. We also had some trouble with the website due to some security issues with our hosting provider. We just had to scrap the platform we were using and switch back to AWS which was our original plan. This became a better way to do and met our expectations a lot better. The system did not really meet our cost efficient objective but we did make it water efficient (the pump stops flowing water right when the system turns off meaning we won't have an excess flow of water). The project runs smoothly and detects the water lever and moisture levels accordingly. The objectives we made were met and we are happy with the outcome. Below you will find a video of our project along with the poster used in our demonstration.