Automatic Plant Watering System
by NotADesigner in Workshop > 3D Printing
1247 Views, 20 Favorites, 0 Comments
Automatic Plant Watering System
Everyone loves plants, whether they are in your garden or in your home! But more often than not, I am speaking from experience, you forget to water them, which can sometimes kill them. To solve this problem I wanted to create an Automatic plant watering system or Apws.
In this Instructable I will show you how to build such an Apws and make it intelligent by displaying the moisture values in the cloud and connecting it to Google Home!
Supplies
The main components for this project are:
- Arduino Nano RP2040 Connect
- Moisture Sensor
- Servo
- PVC hose (6mm outer, 4mm inner diameter)
- 4-6x Screws
- 5mm drill bit
- 3x Wooden planks (size doesn't matter)
- PET water bottle
Additionally, you will need the following tools:
- 3D - Printer or 3D - printing service
- Computer or PC
- Cordless drill or screwdriver
Designing in Fusion
For this project I wanted to test out the different kinds of valves you can create in a 3D-printer. In my case, I designed a modified version of a ball valve. It simply works by turning a ball, or in this case a cylinder, with a hole in the middle by 90 degrees. The opening can therefore restrict or allow the flow of fluids through the valve. A detailed model of the valve I built is provided below.
As I am building a watering system I need a way to store water. Therefore I reused an old PET bottle and designed a holder to connect it to the frame, which is made out of wood. You will need to download the model of the valve and of the bottle holder, to print them in the later steps.
Assembling the Frame
The frame is one of the easiest parts to assemble for the watering system. You need 3 wood planks, 4-6 screws, a cordless drill or screwdriver and the 3D printed part named "Bottle holder". I recycled some parts from an old EPAL (Euro Pallet) to make my design even more sustainable.
1. You start by laying out the 3 planks in an upside-down U figure:
2. Then you can start drilling the 2-4 screws into the top plate like that:
3. After drilling in the screws to connect the planks, you will need the leftover screws to attach the part "Bottle holder" to the top plank:
Now you are finished with assembling the frame, you can now continue to the next step - soldering!
Soldering the Electronics
You will only need to solder 2 parts to the Arduino. The servo and the moisture sensor, all of which are quite straightforward.
1. Tin the cables of both the moisture sensor and the servo to make soldering them easier.
2. We will start by soldering the servo to the Arduino. To do this, you will need to connect the black wire to GND, the red wire to 3.3V and the yellow signal wire to D2.
3. Now we will connect the humidity sensor. The black wire will go to GND, the red one to D3 and the yellow signal wire to A0.
We are now finished with the wiring and can start with the final assembly of the Plant Watering System.
Final Assembly
After the assembly of the frame and the wiring, we can now connect everything together!
1. First, you should drill a hole into the bottle cap of the PET bottle, using the 5mm drill bit:
2. Now, cut off a third of the PVC hose:
3. Connect the shorter PVC hose and push it into the bottle cap. To make this step easier I recommend to cut off a small bit of the hose, to make it pointy:
4. Push the other end of the hose, which is connected to the bottle cap, into the valve:
5. Insert one side of the other piece of hose into the valve. You can now also push the cylinder into the valve while remembering that it should be in the closed state (the hole isn't in line with the inlets):
6. To complete the valve, screw the servo to the specific holes made for it. Attach it using the included screws for the servo:
7. As the last step, you should make a tiny hole in the bottom of the PET bottle in order to not create a vacuum in the bottle, when the water is released:
You are now finished with the hardware, continue to the software to make it functional!
Uploading the Code
Before we start uploading the code, it is important to know that Step 5 will only mention uploading the code directly to the Arduino, while Step 6 will explain how to set up the Arduino cloud and make the watering system a smart home appliance - which is way cooler.
1. Download the Arduino IDE
2. Open the IDE and file "Plant_Water.ino"
3. Upload the code, by clicking on the
When you have uploaded the code to the Arduino, this notification should pop up:
Now, you can use your Automatic Plant Watering System!
Downloads
Uploading the Cloud Code
#include <Servo.h> //Includes the Servo Library
#include "thingProperties.h" //Includes the thingsProperties.h folder
Servo servo; //Creates a servo object
const int power_pin = 3; //Defines all the pins we will use
const int servo_pin = 2;
const int sensor_pin = A0;
const int threshold = 500; //We will need a threshold to know when we should water the plant
void setup() {
Serial.begin(9600); //Allows for serial communication
delay(1500);
initProperties(); //Cloud setup
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
pinMode(power_pin, OUTPUT); //Defines the Pins
pinMode(sensor_pin, INPUT);
servo.attach(servo_pin); //Defines the servo pin
servo.write(0); //Closes the valve
}
void loop() {
ArduinoCloud.update(); //Makes the moisture value automatically update
// Your code here
digitalWrite(power_pin, HIGH); //To reduce the wear on the moisture sensor, we will only turn on the sensor all 60s
delay(5);
moisture = analogRead(sensor_pin); //Reads the signal of the sensor pin, which is the moisture sensor
digitalWrite(power_pin, LOW); //Turns off the sensor
if(moisture < threshold) { //If we have a moisture level under the threshold,
servo.write(90); //we will open the valve for
delay((500/moisture) * 1000) //(500: moisture) seconds, if we have a moisture level of 500, we will open the valve for 1 second
servo.write(0): //Closes the valve
}
serial.println("The moisture of you plant is: ")
serial.print(moisture); //Prints the moisutre level of the plant
delay(60000);
}
To make the Apws smart, we will need to connect it to the Arduino cloud, where we can control and adjust the connectivity of our Apws.
1. Log into the Arduino cloud or create an account:
2. Connect your Arduino by clicking on "Add devices":
3. Create a "Thing" and type in your internet credentials:
4. Add a cloud variable with the name "moisture":
5. Copy the code provided above and paste it into the Sketch tab:
6. Go to the Dashboard tab and create your own Dashboard! I made the dashboard display my past and current moisture levels, but the possibilities are endless! Be creative :)
Conclusion
This project was really fun! I got to know how valves work, how to make a smart home appliance using the Arduino cloud and find out how to use the moisture sensor. Now I don't have to think about watering my plant all the time. :)