An automatic plant watering system, that waters your plants at specific intervals, or if the soil is dry.
Project description
Introduction
This project uses 3x pumps, 3x relays and 3x soil moisture sensors, designed to take care of 3x plants. It uses the $ Arduino IoT Cloud $ platform to monitor and control the project. A specific widget called $ Time Scheduler $ is used to activate pumps at a specific time every day, unless the soil is already wet.
I will list all individual materials needed for this project, but you can also check out the $ Plant Watering Kit $ which includes all of the components needed, which is a bit easier to source.
Power Considerations
Pumps tend to draw a lot of current when starting up. For example, if your power supply is limited to 1000 mAh, and each pump draws 300~ mAh, you can expect issues running them at the same time.
To prevent any voltage drops or other issues caused by too high current consumption, it is best to activate only one pump at a time. This makes the project more stable. This all depends on what type of power supply you have. In this case, I used one with a 750 mAh limit, which is too low to run all pumps at the same time. I tested it, and it did not work well. As current spikes happen, the voltage drops and the Arduino board resets.
To prevent current spikes, I went with a "safe" solution, powering the Arduino board separately via USB. Now the Arduino can turn ON/OFF the relays at any time, without the risk of causing a board reset due to current spikes.
You can of course choose yourself how you'd want to power the board, but bear in mind that when the board resets, the relay can be stuck in a "closed" state, which means the pumps will pump until the water tank is empty.
Arduino IoT Cloud Setup
If you are unfamiliar with the Arduino IoT Cloud, please refer to the $ Getting Started Guide $ . This guide introduces the key concepts in the platform.
Thing Configuration
First, navigate to the $ Arduino IoT Cloud $ platform, and log in. If you have no account, the same link will take you to the registration.
Then create a new Thing, select/configure the device you want to use, and create the following variables:
- automatic_mode - boolean - Read & Write
- plant_schedule_1 - CloudSchedule - Read & Write
- plant_schedule_2 - CloudSchedule - Read & Write
- plant_schedule_3 - CloudSchedule - Read & Write
- relay_1 - boolean - Read & Write
- relay_2 - boolean - Read & Write
- relay_3 - boolean - Read & Write
- sensor_1 - int - Read Only
- sensor_2 - int - Read Only
- sensor_3 - int - Read Only
These variables will be used to read and control the sensors and relays. The plant_schedule_x variables will be used to schedule the 3 different pumps.
As stated earlier, it is best to only run one pump at the same time, considering the high current draw, so we will configure the pumps to activate at separate times.
Create Sketch
If you have created the variables above, you can now go to the "Sketch" tab. Here we will use the code that is attached to this project (found further down).
Copy and paste it into the editor, and upload it to the board. You can find comments in the code that explains how it works.
Once the code is uploaded to your board, open the Serial Monitor to check if the connection to the Cloud is working.