Self-Watering Plant

447K1.1K214

Intro: Self-Watering Plant

Plants liven up any space by adding a sense of airiness and life. That is - of course - when you don't forget to water them, and they shrivel up and die. I am very bad at remembering to water plants. That is why I built this self-watering plant to do it for me. Using a soil sensor, and an Arduino-controlled water pump, I have created a system that will never forget to do it. Instead of remembering to water my plants when the soil goes dry, I only have to remember to once and a while refill the water reservoir. In this way, I have decreased my obligation to these plants and put it off to a much later date. Perhaps further iterations of this device can be connected to a rain barrel so that I won't even have to worry about refilling my reservoir, and the entire system can be fully automated.

STEP 1: Go Get Stuff

You will need:

(x1) 8" x 6" x 3" project enclosure
(x1) Multipurpose PC Board
(x1) 5VDC SPDT micro relay
(x1) 9V battery connector
(x1) 9V battery clip
(x1) 9V battery
(x1) SPST mini toggle switch
(x1) 10K resistor
(x1) Size M coaxial DC power plug
(x1) Red and black 22AWG wire
(x1) 12AWG wire
(x1) Non-submersible electric water pump
(x1) Water storage container with lid
(x2) 8-32 x 2.5" bolts and nuts
(x8) 4-40 x 1" bolts and nuts
(x1) 4-40 x 3/8" bolt and nut
(x4) 1/4" spacers
(x1) Wire nut
(x2) 3' - 5' plastic tubing
(x1) #8 Terminal Ring
(x1) House plant to water

(Please note that some of the links on this page contain Amazon affiliate links. This does not change the price of any of the items for sale. However, I earn a small commission if you click on any of those links and buy anything. I reinvest this money into materials and tools for future projects. If you would like an alternate suggestion for a supplier of any of the parts, please let me know.)

STEP 2: Update 8/19/19: Schematic

I've added a schematic by popular demand.

STEP 3: Trim the Pump

Trim away any unnecessary plastic mounting brackets from the front of the pump that may prevent it from being flush with the case (nozzles and corresponding hardware not included).

STEP 4: Drill or Cut

Line up the water pump with the base of one of the 6" x 3" sides of the case.

Drill or cut a hole large enough to fit the nozzles through.

STEP 5: Mark

Position the water pump, Arduino, 9V battery holder, and circuit board in the bottom of the case.

Make marks in each of their mounting holes.

The pump will probably not have a mounting hole, so just make a mark on each side such that it can easily be zip tied down.

STEP 6: Drill

Drill all of the holes that you have just marked with a 1/8" drill bit.

You may need to widen the zip tie holes to 3/16".

STEP 7: Drill More Holes

On the 6" x 3" side of the case that has yet to be drilled, drill two centered 1/4" holes about 1-1/2" apart.

STEP 8: Fasten

Zip tie the water pump securely into the case.

STEP 9: Cut the Cord

Cut the pump's power cord about 6" from the pump's body.

STEP 10: Start the PCB

Solder the 5V relay to the board.

Solder a 10K resistor to one of the relay's coil pins. This will be the relay coil's ground pin. This pin should eventually get connected to ground on the Arduino board.

STEP 11: Attach Wires

Attach an 18" section of 12 AWG wire to the free pin of the 10K resistor. Solder a 6" section of red 22 AWG wire to this joint.

Attach an 18" section of 12 AWG wire to an unused part of the PCB. Solder a 6" section of red 22 AWG wire to this joint.

STEP 12: Split the Wires

Pass the cut power cord into the box through the 1/4" hole closest to the water pump.

Split the power cord such that each conductor is its own separate insulated strand for about 6".

Repeat this process for the cord going into the water pump.

They need to be separated because each cable is being wired to a different spot.

STEP 13: Wire the Power

Connect one of the strands from the water pump to the normally-open pin on the relay.

Connect one of the strands from the power cord to the common pin on the relay.

In this way, when the relay is powered up, AC power will be connected.

STEP 14: Attach

Attach the circuit board to the project box using 1/4" spacers, nuts and bolts.

STEP 15: Wire Nut

Attach the two free power cables from the pump and power cord together using a wire nut.

STEP 16: Prep the Cords

Kink the power cable on the inside of the box and cinch it in place with a zip tie to prevent it from being pulled back through.

Tie a knot in the two 12 AWG wires such that when they are passed through the remaining 1/4" hole there would only be tension on the knot (and not the circuit board) when you tug on them.

STEP 17: Prepare the Probes

Strip the end of each 12 AWG wire and clamp a terminal ring to the end.

Pass a bolt through each and fasten them in place firmly with the corresponding nuts.

STEP 18: Wire the Power

Solder the red wire from the 9V battery connector to one terminal of the SPST switch. Solder a 5" red wire to the other terminal of the SPST switch.

Unscrew the cover from the M-type plug and slide the cover onto the end of the remaining red and black wires.

Solder the black wire to the outer ground connection on the plug. Solder the red wire to the inner power connection.

Screw the cover back on.

STEP 19: Install the Switch

Drill a 1/4" hole in the 8" x 6" hole opposite the water pump.

Mount the switch into the hole using the mounting hardware.

STEP 20: Program

Plug in your Arduino and upload the following code:

<pre>/*
  Self-Watering Plant
  by Randy Sarafan
  
  Reads a soil moisture sensor and turns on a relay that controls a water pump.
  
  The soil moisture sensor involves a 10K resistor between pins A1 and ground,
  and a probe connected to pin A1 and another connected to +5V. These probes 
  are embedded and inch apart in the plant's soil.
  
  For more information, check out:
  https://www.instructables.com/id/Self-Watering-Plant/
 */


// Analog input pin that the soil moisture sensor is attached to
const int analogInPin = A1;  

// value read from the soil moisture sensor
int sensorValue = 0; 

 // if the readings from the soil sensor drop below this number, then turn on the pump
int dryValue = 700   

void setup() {
  
  pinMode(12, OUTPUT);
  
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);                   

  //Turns on the water pump if the soil is too dry
  //Increasing the delay will increase the amount of water pumped
  if(sensorValue < dryValue){
    digitalWrite(12, HIGH);
    delay(10000);
    digitalWrite(12, LOW);
  }
    
  // print the sensor to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.println(sensorValue);  

  //slow your roll - I mean... slow down the code a little
  delay(100);                     
}

Keep in mind that you may need to adjust the trigger threshold for your particular plant setup.

STEP 21: Install

Fasten the Arduino to the base of the project enclosure with nuts and bolts.

STEP 22: 9V Clip

Attach the 9V battery holder securely to the bottom of the project enclosure with a 4-40 x 3/8" nut and bolt.

STEP 23: Plug It In

Plug in the battery, and secure the battery in the battery holder.

If the Arduino lights up when you plugged in the battery, toggle the switch on the outside of the case to turn it off.

STEP 24: Wire It Up

Now is time to plug everything into the Arduino.

Plug the black wire from the circuit board to the ground socket on the Arduino.

Plug the red wire from the relay coil into digital pin 12 socket on the Arduino.

Plug the red wire connected to the 10K resistor to analog pin 1 socket.

Plug the red wire connected to the soil probe into the +5V socket.

STEP 25: Case Closed

Put the lid on top of the project enclosure and use the hardware that came with it to fasten it shut.

STEP 26: Drill

Drill a 3/8" hole in the top of the water container's lid.

STEP 27: Tubing

Cut the tubing in half.

Plug a tube into each of the pump's connector valves.

STEP 28: Probes

Insert the probes into your plant's soil about an inch apart.

STEP 29: Place Tube

Place the tube from the output of the water pump onto the top of the plant's soil bed.

STEP 30: Insert Tube

Fill your water container and insert the tube into the hole that you have previously drilled in the top.

STEP 31: Turn It On

Flick the switch to turn it on.

You should never have to water your plant again.

Now you just need to remember to refill the water reservoir.

Did you find this useful, fun, or entertaining?
Follow @madeineuphoria to see my latest projects.

189 Comments

Hi. Can you program this unit to water on a specified schedule for a specified time? That would probably be very popular, since all the ones on sale from ramazon are built in the same locale in China, and seem to be of very poor quality. If I can repair my own, it will work forever!
Good Morning...im shervin from malaysia..im doing this as a final year project in my college...so can u draw me a schematic by proteus or tell me what are the input and outputs...reply as soon as possible...thank you Mr...
Awesome man!! THANK YOU!! :)
why shall we connect a 10k resistor to a coil pin??
The soil moisture sensor involves a 10K resistor between pins A1 and ground,
and a probe connected to pin A1 and another connected to +5V. These probes
are embedded and inch apart in the plant's soil.
Is everything correct? because wiring in description is different from the wirings in the picture:
-"red wire connected to the 10K resistor to analog pin 1 socket." ...in the picture is connected to digital pin 12.
-"Plug the red wire from the relay coil into digital pin 12 socket on the Arduino." .. in the picture is connected to analog pin 1

please, double check!
The text is correct. Digital pin 12 is an output and turning the relay coil on and off. You can see that in the code. Ignore the picture.

//Turns on the water pump if the soil is too dry
//Increasing the delay will increase the amount of water pumped
if(sensorValue < dryValue){
digitalWrite(12, HIGH);
delay(10000);
digitalWrite(12, LOW);
}

wired up and everything but doesn't seem to work. Just flashes number on the serial from very high to very low rapidly. Also Relay doesn't seem to work even when i wire it up differently and force it to work, I can hear the internal switch clicking but the pump just stays on. I made sure non of my wires or solders are crossed.

Hello All,

Completed this project. I have a complete working project running off solar power (which is pretty awesome, just connects the usb from the Arduino to the usb port of a Goal Zero nomad 7).

My previous relay in me last comment was faulty so I got a new one. Please note that as far as I know, the above will not control the relay as it would appear. Instead of what he has above, I connected the 5v to one pin of the relay coil, and the other pin to the Arduino. I then have a wire from that 5v across the pc board and out to one of my sensors. The other sensor is hooked up totally separately from the relay with a gourd the pc board, a 10k resistor to a wire that connects to A0 (on the Arduino) and a wire to the other sensor that that junction.

hopefully this helps to those who are not having success. I am not comfortable making a circuit diagram to show what I did as I have no idea my self how to read them. I can send pics, or explain better how I did things to anyone who asks.

Hello, could you please send me pics of the wiring? tnx!!

could you please can send me understanding pictures to my mail psaucedon1@gmail.com

Hey, would you mind sending me pictures of how you did this a.k.a. the PCP board and where the wires go to. I would really like to do this project, but the pictures and instructions aren't very well detailed. If you could email it to river@riveralexander.net that would be great. Thanks for the help!

thanks 4 de tip, it worked just like you said..

Hi!

Would you post a pic of your setup? I'm a newbie here and couldn't make it work :(

Thanks a lot!

not sure how to annotate pictures, the green wire from the relay goes out to any digital pin (mine goes to pin 2), the red wire on the top part of the relay goes to 5v. the red wire across is soldered to one of the sensor wires.

The black wire goes out to ground on the arduino, the 10k resistor goes over and is connected to a green wire (show) that connects to one of the analog inputs (mine goes to A0) and underneath is soldered to the other sensor wire.

The red wire on the bottom of the relay goes out to one of the parts of the pump wire as he illustrates above, the other wire goes into the single pin of the relay (which is on the ver right of the picture)

let me know if you need me to clarify anything. I know nothing about circuits or anything, just did some googling and playing around on a bread board to figure this all out.

Hello, and thanks for the project, which is really interesting! Unfortunately the wiring is abit confusing. Could you please add a scehematic or a wiring diagram? Thank You!!

Can someone please help me with the wiring diagram between the relays, probes and the arduino. Quite confusing. Thanks in advance!

Yes, definitely confusing. I suggest to add a wiring diagram.

1. From the code given, the moisture sensor probes are sampled around every 10 seconds. I recommend not powering the sensor constantly to prevent corrosion of the probes. Use a digital pin to power the sensor & decrease the sampling rate.

2. The 9V battery which is used to power the relay will eventually drain out & will need to be recharged/replaced. Instead, you can modify the circuit such that it uses a single 9V DC supply to power the pump & Arduino. By replacing the Relay with a MOSFET, you can turn ON/OFF the pump without any switching sound.

I Made This and added a few tweaks to it including Bluetooth Control.

DIY Arduino Automatic Plant Watering System

https://www.instructables.com/id/Sprout-Modern-Indoor-Self-Watering-Planter/

Can 1 arduino control multiple pumps for independent vases?
More Comments