Introduction: Auto Plant Watering System

Picture of Auto Plant Watering System

I had this idea and I realised after that other people had too but thought I'd knock something up from parts I had. I was initially planning this as a how to build it for £5 but in all reality i think this probably comes under that quite easily without any major concessions. I took a photo of the parts I was planning to use but then I decided I would go the prototype route with no soldering so used a breadboard and the appropriate connectors. I don't do this enough really and it saves faf later on by not having to resolder things. I got this up and running really quickly which i was happy with.

I've put a small video showing the design in a little more detail which is included.

Oh and you shall notice I'm actually missing some tubing as I've not had a chance to purchase a tube to run from the water reservoir to the plant pot yet, going to get it this week.

Step 1: Wiring It All Up

Picture of Wiring It All Up

I used the following components

  • Arduino Uno (clone)
  • 2 x 220 resistor
  • Red LED
  • Green LED
  • Relay module (link)
  • Soil Moisture sensor (link)
  • 5-6v pump (link)
  • Breadboard
  • Powerbank

The soil moisture sensor was connected to pin 2

The relay module was connected to pin 3

The LED's were connected to pin's 4 and 5

Step 2: Code

The code is quite basic but I've put it on github as i plan to work on this so it's nice to have a common place to hold the code.

https://github.com/chickey/autowater

/*

Flower Soil Mosture Sensor

D2 - Soil Mosture Sensor

D3 - Relay module

D4:D5 - LEDS 1,2

LED1 - Green

LED2 - Red

Connect the Soil Moisture Sensor to Digital input pin 2 and your 2 led's to digital out 4-5

*/

int moistureSensor = 2;

int relay = 3;

int led1 = 4;

int led2 = 5;

void setup()

{

// setting the led pins to outputs

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

// setting the Relay pin to output

pinMode(relay, OUTPUT);

// Serial Begin so we can see the data from the moisture sensor in our serial input window.

Serial.begin(9600); }

// the loop routine runs over and over again forever:

void loop()

{

// read the input on digital pin 2:

int sensorValue = digitalRead(moistureSensor);

// print out the value you read:

Serial.println(sensorValue);

digitalWrite(relay, HIGH);

digitalWrite(led1, LOW);

digitalWrite(led2, HIGH);

if (sensorValue == 1) {

digitalWrite(led1, HIGH);

digitalWrite(led2, LOW);

digitalWrite(relay, LOW);

Serial.println("Watering");

delay(10000);

// run pump for 10 seconds

Serial.println("Finished watering"); }

delay(1000);

// delay 1 second between reads

}

Step 3: Conclusion

Picture of Conclusion

This is an extremely simple design and I plan to expand on it more, possibly looking into using either WiFi via ESP8266 or via radio with a NRF24L01+. The WiFi option has the advantage that I may be able to do away with the arduino then, just need to learn a bit of lua.

I should add my plants don't normally look like that lol, I grabbed a nearly dead plant from outside just to test the sensor with.

Comments

تحدياتق (author)2017-11-19

how to made this without BreadBoard?

Please:)

ColinH4 (author)2015-10-19

Yes of course that's what i have done in the example.

titanren (author)ColinH42017-07-30

Thank you for share it . I just done the project it is cool . but I have a question about the finish watering but the run pump about 7or 8 min stop .how can I change finishing watering pump can stop right the way . please email me the info to email : wfgtitan@gmail.com . thanks

Amila Dhanushka (author)2017-06-28

Hi !! Thank you for sharing us...I have done this project successfully. I want to improve this project by using a servo.I have components but I haven't enough knowledge. How can I do that? I really appreciate If you can sharing code and wired diagram.(amilawijesundara1@gmail.com). Or any other idea.I'm waiting for your reply ASAP.
Thank you.

ColinH4 (author)Amila Dhanushka2017-06-28

Hi the code is in the project and on github, the link for that is above. If you look in the comments you can see the wiring diagram i created, good luck with your project.

Shedlands (author)2015-10-15

Hi Thank you for sharing this project. As astoichkov a circuit diagram would have been useful especially as I would to know whether an arduino uno could control a number of plants with a number of relays and pumps?

ColinH4 (author)Shedlands2015-10-15

Thanks for the feedback guys, i really appreciate it. I've pulled together a quick diagram in fritzing which i've just discovered and have to say it's fantastic!!

I've just done it quickly over lunch so excuse any mistakes, i'll double check when i get home.

astoichkov (author)ColinH42015-10-15

Awesome! I have all parts to do this project. I wanted exact the same project for me. Well done! Very happy!

ColinH4 (author)astoichkov2015-10-15

Cool :-) I'm going to modify the code as running for 10 seconds is too long, it can pump a pint of water in that time frame easily so your always going to be running out of water. I think running for a few seconds and then waiting an hour or so before testing as was suggested would be best.

JonathanM257 (author)ColinH42016-11-06

Hi !!! I try to change that but when i modify the 10000 delay the pump doesnt stop before a new soil check :s.

ColinH4 (author)JonathanM2572016-11-06

Sorry it's been quite some time since i tinkered with this project and have actually take it apart as i moved house in the interim. I shall put it back together and test for you at somepoint. Thanks for the feedback.

JonathanM257 (author)ColinH42016-11-06

Hi!! Thx for your reply and for your work! It's OKAY ! I succeed to make it work with this code at the end:

---------------------------------------

if (sensorValue == 1) {

digitalWrite(led1, HIGH);

digitalWrite(led2, LOW);

digitalWrite(relay, LOW);

Serial.println("Watering");

delay(2000);

digitalWrite(relay, HIGH);

// run pump for 2 seconds

Serial.println("Finished watering"); }

delay(3600000);

// delay 1 hour between reads

---------------------------------------

ritesh9835 (author)2016-01-15

I followed the same circuit and same code. But i am not able to start my motor.All components i have configured. I don't know why its not working.. rest LED glow and all is working.. only problem with motor.

please help..

jackdanielss (author)2016-01-10

hey guys superp work!! thanks a lot..

i had only 1 problem.. i coudn't find 6 v pump.... i found only 12 v pump ... will it work with the same connections ?? and should i put 12 v source instead of 6 for the circuit.. will it affect or destroy the arduino or anything??

thanks sooo much

LeeD25 (author)2015-11-26

where can i find the code for this on github? i have had no luck

ColinH4 (author)LeeD252015-11-27

Hi sorry i thought i'd put the link in the text, i've not had a chance to progress with this unfortunatly so it's the same as in the instructable main text

https://github.com/chickey/autowater

positiveyeah (author)2015-11-02

Sir, the file about the auto water won't open.

ColinH4 (author)positiveyeah2015-11-08

Hi i take it you figured out that the file is a fizzing file and not the arduinio code file.

positiveyeah (author)2015-11-02

Hello, Sir. I have a question to you or to anyone who may read this. I am a college student and one of my projects is to create something with such design, so I chose to do this kind of project. I have been checking all the details and I just want to ask, how will the water from the tank (or any container) will start flowing right to the soil (Can you please complete the whole process, codes, etc regarding that)?

The process that I know now is this: buy materials, connect the arduino things and such and then input the codes, my problem is what to do next and on how my project will determine that the water should start flowing. Also, is there a way that the reading from the soil moisture sensor can be transferred to phones or any device?

Sorry, I know that for experts like you, this might sound a little annoying or maybe idiotic but I am just really desperate because I have little or no idea at all about these kinds of things and there's no one to help me here. I really need to pass my subject so please help me. Thank you so much to whoever might answer this.

ColinH4 (author)positiveyeah2015-11-02

Hi, all the code is in step 2 which will start water flowing for 10 seconds if the soil is detected as dry. In practice 10 seconds is too long so say 2 seconds would be sufficient. I'd also put a delay in the main loop so it only checks every say 1 hr at most otherwise you'll quickly run out of water.

Re checking on phones i'd look through other instructables for wifi using ESP8266, there are lots of examples out there.

Col

positiveyeah (author)ColinH42015-11-08

Okay sir, things have gotten better. I have connected all parts and my only concern now is just the coding. I have copied everything except for the parts of LEDs because I havent put any of that. Anyway, are the readings coming from the sensor numerical? Or are they just going to say High or Low? Thank you sir

ColinH4 (author)positiveyeah2015-11-08

Hi, i am using the sensors digital output so it is either a 0 or 1 as to the moisture content in the soil.

vdevaraj made it! (author)2015-10-28

thanks Colin for this wonderful project

vdevaraj (author)2015-10-27

iam new to arduino and relay module so please help me to connect which pin of relay to which pin of arduino.I got all the components and I connected it but its not working, so please help me

vdevaraj (author)2015-10-23

can I use 12v relay module board for this project Colin?

ColinH4 (author)vdevaraj2015-10-23

Yeah that should work fine, be careful if your powering the arduino from the same 12v source. The arduino is meant to be ok with 12v but i've ran into problems in the past so be careful when you hook it up.

OmkarJ2 (author)2015-10-22

hi guys....

i need some help.. will b glad if sum1 helps me out...

ya actually i must let u know dat im in d 9th grade... n im working on a project based on arduino but im facing sum problms with my code....

my project is about the automatic irrigation system... one who is dealing wid arduino may find this out veryyy familiar but im trying to do sum thing different with it...

d basic thing is dat the moisture sensor checks the moisture level of the soil and if it finds it low than the required level... the submersible pump pumps d water and irrigates the plant

.... but wht im doing different is dat..... im going to connect an HC-05 module (bluetooth) and i want that my IRRIGATION SYSTEM AUTHENTICATES ONLY WHEN AN ANDROID DEVICE GETS CONNECTED TO IT....

and i want this output through an app called bluetooth terminal of an android device..

Automatic irrigation system..

Farm no.1

(having 24 plants)

System initialising....

Calculating soil moisture...

soil moisture=xyz

Alert!! Soil moisture is low.. // ( if or else needed )

Calculating temperature...

temperature=xyz

temperature favourable for irrigation.... // ( no need of using "if" or "else"... idea is to show the temperature.. thats all... )

Soil moisure is low.. plants need to be irrigated...

Irrigation system initialising..

watering...

..

.

irrigation done!!!!

NEW soil moisture=xyz

NEW temperature=xyz

// and after this a delay of 5 sec.. and the system starts again..

Automatic irrigation system..

Farm no.1

(having 24 plants)

System initialising....

Calculating soil moisture...

soil moisture=xyz

YUP!! the moisture level is good.. no need of watering...

Calculating temperature...

temperature=xyz

temperature favourable for irrigation....

but the moisture level is well off... no need of irrigation..

NEW soil moisture=xyz

NEW temperature=xyz

PLS someone help me out for code... i know that the superiors will no more than half an hr.. for it.....

pls send me the code on my email.. omkarj1422001@gmail.com

i hope that sum people wud even hv liked this idea... SO plssssss help me people..

vdevaraj (author)2015-10-19

iam asking whether I can do this project with one relay and one soil moisture sensor, dude???

vdevaraj (author)2015-10-19

when I went to the soil moisture sensor link and relay module link it shows 10 pcs soil moisture sensor and 2 pcs relay module whether I want above-mentioned numbers or its enough to buy one on each,please tell me Bro

ColinH4 (author)vdevaraj2015-10-19

Hi,
Those are the links i used as i purchased 10 soil sensors and 2 relays. If you search ebay for the same titles you will see many sellers selling them individually.

Colin.

vdevaraj (author)ColinH42015-10-19

iam asking whether I can do this project with one relay and one soil moisture sensor, dude????

vdevaraj (author)ColinH42015-10-19

I am asking whether can I do this project with one relay and one soil moisture sensor,dude?

vdevaraj (author)2015-10-18

hi dude it's amazing I want to do it so pls tell the other components u used and how many it is???

ColinH4 (author)vdevaraj2015-10-19

Hi, all the components used are listed in the instructable as well as all the code. Good luck with the build :-)

Col

vbhushan (author)2015-10-18

Hey bro where is Tue video

ColinH4 (author)vbhushan2015-10-18

Hi, the video is in the first section of the instructable or were you meaning another video?

nasifamerc (author)2015-10-16

boss , I will be very glad if you share the whole diagram , and connection details......

ColinH4 (author)nasifamerc2015-10-16

Hi nasifamerc, i've put the circuit diagram in the project wiring it up section as well as in a reply in the comments. I think the one in the comments is a higher resolution version. I can put up the fritzing file if people want ?

TechJoint (author)2015-10-13

Awesome Will Wait for the one with the wifi

ColinH4 (author)TechJoint2015-10-15

Thanks, i think it will be a little while for the wifi version, i may add the wifi to the existing arduino setup which while wasteful it'll get it up and running quicker. Is there anything in particular you were wanting from the wifi, logging or remote control of the pump?

MightyNozzle (author)2015-10-12

Maybe its better measure the sensor every 2-6 hours, because of the galvanic corrosion. The plant won't die, after 1 second of dryness ;)
And my bonsai master suggest to water plants early morning, before sun rises. So the plant has enough water for the day.

ColinH4 (author)MightyNozzle2015-10-12

Hi sasdensas thanks for the comment. I've made it as simple as possible to begin with and agree with the corrosion comment as I've read that these are particularly susceptible. I was thinking as a follow up i'd introduce an LDR for detecting darkness to water only during the night, or at least with a high frequency during the day. I was thinking of introducing sleep mode as well inbetween measuring to conserve battery life too.

MightyNozzle (author)ColinH42015-10-13

It's a good idea to use a LDR or maybe using a algorithm to calculate the time when sun rises.

If you want save some power, you could use some low power uC like MSP430 from TI, a low power PIC or an ATtiny.

I'm also thinking about a watering system, using solar power, lithium charger, one 18650 battery, voltage converter (3.7 to 5V), the same pump, same soil moisture sensor and an ATtiny (Digispark).

ColinH4 (author)MightyNozzle2015-10-15

Hi i could look at calculating sunrise but that is a lot of work compared to an LDR which i have sitting spare, also for testing i can cover the LDR manually. Re saving power i'm keen on the arduino and ESP8266 at the moment as i'm a bit more comfortable with them but also have lots around too, may look into other things down the line. Regarding your project you should be able to detect when the solar cell isn't outputting any power so can detect night that way.

astoichkov (author)2015-10-13

Thanks for sharing... will be better if you make wiring diagram.

ColinH4 (author)astoichkov2015-10-13

Thanks astoichkov i shall create one soon and update the instructable.

astoichkov (author)ColinH42015-10-13

Cool! Looking forward for wiring diagram. Great project!

ColinH4 (author)astoichkov2015-10-15

Incase you didn't notice it diagram is in the project and also attached in a reply above.

About This Instructable

18,162views

347favorites

License:

Bio: Based in the UK. Primarily work in IT and enjoy all things electronic.
More by ColinH4:Wireless Solar charge controller monitor ( RS485 to WiFi using ESP 8266)Wifi controlled Garden light with ESP8266Smart Bluetooth Lightbulb review
Add instructable to: