Introduction: Arduino Automatic Watering System for Plants Sprinkler

Picture of Arduino Automatic Watering System for Plants Sprinkler
Last month, Elecrow have left from the original office and moved to a new office. We will miss our original office where we worked so hard for more than two years, we will miss everything here, the desks, the windows, and those potted plants, that we cared for more than two years with our neighbor.
  Our neighbor, a design team, led by a man named Kimi, we had so many memories together in the difficult early days. Together we planted some potted plants in the balcony, to help us release when tired after a whole day hard working. But as we leave, Kimi team are so careless and they often go out for some shows, we all worry about that these plants will be thirsty as we leave.
  So, We decided to design an automatic watering system to ensure that these plants are still alive when we come back here the next time. It monitor the soil humidity of each potted plant, if the humidity too low, the pump automatically start to spray, in this way, Kimi team do not need to water those plants every day.

I have recorded a video for reference: http://v.youku.com/v_show/id_XNjQwNDk0ODg4.html

First, we prepared the following modules(all parts can find in www.elecrow.com):
1. Soil Moisture Sensor. Each flowerpot need such a soil moisture sensor to collect the humility data. the best advantage of this kind of sensor is, it is really cheap, while the disadvantage is that it may corrode after long-term usage. Of course, you can also use a better humidity sensors, such as the capacitive soil moisture sensor, but you may need to pay ten times the price.

2. A small pump plus a driver. A driver is to provide enough current for the pump, my application needs a spray distance about one meter, so this pump is enough. But if you need to make a system that needs a large spray range, you may need a larger pumps, or even a pressurized device to make the projectile even farther, such as the watering system in a tea garden.

3. Servo and Rotating Platform, to take the water pipe to water the target plot. In order to control the spray distance and angle, 2 servo wold be necessary.

4. Of course, the controller is a must, i use the Crowduino platform, plus anExpansion Board for easy connection.

5. Water pipes and the power supply is essential too, and, some wires would also be help.

OK, all things prepared, then let's get started.

Step 1: Install the Soil Moisture Sensor

Picture of Install the Soil Moisture Sensor

First, we connect the humidity sensors to the Crowduino via the expansion board. Plug the expansion board to Crowduino, and connect the sensors to the analog ports A0~A2 as the image. Each pot needs such a sensor to collect the moisture information, in my project, i use 3 pcs of this sensor. If you need more, connect the other sensors to the Crowduino analog ports too. You can use 5 sensors at most.

  Note that if you found the cables too short, you can use the extension cable to extend the length. Notice that you should ensure the connection right, just as the third image.

Plug the sensor into the soil, the sensor would report the moisture information to Crowduino: Hey, this pot is too dry, you need to do something! This kind of soil moisture sensor is cheap and stable, but it may corrode after a long-term usage such as one year, you can also use other soil moisture sensor such as the capacitive moisture sensor, but it may cost you much more.

Step 2: Build the Servo Rotating Platform

Picture of Build the Servo Rotating Platform

  In this step , i need to installed the servos onto the rotating platform, this platform can take the sprinkler pipe to rotate 160 degrees in horizontal and vertical direction.

  When installing the servo and bracket, in order to locate the pot location, you need to adjustment the "zero" position. First install the  program MedianValueSetting  to your Crowduino and make it run. And then install the servo_1 (the servo to control the horizontal position ) to the same direction of the base,  and the servo_2(the servo to control the vertical position) vertical to the base bracket as the image.

Step 3: Install the Pipe & Pump.

Picture of Install the Pipe & Pump.

  Two pipes are needed in this application, one for the water output and the other one for water input. First, plug one end of the water output pipe to the outlet of the pump, and fix the other end onto the rotating platform, i use the bonding cable to fix it, you can use any thing such as glues.  And then, plug the water input pipe to the inlet of pump, and the other end to a water tank, such as a mineral water bottles.

  Then, connect the power supply of the pump to the outlet of the driver board, Note that connect the “+”pole(with red mark) to “OUTC” of the driver, and “-” to “OUTD”.

Step 4: Connect Pump Driver to Crowduino

Picture of Connect Pump Driver to Crowduino

  Connect the inputs and power supply ports of the driver to Crowduino, connect these pins as following:
  Driver     <--> Crowduino
  INC        <-->  D6
  IND        <-->  D7
  VCC       <-->  VIN
  GND       <-->  GND

  Power the Crowduino via the DC Jack, connect a 9v power supply to this port. Up to here, the hardware of this automatic watering system has been created.

Step 5: Fix the Watering System Onto a Platform and Place It

Picture of Fix the Watering System Onto a Platform and Place It

  To fix this system. I mounted the whole system onto a paper box that we used to packaging our products. Of course, with screws or glues, you can install them onto any platform you want. But you need to adjust the distance and location in order to make it works with the firmware. In my application, i put the system with my pots as on the image, to make sure that the 3 plot plants can be all sprayed (Max Distance<30cm, and Angle <160 degree). 

Step 6: Adjust the Parameters Depending on the Application

Picture of Adjust the Parameters Depending on the Application

  Then we wrote the firmware, you can directly download the firmware: AutomaticWatering.zip . After downloading the program, open the soucecode, we need to set three main parameters:
1.servoPosition_x:
  The servoPosition_x  tells the servo how to rotate when spraying water to the flowerpot, it represents the pots coordinate positions relative to the “zero position” of the servo as in the image;
   In my application, i set 3 flowerpot, the servoPosition of flowerpot_1  is 20, it means the flower_1 center position is 20 degree relative to the "zero position", In this way, i set the flower_2 and flower_3 to 60 and 105 degree.

2 .Watering humidity threshold.
  The humidity sensor reports to humidity information of each plot to Crowduino in analog data range from 0 to 1023. greater data means the plot more moist . So we set the threshold to determine when to watering.  For example, i sent the threshold_1 to “105”, that means if the sensor reported data lower than 105 for some time, this Crowduino would think ”plot_1 needs some water, i should control the pump to watering the plot.” 
  As my test , Set the humidity threshold to 100~400 would be good, you can also determine the threshold depends on what kind plants, that is, for those plants that prefer a moist environment, a greater threshold number would be better, for those plants that prefer dry, such as the cactus, a litter threshold number would be better . If you want to get the current sensor reported data for your soil, there is also a moisture monitor program to help you.

3. Watering time
    This parameter tells the Crowduino how long to watering that pot. that is, if this is a large pot, you would need the pump watering this pot for a relative long time, if it is a small pot,  a short time would be OK. 

        

Step 7: Download the Firmware and Have a Try!

Picture of Download the Firmware and Have a Try!

  After setting these parameters, upload  the firmware to Crowduino and have a try, maybe you would need to modify the parameters some times to make the system perfects works with your application.
       Have a Nice time !

Comments

ramosjos321 (author)2017-10-30

Note, if you buy parts from Elecrow, you must select Tools\Board\"Arduino M0", otherwise you get errors.

ramosjos321 (author)2017-10-30

Did anyone get this thing to work as described in the instructables? I got the pump running but the horizontal and vertical motors keep running continuously. The horizontal motor runs continuously in one direction only, while the vertical motor runs back and forth. Any ideas what I could be doing wrong? Great project (if it ever works).

pms4ca (author)2017-08-18

can you please send me the code to the moisture monitoring program. I get a "Could not create a sketch" error. I cannot open. musicbytheresonance@gmail.com. I am not very creative with coding and so it would be helpful to get.

BTW great tutorial and instructions. Very nice to share with us :).

Captain Sephra (author)2017-08-16

I tried to make the pump myself in various ways and failed miserably, they were only able to raise water like 3-4 centimeters

esembiring (author)2017-04-28

can we powered this project with powerbank?

SzeC (author)2017-04-10

I managed to assemble the plant watering robot. some questions hope you can help me.

Regarding the hardware,

I'm using the arduino uno. For ind and inc connection to D6 and D7, there are three D7 three 3 D6 pins in a single white cluster, i'm using a female to female jumper wire connection, which pin of the 3 should i connect to or it doesn't matter.

Regarding the code, i'm uploading using the arduino IDE and the USB connection to load the program.

When loading the programs , i get the following errors:

1) automatic watering

Error:

exit status 1

'pos' was not declared in this scope

2) Moisture monitor program

Cannot create sketch

File name moisture monitor program.ino is invalid: ignored

java.io.IOException: No valid code files found

Thank you!

Sze Chong

SzeC (author)SzeC2017-04-11

Sharing the reply from elecrow here for the benefit of others:

Regarding the programs, add int pos ; on the top of void setup() ,like as bellow:

And I attached a new moisture monitor program code file to you.

Regarding the hardware:

The white cluster have three pins of D6 or D7:

SzeC (author)2017-04-10

May i know to which port should i connect the servo motors from the rotating platform

RizwanZ2 (author)2017-04-06

Can you please send me the code ? i do a research on this topic so please if you can send me the code via email , its better and very thankful to you .

e-mail- rizwanzubair36@gmail.com

filoup (author)2017-04-05

Hí,

Could you please send me the code. Very nice project.
cbarneaud@outlook.com

jamal.hassan (author)2017-04-05

can you send me the code

email: jamalh34@icloud.com

shehan93 (author)2017-04-03

Can you please send me the code ? i do a research on this topic so please if you can send me the code via email , its better and very thankful to you .

e-mail- shehanpalihawadana2@gmail.com

VictorB80 (author)2017-03-24

Could you send me the code? Please
Victor.b.r.2.4@gmail.com

antoniob132 (author)2017-03-15

can you send me code pls?
antonio.bartolic@gmail.com

sureshsiva (author)2017-02-25

can you send me code plsss

tamilarasank96@gmail.com

SzeC (author)2017-02-23

the links to the required material on the escrow sites seems to be all broken when i click on them return a 404 error. Anyway i can get escrow to deliver the entire pack of required materials to me?
Otherwise i have a few question. What are the actual search keywords for each of the items. Especially the small servo is it es08a mini?
What is the version of the crowduino if not what are other micro controller we can use that will be compatible with the code.
Is the code everyone referring to same the zipfiles in the documentation or have to request from author separately?

VamsiK66 (author)2017-02-20

can u send me code

vamsibv4@gmail.com

mahdianani (author)2017-02-18

can you send me code please?
areej-anani@hotmail.com
I need it very fast as you can

JayK120 (author)2017-02-16

send me the code jayesh.koli9@gmail.com

suryatej datla (author)2017-02-15

can someone please send me the code

suryatejdatla96@gmail.com

abhigyaan (author)2017-02-06

i need some help. I'm making this project using Arduino uno and breadboard. Can someone help

saruhasan (author)2017-02-02

can you please sent me the code.

saruhasan1998@gmail.com

SiddharthS71 (author)2017-01-07

Is there any way to prevent the sensor from corroding?

anindyauap1 (author)SiddharthS712017-01-21

.

babuka (author)2016-10-27

Can u please send me the code

uka_040184@yahoo.com

ginSlaw06 made it! (author)2016-10-18

can u help us out..?we are using an arduino,2n5551 transistor,1kohms resistor,12 volts water pump, and we need to supply 12 volts battery, we also use soil moisture sensor.......

we had search on the net program...but it seems it dont fit the program coz we are using 12 volts battery while on the link we searched they are using 5 volts water pump......

this our connection..can u help us the coding...pls....

our system is automatic plant watering system wherein....the moisture sensor itself will detect if the soil of the plant is wet or dry,,,,,if the sensor detect the soil of the plant is dry ....the water pump will water the plants and if the sensor detects the soil is wet,,,,,,the water pump will stop and will not water the plants....

can u help us out a complete program....

thanks....

thiis is my email addresses:

gina.henoguin143@gmail.com or ginahenoguin@yahoo.com

thanks..

hoping for your response...

ginSlaw06 (author)ginSlaw062016-10-18

we also use breadboard

OleP1 (author)2016-09-14

Just want to say thank your code. I used part of it and created my own. (Mainly the average sampling.)

This one is to only control solenoid valves and water based on moisture of each plant.

Anyway, here it is: https://github.com/oleost/WaterSystemArduino

Joja_al7rbi (author)OleP12016-10-09

Can u please send me the code​
Jo-oody15@hotmail.com

SumayahMonti (author)2016-10-09

Hi , I like this project so can you send me code PLEAS ?!

my emil :

sumayah.monti@gmail.com

jmandradiar (author)2016-09-08

The moisture monitor program is not opening...

ChristopherS57 (author)2015-10-10

Hi. Can I add a LED Shield to monitor the moisture level? Also, can I use Arduino Uno for the sketch?

Elecrow (author)ChristopherS572015-10-17

Of course, Crowduino is an Arduino compatible board.
add a Led shield/bar to show the moisture level is a good idea.

AbhiK14 (author)Elecrow2016-05-10

'Pos' was not declared in the scope there is a error ...what should i do...

Onno123 (author)AbhiK142016-08-17

I had the same problem. Seem to be a firmware issue. Try downloading Arduino version 1.0.2 and try again. Did the trick for me

proxyrat (author)2016-08-17

I have problems with corrosion with this type of sensor. Is possible to get capacitive sensor somewhere? Also in my case happened after some time of use that gear pump stopped working because plastic gear get lose between shaft motor and gear. I could hear the motor running but there was no water flow. I replaced pump with submersible brushless from ebay and works fine. Next time I'm gonna make similar automatic watering system like this: http://daisy.si/

Shricharan (author)2016-05-26

Hi, can I change the program to make it face only one plant, having only 1 soil moisture sensor and not have the servo rotating platform? If its possible, can you please help to send the changed code to my email thank you, i am doing a similar project like this, would really appreciate your help.

my email is shrixd@gmail.com

Thanks!

senthils7 (author)Shricharan2016-08-14

shricharan if u get the code pls forward to me also.....

mail: senthilsarves@gmail.com

Userph (author)Shricharan2016-06-16

hey Shricharan , does the admin sent you the codes for 1 soil moisture sensor ?? can i also have that one ?? thanks

Shricharan (author)Userph2016-06-16

Unfortunately I have yet to receive it, I'll send it to you if I get it

nonitech123 (author)Shricharan2016-07-09

Hi userph and Shricharan.. can anyone of you send me the codes for 1 soil moisture without the servo to my email ovuegbec@gmail.com

nikita01 (author)2016-07-28

Hi

Can you please send me the codes for this project at

nikita01saxena01@gmail.com

SoA3 (author)2016-07-24

can i get the image for the connection?

emunz07@gmail.com

Thanooja (author)2016-07-19

can we use this for a garden istead of indiviual pot plants???

Thanooja (author)2016-07-19

hello. i want to do this as my project can u help me???plz can u send me the codes and project details to my mail.plzzzz

mail id:thanoojarao@gmail.com

AnaF41 (author)2016-07-17

Hi ,I want to try this system . Can somebody send me the codes ?anaflores012.af@gmail.com

Thanks for the help !

Sayali S Vatsa (author)2016-07-16

I am weak in coding , really need the code . Please anyone send me the code . Thank you !
My email id - vatsasayali@gmail.com

nonitech123 (author)2016-07-09

Hi I'm interested in this project. Is it possible to change the codes to face only one plant without the servo. If possible can i get the codes to my email. ovuegbec@gmail.com Thanks.

EugeneM28 (author)2016-07-05

Hi. Can you send me the codes?

Here's my e-mail.

yahgumi@gmail.com

Good day :)

About This Instructable

291,827views

997favorites

Bio: Elecrow is an open hardware facilitation company based in Shenzhen. We integrate resources to serve new era of innovation. To make your making and innovation ... More »
More by Elecrow:Easiest Arduino Smart Plant WateringDIY Halloween Haunted House (Arduino Project)Arduino sunflower - An electronic sundancer
Add instructable to: