Easiest Arduino Smart Plant Watering

9,010

82

23

Published

Introduction: Easiest Arduino Smart Plant Watering

About: 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 easier, we offer various development platform, mo...

Last time we wrote intructable on how to make an automatic plant watering system with arduino and sensors, our article gained a lot of attention and great feedback.

Afterwards, we’ve been thinking how could we make it better. It seems as our office grown also the number of flower pots in the office grown as well, and we needed a better more friendly watering solution. We came up with easy-to-make solution that will let us water up to 4 plants with one node! That’s incredible. With the previous solution we could only water 3 and also we needed them to be located one next to the other, which made it less convenient.

Our Solution: Smart Pump Shield

We got frustrated with all the jumpers and prototype boards so we came up with idea to develop our own shield. The shield contains 5 relays – 4 for the water switching mechanism and another one for the water pump, it has dedicated Crowtail interfaces for our sensors which eliminate the need for jumpers and breadboards and make the kit easy and fun to use! You can also use it as normal without Crowtail connectors for other projects you might come with!

Step 1: Gathering the Parts

To Process this instructables we'll need to use “Crowtail smart pump kit” which the link to it can be found right

The Kit will include:

- x4 Crowtail soil moisture sensors

- x1 Crowtail Smart Pump Shield

- x1 Crowtail Water Pump

- x1 12V Adapter

- x1 Four channels water valve

- x1 one long water pipe (later we'll cut it to 6 pieces for our project)

You will also Need Crowduino Uno / Arduino Uno for the project

Why This Kit?

- Eliminate the need of breadboard and jumpers

- Less mess more productivity!

- Easy to use, just plug and play, anyone can do it!

- 12v connector for the pump and split into 5v for the arduino as well!

- Control up to 4 flowers at once with one shield!

Step 2: Uploading the Code to the Arduino Board

The next step will be uploading our code to the Arduino board,

we do it first because after connecting all the sensors and pumps it might get a little bit messy and difficult to connect, better do it now when you only have the board in your hand!

the code can be found at the bottom of this instructable, make sure that you choose Arduino Uno regarding the device you use (Arduino Or Crowduino Uno) in the ArduinoIDE.

If you are not familiar with Arduino, follow the following steps:

1. connect your Arduino board by USB to your computer

2. open Arduino IDE (if you don't have it, make sure to download it from their official website)

3. Open the project we gave at the bottom of the Instructable page

4. On top of the Arduino IDE choose "Tools > Board > Arduino UNO"

5. Click the V sign to verify the code and then right next to it the arrow-right button to push the code!

Step 3: Connecting the Shield to the Arduino Board

Easy as it sounds - the next step will be connecting our smart pump shield to the arduino board.

NOTE: When you putting them one on top the other and connecting them together, make sure to do it slowly and easily as the Smart pump shield pins might be a bit sensitive.

After putting them together - it should look exactly as the picture below

Step 4: Connecting the Pump and the Switch

The Next step will be connecting our 4 channels switch that will control the water direction and the pump,

Moving to the switch:
It's difficult to miss - the switch is the biggest interface on the shield. make sure you place it at the right direction and it should *click* Now we got both pump and the switch connected to the board successfully

We'll start from the water pump:

if you look closely at your board, there are 6 crowtail interfaces aligned one with each other, this is the sensors interfaces. next to that there is one small lonely interface, smaller than the other one's - that's the pump interface.

you'll know it's the right interface when it will fit - the pump is the smallest interface between them all.

Step 5: Connecting the Soil Moisture Sensors

The next step will be connecting the soil moisture sensors, we'll use this sensors to detect the soil level inside the plants and determine if they need water or not.

We'll connect it by using the 4 out of 6 Crowtail sensors interfaces, because we use 4/6 we can use the other two to give more advanced features to our project, few examples can be:

- adding light sensors to know if the plants get enough lights

- adding humidity sensor to detect if the humidity is alright

- temperature sensor to make sure it's not too hot or too cold

- rain sensor to detect if it's raining now and no need to water them and more ...

The order of the sensors is as following

- A0 - Flower number 1, in the switch it's the first one close to the water source interface

- A1 - Flower Number 2, in the switch it's the second one from the direction of the water source interface.

- A2 - Flower Number 3, in the switch it's the third one from the direction of the water source interface.

- A3 - Flower Number 4, in the switch it's the fourth one from the direction of the water source interface.

NOTE: Make sure it's correct else the pump will give water to the wrong flower!

Step 6: Connecting the Water Pipes

This step require to gather some scissors or knife.

we'll need to take the water pipe from the kit and cut it to 6 parts.

make sure the length is identical and better if the pipe that goes inside the water source (in our case it's a bottle of water) will be long enough to reach the water.

after we finish cutting it - it's time to connect them!

we'll connect 2 of them into our pump, one of the pump sides sucking the water while the other one pushing the water out. it might be confusing at first which one is which but if you look very very carefully on the pump it says "IN" and "OUT" the one that is "IN" should go to the water source while the one that is "OUT" should go to the switch.

After connecting the pump we'll need to wire it to our switch. the switch have 5 inputs. 4 of them are lined up, those are going directly to the flowers, the one that is on the left side, goes to the pump OUTPUT.

The switch works by closing a circuit at specific channel - it will let the water flow, if no circuit been closed, the water could not flow. we'll be opening the channels by the demand of the flowers to get water, that way - only the flowers that need in water, will get it.

Step 7: Powering It Up!

The Last step will be - Powering it up!

Now, this is one of the best features in our board. both the pump and the switch requires 12v input while the arduino can only stand 5v, so instead of supplying different power supplies to the arduino, the pump and the switch we made our shield to split the power between the arduino and the other devices. that way - the arduino will get 5v while the pump and the switch will get 12v.

NOTE: When connecting the power supply, make sure to connect it into the shield board and NOT the arduino. there is NO need in two power supplies as the shield will give power to the arduino as well.

We hope you find this instructable useful, easy and fun! we worked hard to make the most simple yet powerful kit, you can use the smart shield not only for this projects but for others too! let us know what will you make and the way you use our kit.

Share

Recommendations

  • Woodworking Contest

    Woodworking Contest
  • Microcontroller Contest

    Microcontroller Contest
  • Make it Move Contest

    Make it Move Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

3 Questions

Please let us know the size of tubing required to extend the system?

hi.great kit. but how can i modify the code so that the values from the sensors are displayed on a 16x2 LCD with I2C ? many thanks

How do you attach the pump shield to the Crowtail Uno? Are there certain pins which must enter other pins?

Or is there a video availabke?

23 Comments

Anyone interested in better code? I adjusted the code so your pump doesn't pump when it's not safe (closed valves, too early starting). You get feedback on the serial monitor screen now also. My script waters plants, check a few minutes after water is settled and if everything s ok then it doesn't check again for the next 8 hours.

Also, the code that was given here didn't work propperly for me. Pump and valves sometimes just kept pumping and acting strange.

EDIT: NEW CODE WITHOUT ERRORS. Sorry old code was wrong old piece of copy pasta code. This new piece should work.

// set all moisture sensors PIN ID

int moisture1 = A0;

int moisture2 = A1;

int moisture3 = A2;

int moisture4 = A3;

// set water relays

int relay1 = 3;

int relay2 = 4;

int relay3 = 5;

int relay4 = 6;

//init valve nr

int x = 0;

// set water pump

int pump = 2;

//Water correct plant function

void waterPlant(int x) {

Serial.print("Opening: ");

Serial.print(x);

//Open valve x ==> x will contain value of correct relay[1-4]

digitalWrite(x, HIGH);

//We wait 0.5 seconds before opening pump so we are sure valve is open. This will prevent the pump from pushing water to a closed valve and risking the tubes to leak or wose, break loose.

delay(500);

//Open pump for 3 seconds

digitalWrite(pump, HIGH);

delay(10000);

//close pump

digitalWrite(pump, LOW);

delay(500);

digitalWrite(x, LOW);

//Make sure all valves are closed again.

closeAll();

}

void setup() {

// declare relay as output

pinMode(relay1, OUTPUT);

pinMode(relay2, OUTPUT);

pinMode(relay3, OUTPUT);

pinMode(relay4, OUTPUT);

// declare pump as output

pinMode(pump, OUTPUT);

// declare the ledPin as an OUTPUT:

Serial.begin(9600);

}

void loop() {

//print sensor values.

Serial.print(F("Sensor 1: "));

Serial.println(analogRead(moisture1));

Serial.print(F("Sensor 2: "));

Serial.println(analogRead(moisture2));

Serial.print(F("Sensor 3: "));

Serial.println(analogRead(moisture3));

Serial.print(F("Sensor 4: "));

Serial.println(analogRead(moisture4));

Serial.println("Check moisture");

//Go to moisture checkup function to se if plants need watering

checkMoisture();

// wait 8 hours and repeat the process

Serial.print("wait 2 hours \n ++++++++++++++ END +++++++++++++ \n");

delay(7200000);

}

// check which plant need water

// and open the switch for that specific plant

void checkMoisture() {

if (analogRead(moisture1) <= 550) {

waterPlant(relay1);

}

if (analogRead(moisture2) <= 550) {

waterPlant(relay2);

}

if (analogRead(moisture3) <= 550) {

waterPlant(relay3);

}

if (analogRead(moisture4) <= 550) {

waterPlant(relay4);

}

delay(120000);

if (analogRead(moisture1) <= 450 || analogRead(moisture2) <= 450 || analogRead(moisture3) <= 450 || analogRead(moisture4) <= 450) {

checkMoisture();

}

else {

closeAll();

}

}

// turn pump & valves off just to be sure.

void closeAll() {

Serial.println("closing pump + valves!");

digitalWrite(pump, LOW);

digitalWrite(relay1, LOW);

digitalWrite(relay2, LOW);

digitalWrite(relay3, LOW);

digitalWrite(relay4, LOW);

}

10 replies

How do you connect the LCD to this ?

I'm not the creator. I just boght set myself and upgraded the code that didn't do it for me.

I will definitely try this out as right now the pump turns on and never stop, no matter how wet the dirt becomes

What code did you use?

If you used my new code, perhaps you have connect the wrong tube to the wrong sensor. Make sure that sensor 1 is connected to valve one. If you upload the code, also open serial monitor in the arduino editor. It will give you the sensor values so you can see what sensor is suppose to open what tube.
YOu can shorten the check time by changing the delay(); value. Make the 720000 to 5000 for testing purpose. So you'll get A check every 5 seconds.

No I used the original code, but will try to upload yours and see if that fixes the problem.

Thanks for the code. I tried to upload it but i get the following error message: smart_pump_smarter.ino:67: error: 'x' was not declared in this scope

How can I define x? I can't figure it out.. Thanks!

I know, my bad, I uploaded wrong code. This one now would work.

Ok got it. The definition of x was missing. Now it works!

//Water correct plant function

void waterPlant(int x) {

Thank you. Will try it out. :-)

This isn't working for me. I followed the guide exactly and when I boot it up I'm getting a loud ticking sound and a blinking blue light.

Just got the kit and I found that the four valve are designed to work with compressed air. Using them with water, as in this project, will end up with water leaks. This valves are not designed to contain water back pressure coming from the valves outlet. Are you guys going to fix this?

3 replies

yeah, had a huge problem with this, more water leaked out of the valve than went out the tubes.

The valves are not realy leaking. It's probbly the water that comes back once the pump is closed. You need to make sure your valves are positioned higher compared to your other water sources or exits. I used some rope to hang them above the arduino and the pump and now i have 0 waterloss. Before I had same problem.

Hi, I have just noticed the same problem, water leaking from the valve! Is there any solution to this, and can it damage the valve itself? I'm afraid to use it :(

Hi Elecrow,

Same problem for me. I buy with package a Crowduino board but unfortunate the script doesn't load. receive a lot of error. anyway for this I wait support from elecrow.com. I replace this board with XDRdruino UNO..with this script was successfully loaded but Crowduino package woks randomly. sometimes work for some sensor but in most cases after pump is in function the

DC12V Four-Way Valve does not get impulse to open.

1 reply

I initially had the same issue with the Crowduino board it was a com port issue needed to be set to com 3. Read specs on board and overrode to reset as a Arduino Duemilanove Schematic seemed to work, will keep testing.

You guys have any more documentation on the shield that comes with this kit -- the various specs on the outputs etc. I recently bought this kit and was wondering on the shield's capabilities besides the water sensors, four valves and pump activation. It seems to have 5 alternate relay break outs but I need to know if these are the solenoid valves using these relays, and I have an extra relay or if all are accounted for: ie the pump relay, and the 4 solenoids. Also want to know which of the analog pins I can use and which are used. Looked everywhere on the elecrow website and I couldn't find the specs. Thanks for the help. It would help as well to include documentation on data collection and logging as it seems that a lot of users are interested in this aspect too.

hi.great kit. but how can i modify the code so that the values from the sensors are displayed on a 16x2 LCD with I2C ? many thanks