Auto Plant Watering System





Introduction: Auto Plant Watering System

About: Based in the UK. Primarily work in IT and enjoy all things electronic.

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

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.


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:


digitalWrite(relay, HIGH);

digitalWrite(led1, LOW);

digitalWrite(led2, HIGH);

if (sensorValue == 1) {

digitalWrite(led1, HIGH);

digitalWrite(led2, LOW);

digitalWrite(relay, LOW);



// run pump for 10 seconds

Serial.println("Finished watering"); }


// delay 1 second between reads


Step 3: 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.



  • Oil Contest

    Oil Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

47 Discussions

how to made this without BreadBoard?


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

1 reply

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 : . thanks

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.( Or any other idea.I'm waiting for your reply ASAP.
Thank you.

1 reply

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.

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?

6 replies

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.


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

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.

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

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.

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);



digitalWrite(relay, HIGH);

// run pump for 2 seconds

Serial.println("Finished watering"); }


// delay 1 hour between reads


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..

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


2 years ago

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

1 reply

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

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

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.

1 reply

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.