Introduction: Watering Your Plants With an Op-amp

About: 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 like. Other than my hobbies that involves grassroots medicine in S.E.&P Asia. I have buil…

There is a more extended version of this instructable. You may wanna look there. I currently cannot 'unpublish' this short ibble'.

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.

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

As said, I use a reed relay, but you could also use a tilt switch or a pull switch that is attached to a floating device: when the level is low, the floater pulls a switch

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: 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  (value in kOhm) and at most (Vcc-3.2)/5  (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:
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

The snubbing network around C1 and R3 is optional and most likely not necessary as I understand solid state relys to be quite capable of handling inductive loads

Picture 2 shows the PCB  (download here). It is meant for direct toner transfer so you will be looking at the PCB from the component side.

You may see a small difference with the PCB as in the picture: I moved the diode a bit further away from the Relay as it was too close of a fit.

Picture 3 shows the (partly)  mounted PCB where I indicated the the new place for the Diode.

In case it is not clear. The circuit on the PCB acts as a switch and therefore would find itself in one of the leads to the pump.
You will find 3 holes in the PCB for the AC connection, but that is to cater for connectors with different pin spacing. the middel and left one are connected with eachother.

Picture 4 shows the moisture sensor I am using: 2 pieces of galvanized iron.
There has been a lot written on what to use as a moisture sensor, but galvanized iron works for me. You could also use a piece of gypsum with two spikes in it, but I find that too tedious


As the op amp has a bit of a hysteresis, the pump will switch off at a moisture content that is a bit higher than for switching on. That is a good thing, otherwise the pump would switch on very frequent for a short period.

If anybody would like to play with the print design, just leave a comment and I will upload the source file (Fritzing)

Like always when you are working with high voltages, make sure you always unplug it when you need to work on the circuit.
110 Volts  can and will kill you and 220 Volts will do it even faster. Dont be a fool!

Gardening Challenge

Participated in the
Gardening Challenge