Self-Watering Plant

 by randofo
Featured
main1.jpg


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

1A.jpg
You will need:

(x1) 8" x 6" x 3" project enclosure (Radioshack #270-1809)
(x1) Multipurpose PC Board (Radioshack #276-150)
(x1) 5VDC SPDT micro relay (Radioshack #275-240)
(x1) 9V battery connector (Radioshack #270-324)
(x1) 9V battery holder (Radioshack #270-326)
(x1) 9V battery (Radioshack #23-853)
(x1) SPST micromini toggle switch (Radioshack #275-624)
(x1) 10K resistor (Radioshack #271-1126)
(x1) Size M coaxial DC power plug (Radioshack #274-1569)
(x1) Red and black 22AWG wire (Radioshack #278-1221)
(x1) 12AWG black wire (Radioshack #278-556)
(x1) Non-submersible electric water pump (via Amazon)
(x1) Water storage container with lid
(x2) 8-32 x 2.5" nuts and bolts
(x8) 4-40 x 1" nuts and bolts
(x1) 4-40 x 3/8" nut and bolt
(x4) 1/4" spacers
(x1) Wire nut
(x2) 3' - 5' plastic tubing
(x1) #8 Terminal Ring
(x1) House plant to water

Step 2: Trim the pump

2A.jpg
2B.jpg
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 3: Drill or cut

3A.jpg
3B.jpg
3C.jpg
3D.jpg
3E.jpg
3F.jpg
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 4: Mark

4A.jpg
4B.jpg
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 5: Drill

5A.jpg
5B.jpg
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 6: Drill more holes

6A.jpg
6B.jpg
6C.jpg
6D.jpg
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 7: Fasten

7A.jpg
7B.jpg
7C.jpg
Zip tie the water pump securely into the case.

Step 8: Cut the cord

8A.jpg
8B.jpg
Cut the pump's power cord about 6" from the pump's body.

Step 9: Start the PCB

9C.jpg
9A.jpg
9B.jpg
Solder the 5V relay to the board.

Solder a 10K resistor to one of the relay's coil pins.

Step 10: Attach wires

10A.jpg
Attach an 18" section of 12 AWG wire to the free pin of the 10K resistor. Solder a 6" section of black 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 11: Split the wires

11A.jpg
11B.jpg
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 12: Wire the power

12A.jpg
12B.jpg
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 13: Attach

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

Step 14: Wire nut

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

Step 15: Prep the cords

15A.jpg
15B.jpg
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 16: Prepare the probes

16A.jpg
16B.jpg
16C.jpg
16D.jpg
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 17: 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 18: Install the switch

18A.jpg
18B.jpg
18C.jpg
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 19: Program

19A.jpg
Plug in your Arduino and upload the following code:


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

Step 20: Install

20A.jpg
20B.jpg
Fasten the Arduino to the base of the project enclosure with nuts and bolts.

Step 21: 9V clip

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

Step 22: Plug it in

22A.jpg
22B.jpg
22C.jpg
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 23: Wire it up

23A.jpg
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 24: Case closed

24A.jpg
24B.jpg
24C.jpg
Put the lid on top of the project enclosure and use the hardware that came with it to fasten it shut.

Step 25: Drill

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

Step 26: Tubing

26A.jpg
26B.jpg
Cut the tubing in half.

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

Step 27: Probes

27A.jpg
27B.jpg
Insert the probes into your plant's soil about an inch apart.

Step 28: Place tube

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

Step 29: Insert tube

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

Step 30: Turn it on

30A.jpg
30B.jpg
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.
1-40 of 90Next »
marshath says: May 16, 2013. 9:34 AM
How is the witing connection done on the pc board?
And where does the pump get current frm? From the mains?
pcha says: May 8, 2013. 1:58 AM
Where is the soil sensor, or are the terminal ring the sensors. Please help I want to make this as a science fair project and need more information.
iApple guy says: Apr 23, 2013. 5:04 PM
Having a problem with the code:

Screenshot from 2013-04-23 17:02:45.png
randofo (author) in reply to iApple guyApr 24, 2013. 12:14 AM
put a ; after int dryValue = 700

It should be:
int dryValue = 700;
iApple guy says: Apr 23, 2013. 7:36 PM
expected unqualified-id before numeric constant
Ninjaco says: Apr 23, 2013. 12:27 PM
Hey,
I've got a question for you, How well does this work? Am I able to set the amount of water (ML) it will pump to my plant every day?? And how do I do that? Am I able fo adjust something in your code to change that or what?

peace!
jonmash says: Jul 31, 2012. 10:33 AM
Very nice post. I wouldn't worry about previous comments saying that grid voltage on a PCB is not a good idea. I use PCBs for 400VDC all of the time.

Only thing that I'd recommend is adding a diode across the relay winding to protect your Adruino. It is commonly called a flyback diode or a bypass diode.

What can happen is when the relay opens (or closes) you can get a back emf caused by the magnetic fields collapsing on the relay windings. This back emf MAY not be high enough to destroy your arduino but you never want to take a chance.
cgosh in reply to jonmashMar 4, 2013. 6:22 PM
@jonmash is correct.

Good practice is to always add a reverse-biased, high-voltage diode (1A at 400V, e.g., 1N4004, as low as 10 cents each) right at the pins of any wound coil (the relay coil in this circuit) if it's powered with DC from any semiconductor switch. Some relays even come with this diode already installed, so they must observe correct DC polarity. Positive end of the diode goes to the negative side of the circuit, so no current flows during normal use. Reverse-EMF occurs the instant the coil is **de-energized**. An energized coil of wire creates a magnetic field around itself (that's what makes the relay work by pulling the armature/switch). When the power is cut, this magnetic field collapses back into the coil and generates a brief, reverse-biased, high-voltage pulse into the circuit. The reverse-biased diode instantly shorts out this pulse. One pulse may or may not fry your electronics, but repeated blasts over time could easily do so (the bigger the coil, the more powerful the pulse). This is a very cheap addition to any circuit with a relay or solenoid.

I also agree with other posters that the best 'ible includes a schematic drawing to eliminate any confusion and to clarify the idea. Even if you just draw it the way it's laid out on the board, that's fine. Draw it on a piece of paper and shoot a photo.

Great concept and photos, BTW, and lots of good, clear, specific instructions. Thanks, and keep up the good work!
sakko303 says: Mar 4, 2013. 10:41 AM
I love this project, thanks! I see much nerd-dom in planning improvements, so allow me to add my idea. How about a piezo chirp (these always drive everyone nuts :/ ) on 2 possible conditions on your guys added ideas...

#1 - piezo chirp on plant is too dry (in case the device is activating but no water is present, the plant could get too dry, you would be notified)
-or-
#2 - piezo chirp on reservoir is empty.

Like I said, chirping devices usually drive people nuts, so feel free to replace piezo chirp with "twitter", "smack me in the head with a hammer", or "email my gardener, I don't have time for this ****".
mrdudej says: Mar 2, 2013. 10:02 PM
What was the total cost of this project with the arduino?

randofo (author) in reply to mrdudejMar 2, 2013. 3:37 PM
I don't remember.
Raveler1 says: Mar 2, 2013. 8:34 PM
(I am unable to post this as a reply to the comment on setting the dry value, so please forgive this post's location.)

A simple correction to the code would set the dry value whenever the device is turned on. Then, if you want to reset the dry value, simply turn off the device, wait for the dryness that you prefer, then turn it on. It would set to your plant's particular needs.

Thus in the code:
...
int dryValue = 700;
...

Delete the "=700", but be sure to leave the semicolon

Then in the setup section, below the serial communication section but before the closing } add:
...
// Set the "dry" value of soil on turning on the device. If you want to keep your plant more
// watered, set the soil to the minimum dampness before turning on your auto watering device
dryValue = analogRead(analogInPin);

//print the dry value to the serial monitor
Serial.print("dry value = " );
Serial.println(dryValue);
electronico1 says: Dec 12, 2012. 7:07 AM
Hi, I think have a mistake so in the list project dont included the Arduino circuit (the most important part of this project) please add the information of this circuit (where buy)
mrmerino in reply to electronico1Dec 13, 2012. 8:11 AM
Amazon, Ebay, Radioshack has them now. Just, almost anywhere that has electronics crap.
M.razik says: Dec 12, 2012. 1:59 PM
like :) I came with that idea too :D .
dubstepmaker says: Nov 28, 2012. 11:15 PM
awesome!
Gatoloco65 says: Nov 6, 2012. 4:58 PM
Hi very good project.

You could place the wiring diagram, it do not really understand how they connect the wires.

Thanks !!!

sorry no English.

Hola muy buen proyecto. 

Quisiera saber si es posible que coloques el esquema de conexión de los cables, tanto al modulo del arduino como a los del relevo (relay).

Gracias !!! 
R167 in reply to Gatoloco65Nov 18, 2012. 11:45 AM
I would really like a wiring diagram as well. Great job!
DELETED_awesome746 says: Aug 14, 2012. 9:14 AM
(removed by author or community request)
Adambowker98 in reply to DELETED_awesome746Oct 24, 2012. 6:15 PM
But then you would have to fill the main water reservoir...
R167 in reply to Adambowker98Nov 18, 2012. 11:44 AM
Or, You could just use a very long tube to go from a rain barrel outside to the plant inside. Problem solved!
Adambowker98 says: Oct 29, 2012. 4:01 PM
Does the pump come with tubes?
randofo (author) in reply to Adambowker98Oct 30, 2012. 9:54 AM
Nope. Need to get those from the local hardware store. They are usually a few cents a foot.
Adambowker98 says: Oct 24, 2012. 6:14 PM
If I was trying to power this pump with a battery (no relays or Arduino or anything) would I use a 9V? I'm working on a school project that needs to be portable so a battery is necessary.
randofo (author) in reply to Adambowker98Oct 25, 2012. 12:23 AM
You would need a different pump. Perhaps try this one:
http://www.goldmine-elec-products.com/prodinfo.asp?number=G19026

Not sure you can get it to run off 9V, but you could also get a bunch of AA batteries in series to make 12V.
Adambowker98 in reply to randofoOct 25, 2012. 3:39 AM
Why would I need a different pump?
randofo (author) in reply to Adambowker98Oct 25, 2012. 7:31 AM
An AC pump cannot run off of DC batteries. The wall socket produces 120V AC, which is 10 times more voltage than 12V and AC devices cannot run off of DC power supplies without converting the voltage. Even if you convert 12V DC to AC, it will not be enough voltage to run this pump.
Adambowker98 in reply to randofoOct 25, 2012. 8:50 AM
Oh, I see. I though the pump was being run off of a 9V in this instructable. I should have read a little better I guess.

Thanks!
BlackDidThis says: Jul 28, 2012. 12:54 AM
Great instuctable and a very helpful idea... one I am honestly planning on applying. But I shall have to agree with a lot of the comments/advices given... some very good pointers.

I would like to offer two that might be of also additive...
The first would be to propose using solar with the light sensing (Have the circuit hibernate through the day to prevent watering in high sun... And also have it charge-up)

The second is to remove the pump as is... Since that may oblige you to set a pump per plant as best as I can follow.
Why not set the water source in a rather high location. And then set a series of tubing from it. You can have the tips of the tubes "pinched" with a rather simple rotary action (Sort of like those on most high-pressure water guns with pump action). This would save crossing water with electricity and save some power via gravity doing most the work.

Arduino is definitely not of my strong sides... But shall I ever have the time (With the seriously helpful community on the matter); I would seriously like to see if I can tackle this.

Thank you very much for sharing this great idea with us
pilotniq in reply to BlackDidThisJul 31, 2012. 1:29 PM
A disadvantage of a gravity fed system is that a failure (leakage, tube disconnects, etc) of some sort could cause a catastrophic flooding, which wouldn't be very nice in an indoor environment.

My experience with pinch valves from biomedical labs OS that the tubes eventually (not n a very long time) lose their flexibility, causing problems. Also, last I looked into this it was easier and cheaper to find suitable pumps than valves on E-bay.
OCPik4chu in reply to pilotniqOct 15, 2012. 11:26 AM
Very true, I was looking today and I found many upon many options for very low power draw pumps for anywhere from $1-10 shipped. At only 12v and ~.25A you are not looking at much draw especially since they only run briefly. I was hoping to make a sweet setup using valves but its just not very feasible. And controlling them seperately is very easy since they would be digital.

I think also with some 'user specific' calibration, you wouldnt even need the analog inputs either, making it simpler to program, and to expand. using a combo of SIPO/PISO shift registers or something.

Two features I will be adding to mine will be spill detection and water level sensing but Im planning on doing a larger growing system than a single plant (still indoors though)

This is an incredibly well done 'ible and a great launching point to add more features to.
diy_bloke in reply to pilotniqAug 27, 2012. 10:49 AM
u are right. A gravity fed system also has a risc of syphoning, meaning that the water wont shut off anymore until the reservoir is empty
jman9895 says: Jul 31, 2012. 7:48 AM
i do not understand where the third red wire comes from, one from the soil probe, one from the relay coil, and one black wire from the junction of the 10k resistor and the other 12 gauge wire (according to step 9 or 10, where does the additional red wire come from.
obiwan314 in reply to jman9895Oct 10, 2012. 12:37 PM
I also had this problem. The pictures clearly show the coil control wires but I never saw a step that told me to connect them. After reviewing multiple pictures and looking at the pin outs on the relay I figured out where they went. Its not just you.

Step 10 clearly shows the coil wires already attached where they are absent in step 9. Perhaps there should be a step 9.5 stating how long the wires should be and where to attach them.

coil control.png
randofo (author) in reply to jman9895Jul 31, 2012. 10:00 AM
The soil moisture sensor involves a 10K resistor between pins A1 and ground, and a probe connected to pin A1. There is another probe/wire connected to +5V.

The other pair of red and black wires is connected to the relay coil.
adalew says: Sep 1, 2012. 3:59 AM
that´s one eye-candy instructable!
insanecandycane says: Jul 28, 2012. 10:06 AM
a geat project! what would it require to use more sensors to water more plants, useing gravity feed water, so no requirement of pump. lets say 100 plants with sensor for each one? i do not have any experiance with adrino, but i scrap for a living and alot of e-scrap!
jonmash in reply to insanecandycaneJul 31, 2012. 10:42 AM
I am not the original poster but I will share my thoughts anyway.

With this design, you require an Analog to Digital Converter (ADC) for every single plant. The ardiono only has 6. Not to mention a way of turning on and off the water valves for 100 plants.

To solve the limited ADC pins, I'd recommend looking into something called an Analog Multiplexor. What this will do is turn your single ADC pins into many ADC pins (but it can only sample one at a time).


I have no solution of how to control 100 separate valves
insanecandycane in reply to jonmashAug 1, 2012. 5:14 PM
what about a way to hook a mechanical timer with a large diameter wheel that would rotate 360 degrees in a 24 hour period. have the adrino hooked to slip rings near the spindle, and running out to the outside dia. of the wheel, with 2 pins running verticly threw the wheel to act as contacts. then use a degree wheel to evenly space the 2 pins around the outside diameter but underneath so as the wheel rotates it will make contact with a diffrent set of "contacts" at every point. small electric valves would then open and let water flow to the selected planter untill the sensors detected enough moisture and close the valve. the wheel could rotate like the hands on the clocks that jump to the next number instead of having a smooth constantly rotating hand.
seems like i just came up with the solution to my question.. thank you so much for your answer as that was what made me think "what if" now if i can just figure out exactly how to acomplish this feat.
my idea of 100 sensors was me thinking about small waist high planters , that can be moved to a diffrent location every year so you can plant the same vegi in the same place every year, but yet not in the same planter. to raise vegies organicly and no hybredisizing. i took organic crop production 2 years ago.
diy_bloke in reply to insanecandycaneAug 27, 2012. 6:10 PM
though i do not understand why you'd wanna measure and water a 100 plants seperately, there is a way to watering them without having to control 100 valves, but it might be as complicated as using 100 valves: move a nozzle with two steppermotors over an x and y axis until you get to the desired plant and spray
1-40 of 90Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!