In an earlier instructable, presenting an automatic garden watering project with an Attiny, I mentioned it could also be done with an op amp. So, let me put my money where my mouth is and present you one. It has an option to use a regular relay, or a solid state relay

Here is what you need:
1 Opamp UA741 (or LM741, or other '741 'type')
1 LED (red or green, for LED's with a high voltage drop, like blue, you may want to adapt R2)
1 resistor of 10-200k (I'll get back to that in the text)
1 resistor of 10-100 Ohm (whatever you have lying around)
1 reed switch (The small ones in a glass) if you can't find one, try a door contact
1 magnet
1 8 pins DIL IC foot
1 electrolytic capacitor 220uF 16-25 V (optional)
1 small submersible pump (I use a 5 W pump that pumps 430 l/h that is about 7 liters a minute) (Garden centers, eBay)

- if you chose to build the thing with a solid state relay add the following:
1 resistor 220 Ohm
1 solid state Relay (I use a 39MF22)
1 8 pins IC foot
1 resistor of 100 Ohm (optional)
1 capacitor of 100 nf 400 V (optional)

Note. I have chosen the 39MF22 solid-state relay because it is rather cheap. If you cannot find
it in your area, choose the mechanic relay. If that is no option consider replacing the solid state relay by an optocoupler with TRIAC. If you have a low voltage DC pump, consider switching it with a FET or transistor, or the mechanical relay

- if you chose to build it with a mechanical relay, add the following
1 resistor 1k
1 NPN transistor such as BC547
1 diode 1N4001
1 relay (make) voltage 5-18 Volt (depending on your situation)

A large bucket (DIY stores, I use one that is used to mix cement)
Tubing/Hose (DIY stores, garden stores)
Soldering iron
Double cable low voltage
110-220 V cable suitable for outside use (DIY stores)
2 galvanized nails or a galvanized clothes hanger (DIY store, your mothers closet), or 2 carbon rods from an old battery
heat shrink tubing
blank PCB of about 5x5 cm
Hydrochloric acid (drugstore, diy store)
Hydroxyperoxide (drugstore)
A watertight wall socket for outside use (DIY store)
A wallwart PSU of 5-15 Volt (depending on your situation).

Total cost
That is very difficult to say as I had much of the stuff already available. The most expensive was I think the pump (14 euro's). The electronic components are really nickle and dime stuff. A 741 cost 25 cents (euro's), the 39MF22 was 1.80 euro.
I used a watertight wall socket that I had available, but I think these are about 3 euro's. Everybody must already have a wallwart PSU available somewher.
Mains cables for outside use are not really cheap (say a euro/meter) but often you can get it cheaper and if you are a gardener, you may have something left over from a previous installation.
I am not really counting the chemicals for etching either coz I had these for other projects as well, but also that is very cheap.

If I just count stuff that I had to buy especially for this project, it may have costed me 20-25 euro's, but I guess that if you dont have that much stuff laying around, it could be 35-40 euro's.

I will cover the following steps:
The electronic circuit (Intro)
Printing the PCB (step 1)
Etching the PCB (step 2)
Mounting the components (step 3)
Using a stripboard instead of a PCB (step 4)
Making a humidity sensor out of galvanized material (step 5)
Making an alternative humidity sensor out of gypsum (step 6)
Making a level indicator (step 7)
On overview of the finished project (step 8)
Seeing it in action (step 9)
Expansions (step 10)

The circuit
The circuit is quite simple. P1 is used to set the level where the pump should start pumping. In dry soil the resistance of the spikes is high and the voltage on the inverting pin of the opamp is low. If that is lower than the voltage on the non-inverting pin (set by P1) the output will go high. This will activate the solidstate relay (a 39MF22) and or activate the mechanical relay. The PCB allows for both. The value of R1 is depending on your humidity sensor and the type of soil you use. For me 10 K was a good choice. In Step 4, where I describe the humidity sensor. I will tell you how to choose a good value for this resistor.

The pump that I use is a small submersible pump, used for small pond fountains. It pumps water from a container into a drip line in my veggie bed. Submersible pumps do not like to run dry, so we need some way to measure the waterlevel and to stop the pump when the level is too low. That is where S1 and R5 come in. S1 is a simple Normally Open float switch. I use a reed relay attached to the outside of the container and a floating device with a magnet on the inside (more about that later. When the level in the container goes too low, the float switch closes.
The trick is that I connect the floatswitch via a very small resistor (10-100 R) to the same terminals that the moisture sensor is attached to. So if the water level is too low, and the switch closes, there suddenly is a very low resistance over the humidity spikes and the 741 Op amp is 'tricked' into 'thinking' that the soil is wet enough and will switch off the pump.

You could use other switches than a reed relay, but this one has worked for me (I will come with some suggestions later)

C2 is not really necessary. One can put it in to give a bit of a delay with switchin the relay's on or off and thus avoid jittering.

The voltage to feed the 741 op amp is not so critical. Mine works on 5 Volts (I would not go much lower) but depending on the type of 741 you use you may go as high as 18 or 22 Volts. If you do though, you may want to recalculate R2. The current value of R2 is 220 Ohm.
In calculating the resistor value for other voltages, take the following in consideration: The 39MF22 has forward voltage of 1.2 Volts. Current should be between 5 and 20 mA. Most green or red LED's have a forward voltage of 2 Volts. Therefore the value of R should be at least (Vcc-3.2)/20 (gives value in kOhm) and at most (Vcc-3.2)/5 (gives value in kOhm).
So for 5 Volts this would be 1.8/20=90 Ohm till 1.8/5=360 Ohm

This table will save you calculating the value of R2:
Voltage Minimal value Max value
5 90 360
6 140 560
7 190 760
8 240 960
9 290 1160
10 340 1360
11 390 1560
12 440 1760
13 490 1960
14 540 2160
15 590 2360
16 640 2560
17 690 2760
18 740 2960
Values in Ohms. Just chose one sort of in the middle of the range for your voltage

The snubbing network around C1 and R3 is optional and most likely not necessary as I understand solid state relays to be quite capable of handling inductive loads. If you use it, put it in the wall socket (more about this later)

Step 1: Irrigating Your Garden With an Opamp: Printing the PCB

To facilitate construction, I have made a PCB, although you could also build this on veroboard or stripboard. You will find the PCB design here for download. (Note There is a new printdesign here) The design for the printed circuit is orientated to make it suitable for direct toner transfer. That means that the printed side will have to go against the copper.
The design as you see it on paper is as if you would be looking at it from the component side, so if you want to use this design for any other method than toner transfer, keep that in mind.

Though this is not a tutorial on how to make your own printed circuit boards, I will quickly lead you through the steps of how I did it. The pictures I use are not specifically from this board but from another board but the method is the same:

-Print the PDF on glossy paper in a 1:1 scale, and cut it out. This can be special photopaper but just printed paper from a glossy magazine do well. Some people use paper that is normally used in baking

-Thoroughly clean a piece of PCB of about 4x5 cm, use steelwool. (picture 2)
-Heat up a regular flat iron on its highest temperature (setting for linnen or cotton). (picture 3)
-Put the printed design, face down on the copper and hold it in place with your fingers
-Take the tip of the hot iron and put it on a spot neer the center and hold it there for a few seconds, while you still hold the paper in place.
-This should have fixated the design to the board so it won't move anymore.
-Now put the flat iron, completely on the paper and press it down
-Hold that for about 30 seconds, while presing firmly.
-Now use the tip of the iron to rub down every part of the paper.
-Throw it in some water (watch it, probably very hot) and leave it there for about 10 minutes. Dont forget to switch off your iron
-After 10 minutes, peel of as much paper as possible, use your thumbs to really rub hard.
-Throw it in water again to let is soak and then take off more paper
-Repeat this till all the paper is gone
-You will probably be left with a final very thin layer of paper that is hard to remove. Use a soft tootbrush to remove that.

Your PCB  now has its mask and is ready for etching . (picture 3)

Just one remark: the design you will download is very slightly different from the one you see below: I moved the position of the diode that protects the transistor from the relay, to make it easier to mount
<p>What is the concept behind using a 20k pot why not a simple resistor?</p><p>can u plz explain it....</p>
<p>because a resistor has a set value and a pot has a variable value.</p><p>In case it escaped you, the pot is there to st the level at which the irrigation has to start. that is different for all soils and how far the probes are apart, so it needs to be variable</p>
<p>In the above ckt diagram where D1 and pump are connected in parallel.from the fig its shown that LED is connected in series with transistor.My question is why the collector of the transistor is connected to LED. What is the use of transistor? Plzzzzzzzzzzzz reply.</p>
<p>I am sorry the base of transistor is connected to LED? What is the use of transistor?</p>
<p>read my earlier reply. I really cant make anything else of it: the transistor is there to drive the relay.<br>Which part of that sentence is it that you do not understand?</p>
<p>I am really not trying to be cocky here, if there is anything you still dont understand about the transistor please just ask, but as towards its function, there is only one answer as I have given</p>
<p>what is the use of transistor in the circuit? plz reply.</p>
<p>in the collector you will see a relay. The transistor's function is to drive the relay.<br>of course you do not need the transistor and relay if you chose for the solid state option</p>
<p>The PCB design shown above is for which relay.electromechanical or <br>solid state?I am doing this for my project and have used <br>electromechanical relay. It would be really nice if u can send the PCB <br>design when we are using electromechanical relay.</p>
<p>The PCB can be used for both. If you look in the text right under the pictures you will see a link to the PCB file</p>
<p>The PCB design shown above is for which relay.electromechanical or solid state?I am doing this for my project and have used electromechanical relay. It would be really nice if u can send the PCB design when we are using electromechanical relay.</p>
<p>no need for the caps lock<br>ofcourse it gets activated depending on the output of the opamp. If that output is high, the transitor opens and the relay is activated.<br>I never heard of a saturation mode of a relais,<br>But all in all it is very simple-&gt; soil dry, relais activated, switches on pump<br></p>
<p> can anyone please explain how to connect the pump JT-180 to the circuit and why is that diode connected across the pump?</p><p>since the pump have three wires and the pump has the following type of pin as shown in the image.</p>
yes, use the black and the red. Black goes to the collector, red goes to the Vcc.<br>The white wire remains unattached. It gives feedback over the RPM and we dont need that.<br><br>The diode is there to absorb spikes from the pump and thus protects the transistor
<p>thank you!! your reply really helped me out</p>
<p>my pleasure</p>
<p>plz tell the relay works in which mode?</p>
<p>not sure what you mean. it just switches OFF or ON</p>
In case I did not make it clear: the pipe that contains the floater with the magnet is pop rivieted to the bucket (at the top only)
You can edit your instructable to add that bit of info where its needed. Nice job by the way. Have you entered it into any of the <a href="https://www.instructables.com/id/Speed-Challenges/" rel="nofollow">challenges</a> yet?&nbsp; You may not get it in the Plan it- build it but it can go into the Kit design challenge.
Thanks yes it is in Gardening and make it Challenge :-)
IC39MF22 in not available in my area..plsz tell another number ic with the same function
<p>26mf12 (230 V only and no zero cross)<br>PR36MF22<br>AS0242<br>However, you will find most replacements fairly expensive. Have you considered using the transistor and relay?<br><br>Rather than paying top dollar for another solidstate relay you can also consider an optocoupler with Triac</p>
can i make this project with sim900D as my display for the temperature of the soil? <br> <br>thank you inadvance for your help <br>
The Sim900D as far as i know is a gsm module. I do not know it as a display. Regardless, this circuit is based on an op amp and that opamp has no way to send info to a display, there is also no temperature sensor so it would be a totally seperate project
Gypsum block sensors are a cheap method to make sensors for automated irrigation systems. Even though the problem is gypsum block polarization. Constant resistance values are cannot obtain. But according to papers &amp; journals , gypsum block polarization can be reduced by using AC voltage. But unfortunately, most of the soil moisture sensor circuit is works using DC voltage. <br>Another matter is what is the best electrode can be used to gypsum block?. I used galvanized electrodes, aluminum electrodes and SS 304 electrodes (Stainless Steel). But all of materials not suitable for long time (I used only a week). Because positive electrode is subject to corrosion. But aluminium is not corroded. But aluminium oxide is deposited on positive electrode. <br>Anyone can please help me to find polarization removal circuit or proper method &amp; how to select a proper material to make electrodes. <br> <br>Thanks <br>
sameeradis, thanks for yr reaction. If you go through the comments you will see two suggestions: using the carbon rods from old batteries of usung conductive plastic. I have tried gypsum and was not really that happy with it.<br> <br> If you are thinking of another circuit, check out my <a href="https://www.instructables.com/id/Watering-your-plants-with-a-microcontroller/" rel="nofollow">Attiny based irrigator</a>: Corrosion can be prevented by switching the electricity through the elektrode only 'on' when you do the actual measuring, as I have described in the article. The software already provides for that. If you are willing to sacrifice another I/O pin of the chip, you can take the positive from the one and the negative from the other and create yr own AC. For the actual measurement it does not make that much difference, as long as you know at what moment you are measuring :-)
I love your idea and design. Simple and functional! Another cheap probe I have used in soil is the carbon rod from a really cheap carbon battery (AA, C or D cell). I just peel the outside label off and pull on the positive terminal on the top with some pliers to remove the carbon rod. Just be careful not to break the rod or pull it loose from the positive tab glued to its top. Soldering to the metal tab (the positive terminal of the battery) is really easy. When inserted in the ground only the carbon rods contact the soil and they won't corrode at all.
Actually that is a good idea. I remember using those carbon rods long time ago for making a field telephone. Got them out of the old 4.5Volt batteries. I may give your idea a try for the new season
An even better idea is to use disposable electrically conductive plastic. We use conductive pipette tips in the research laboratory where I work. I used them to make a soil moisture meter I several years ago and it worked great. I just drilled a hole in each one and attached a stainless steel wire (a fishing leader) with a stainless bolt. A lot of items including some electronic tools are also made of conductive plastic so something that will work should not be difficult to find.
I will see if I can find some
Don't mess with your pump location, leave it at the bottom. The water level changes the inlet pressure at the pump, it's still pumping the same differential head. Good instructable, thanks!
Thanks for your input and the kind words
a video will be cool! :D
yes it would :-) however I did not make on and as it is freezing now, I dismantled the set up. <br>Still, the only thing you would see on a video is water squirting out of a pipe :-). <br> <br>I may add a video in the spring. I probably will have a complete new set up then as I am redesigning my garden.
nicely,neatly done project. gonna apply this at home.very easy to follow.thanks
Thanks. Should be very easy to do. Just a tip: depending on your pump and your delivery system, you may or may not experience syphoning of the water even if the pump switches off, if the water container is higher than your delivery system.<br><br>Soaker hose does not seem to have this problem, nor do sprinklers. I used an electric conduit pipe with 2 mm holes and that has some tendency for syphoning.<br><br>keep your water container at a lower level and you will not have this problem
brilliant! thanks so much... i'll be building one for my garden for sure. all we need now is a machine to do the weeds... :-)
You may want to consider building one with a power supplu already on the PCB. I am sure there is an ibble somewhere on an automatic lawnmower :-) <br>If you have problems with the build, dont hesitate to ask
Extremely Great Project and very well documented! <br>Cheers!
Thank you! <br>

About This Instructable




Bio: I am a physician by trade. After a career in the pharmeceutical world I decided to take it a bit slower and do things I ... More »
More by diy_bloke:Adding an MCP23017 I/O Extender to Arduino or ESP8266 Calculating Sunset and Sunrise for a Microcontroller A Simple MQTT Pub/Sub Node With Arduino UNO and ENC28J60 Ethernetshield 
Add instructable to: