Introduction: Automated Watering System
Ever wanted to keep your precious plants watered and know when they need water, when you are on a vacation or so?
This project uses and Arduino with Ethernet shield, to check the soil moisture level and when to water the plant.
The program measures the moisture level every 3 second and check it it is under a chosen threshold. If it is above, it measures 10 more time at find the mean along with the standard deviation to check if the plant needs to be watered. The current moisture level along with last calculated mean and standard deviation will be send to a web server, so it is possible to follow the plant.
Step 1: Parts List
These are the components needed for the project:
- 1 x Arduino Uno
- 1 x Ethernet Shield
- 1 x RJ45 cable
- 1 x Breadboard
- 1 x External power source (9-12V)
- 1 x MOSFET transistor
- 1 x Diode
- 1 x 9V battery
- 1 x Peristaltic pump
- 1 x Soil moisture kit (something like this)
- Jump wires
Note that the different components can be of different types and working range. Make sure that yours work safely together (Though in this case, most does).
Step 2: Circuit Overview
Here is the overview of the system.
Please note that the Arduino and the 9V battery is on common ground.
Step 3: Configure the Program
Download the attached .ino file and open it.
Here you should note 2 key variables.
- mac[ ]
UPPER_TH is the threshold which decides when the plant gets water. The higher the threshold the dryer the soil. the range goes from 0 to 1023 because of the A/D converter build into the Arduino. This sketch where build for a chiliplant, which does not need to much water. Thus, you might want to lower the threshold according to your plants need.
mac[ ] This is what your MAC adresse is for your Ethernet shield. You should change it to what i printed onto your board. If your board does not have one, simply make one up, as long it is not the same as some other device on you LAN.
Feel free to modify other parts of the program, like the MAX_DEVIATION, WATER_SECor other parts if needed.
Step 4: Configure the Router.
This step can be made into a big one and be a lot different depending on the manufacturer for the router, but i will try to keep it as short and simple as possible.
NB: connect you Arduino with your router and power before proceeding.
- Go to your browser and type in your routers IP-adresse (Typically 192.168.1.1 or 192.168.0.1) otherwise use google. The normal log in for a router is name: admin password: admin. Otherwise it should be printed on the router or in the manual.
- Go to your LAN settings and find something with DHCP Server and reserver a IP-adresse for your Arduino. You know you are dealing with the right device if your Mac adresse there is the same one found on the Arduino.
- Go to your WAN settings and the Port Forwarding settings. Here we port forward the port the Arduino is listing to (12345). Give it a name and select the port to be 12345 and the IP-adresse to be the one we reserved just above.
- You might want to disable your Firewall on the router for this to work.
- Now go to your browser and type http://"Your Reserved IP":"Port" (e.g. http://192.168.1.50:12345). Now you should see the webserver from the Arduino. Now find you WAN IP-adresse (can be done here) and paste that in, instead of your local IP-adresse. Note: Test this on a device that is not connected to your LAN.
- Note that something, like double NAT, will make it impossible to see the webserver outside of the LAN.
Step 5: Sum Up
You are now done. Hope it was useful to some, if you have any question will free to leave a comment.
I strongly recommend you to test it for a few days before going on a vacation or so, for safety reasons.
Have a good day and happy watering ;)