Opamp for your garden


(You may want to have look at the improved version right away)

I admit that this has little to do with Arduino’s, but when working on my previous articles on moisture probes and garden irrigation with an Attiny, I mentioned using op-amp comparators instead of microcontrollers, so I thought I’d publish one like that as well.
The concept of an op-amp comparator is simple, if the ‘+’ gate is higher than the ‘-‘ gate, the output goes high, otherwise it goes low.
So with a humidity sensor attached in dry soil, the resistance of that sensor is high and therefore the voltage on the ‘-‘ gate is low and presumably lower than the voltage on the ‘+’ pin and therefore thge output of the opamp will go high.

This will switch on the Solidstate relay and the pump will start pumping. The water that flows into the plantbed will decrease the resistance between the humidity spikes, th evoltage on the ‘-‘ pin wil rise until it is above the level set with P1, the output will go low and the pump will be switched off.

Instead of a Solidstate relay you can also choose for a regular relay, hence the circuit around T1.

Capacitor C2 is in fact a bit optional. after the output of the op-amp goes low, C2 will still have a bit of charge that will keep the pump turn a little bit longer after the humidity is ‘enough’. It also gives a bit of delay in switching the pump on. This avoids jittering of the pump.

The value of R1 largely depends on the type of soil probe you decide to make. Some people have two spikes close together and that would call for a lower value of R1, some people choose to have the spikes at opposite sides of a plantbed, obviously that calls for a higher value of R1.

It is not really necessary to adapt R1, but if R1 and the resistance of the probe  in ‘almost to dry’ condition are far off, the gain of P1 will be limited.

As this is an Arduino dedicated site, I will pull the arduino in here as well. You could choose not to let the Arduino do the measuring of the soil through its analog gates, but you could hook up th eoutput of the above opamp to a digital port of the Arduino and only let it check high or low.
You could build, say 4 of these circuits, each (use a quad opamp then) and have your arduino just do the measuring of the outputs and take appropriate action.

this is a design that is for toner transfer. So you are looking at it from the pertinax side.  PDF design here. (NOTE There is  new design in which a flaw was eliminated)
Below the component placing on the PCB. Unfortunately (I use a different program for the circuit and the PCB as I dislike Fritzing’s circuit design), the numbering of the components is different, but it does not take a rocket scientist to figure it out.

U3 is the connector for the power. J1 is the connector for the probesu6 is there for a different spacing of the capacitor. U2, U4 and U5 are for a relay. U5 and U2 should be drilled according to the size of the relay you happen to use.
J2 is the switching output of the SSR. The entire PCB is about 4×5 cm.

Mounting components on the PCB

Power supply is 5-10 Volt. Depending on what type 741 you are using it could be up to 18 or 22 volts. If you feed with more than 10 Volts you need to recalculate and adapt the value of R2 in the circuit (unfortunately this has come out as R4 on the PCB design) . The forward voltage on the 39MF22 is 1.2 Volts, for a regular LED that is nominal 2 Volts. So if you would feed with say 15V and say 10 mA, you would need a resistor of  12.8/10=1.28k (say 1.4 k). With the current resistor you would have a current of12.8/0.330=39mA. That is too much for the 39MF22 (max 20 mA). The max supply voltage with the current 330 ohm resistor is in fact 10 Volts (and that is alreday pushing it with 20.6mA).

The current 330 Ohm resistor gives a value of 5.5 mA, which is just above the trigger current of the 39MF22.
Because of variations in resistor values and forward voltages of the LED, 330 might in some instances be just a bit too much if you are feeding the circuit with just 5 volts.  Try 220 or a 180 Ohm resistor then.

You should stick to the following minimal and maximal values of your resistor (in Ohm)

Voltage Min 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

As you may have noticed, there is a small mistake in the PCB design as that the LED and the resistor to the 39MF22 have been switched. This should not make any difference for the SSR version, but it may cause the Relay not to shut off. So if you are making the relay version, just switch the LED and the 330 Ohm (or adapted value) in position: The circuit is right, the PCB is wrong

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s