loading

Disclaimer: I'm not an electronics engineer, so I cannot offer any warranty for the design (much less for your implementation). I only know the presented solution worked for me for at least about 5-6 months (so I can't even vouch for its reliability over longer periods). Also, take my hints on where to source your components just as they are: hints only, not recommendations and certainly not endorsements.

Prerequisite knowledge (things I won't explain): how to solder your components and how to compile and upload a sketch on an Arduino board.

Resource repository: start on http://acolomitchi.github.io/cap-soil-moisture-v2 and, after reading about the content of it, get to the github repository.

Why yet another automatic watering system? Some time ago I bought a piece of acreage some hundred kilometres or so from home, no power connection, with the idea I'll plant some fruit trees – weekend farmer, you see? And so I did.

Except that the Godzilla El Nino was announced; even in a normal year Melbournian summer is sort of dry, El Nino didn't look as a good prospect for the survival of some just planted trees. Even more so as temperatures of 40℃ usually come with strong hot winds from the Australia's centre, winds which will dry the soil in hours. And I can't get there in less than 2 hours and definitely I can do it in weekends only.

So, what I needed:

  • an automatic watering system with soil moisture detector...
  • … as cheap as possible (if I am to scale up later to hundreds of them)...
  • … as low tech watering assembly as possible (low pressure “mains” - 1 meter of water head or less) …
  • ... as low consumption as possible (no power grid available)

Additionally, the soil is slightly acidic, not a problem for the just-planted tree species I needed to water but definitely going to affect any resistive probe, running the risk of increased resistance due to corrosion in a matter of weeks (and thus wasting precious water... only to make the corrosion worse): capacitive soil probe it is, then.

The principle - well, simple.

For the probe, etch a planar capacitor with coplanar plates from a piece of PBC (actually, a two sided PCB, but the pattern etched on the two sides is the same). The theory - since the water has a higher electric permittivity than the soil, when the soils is moist the capacitance of the probe increases.

For the controller: anything that can detect somehow the change in the probe capacity and trigger the watering. In brief, the design is a NE555 astable using the moisture probe as the charge/discharge capacitor, with an Arduino mini-pro used to count the pulses in a given time, the later also triggering the water when needed.

For the watering assembly: KISS principle – a mini fish-tank centrifugal pump, pushing water up to a hight of a bit above 1 meter (slightly above the max level of water in an IBC/pallet tank), into the ascending branch of a poly tube – just punch a small hole in the descending branch to stop it syphoning when the pump stops.

The BoM is as follows:

  • 1x Arduino Pro Mini with ATM168 at 5V/16MHz – in my experience, clones are OK and much cheaper
  • 1x NE555
  • 1 x 2N5551 – NPN transistor
  • resistors: 2x 470R, 1x 4k7
  • electrolytic capacitors: 2x 10uF
  • trimpot: 1x50k – if using my PCB design, take a vertical one with a 2.54 mm pitch between terminals.
  • diode: 1x 1N4148
  • fish tank submersible water pump 12V, 3 meter water head or equivalent – the “submersible” capability is not absolutely needed, but if it is so then you can use it outside without any other extra protection.
    Warning: as the 2N5551 is used as a relay, don't go with the power of the water pump over 6W (I'm using a 5W one) – the transistor is rated to 600mA max.
    Also, this design requires 12V powered pumps - the lower the pump voltage, the higher the current needed to perform the same work. If you go with lower voltage/higher current (e.g. 6V), the controller logic will work just fine, but you will need to replace the 2N5551 "relay transistor" with something supporting a higher max current.
  • some lengths of flexible tubing with internal diameter to fit the outlet of your chosen pump
  • jumper wire (to connect the probe, power, pump at least)
  • 12V supply – I'm using a set of two 4R25X (lantern) 6V batteries – in my experience, for a good 4 months between battery changes

If this is your first project using Arduino Pro Mini (congrats, not only they are useful and a great fun, but cheap as well), you will need:

  • 1x UART Module USB 2.0 To TTL Converter at 5V
  • 1x mini USB 2.0 cable
  • 4x female-to-female DuPont cables

to upload the sketch into Arduino's flash and to use for serial comms – you'll get to reuse them across projects.

Supplementary, if you decide to go with my PCB design, the following connectors:

  • 1x 40 pin male header single row breakable, 2.54mm pitch – you won't use them all
  • 2x 12pin female header row 2.54mm pitch – or use a single 40x one which you'll split to get 2x12 pin (just use a cutter to scarify a shallow groove in it and then break along the groove)
  • 5x 1 pin DuPont wire female pin
  • 7x 1 pin DuPont pin housing
  • 1x 2 pin DuPont pin housing
  • optional – 2x 2 pin 5mm terminal block – power in and pump (out) will be mounted here. Alternatively, use some extra DuPont female pins to connect them, if you feel like you don't need a stronger mechanical connection (just add 4 more DuPont female pins 2x 2pin DuPont housing). Or just solder the wires on the board (I preferred to have them detachable)

The box/enclosure/housing for the circuit is let as a homework for the reader – if you want to follow my PCB design (presented below), the panel is 45x45mm, with 3mm mounting holes in the corners and 40mm between the hole centres.

Tools

  • solder iron, solder, flux – you know the drill
  • crimping tool for the DuPont pins
  • whatever you want to use to print, etch, drill your PBC (if you really-really are a DIY-er, but go to your friendly local PBC fab shop – if you are tight on budget and/or you local PCB shop is not as price friendly as you expect, there's always the pcbway.com way).

Approximate price for the whole

After some extreme adventures in low-tech DIY land (which I set into the addendum at the end of this article), I ended into outsourcing the probes and the controller boards to pcbway.com – far cheaper than I could do it myself in any reasonable time.

I also sourced most of the components from ebay or aliexpress.com – my personal experience tells me the Arduino Pro Mini clones and the rest of the components do work in a situation as simple as this one. And, come on, you got to admit the price difference for an Arduino Pro Mini from $1.25 on aliexpress to $9.95 on digikey/sparkfun is quite significant. Especially when the entire controller, capacitive probe and minipump, components and PCB fab outsourcing, including postage, can be had on below $9.20 each, with components to spare at the end! True, this is the price I got for a quantity of 40 – which got me to less than $400 in total. For details, see "Hints for sourcing dirt cheap components"

Step 1: The Soil Moisture Probe

A double side patterned PCB acting as a planar capacitor with coplanar plates - see the first diagram (qualitative explanation only).
The simplest would look like two combs with interleaving teeth. After some experimentation, I settled to a pattern presented on the second photo of this section; the pattern is repeated identically on the two faces of the PCB (you can find the Gerber files into the project's github repository)

Just feel free to let you mind/hands run wild with whatever pattern you like, but keep in mind these hints derived from my experience:

  1. the longer the traces (and the closer one to another) – the higher the capacitance of the probe, thus less sensitivity to parasitic capacitance (e.g the connecting wires); but, starting with an initial copper area, longer traces means will mean more copper surface to etch away, thus a lower contribution of the surrounding medium on the capacitance of the probe.
  2. aligning the traces on the two faces of the PCB. Remember? We want to measure changes in the capacitance of the surrounding soil, thus those electric field lines better close through the soil rather than through the PCB plastic substrate. (see d. in the first diagram of this section)
  3. you do not want to measure only the moisture of the top layer of your soil, so you need you probe a bit on the longish side. However, you do not want the probe to feel the last remnant of water in the deeper layer while the upper roots are dying waiting for the water. For some just-planted trees (bought bare-rooted) or ornamentals in largish pots, probably 100-150 mm in length is fine. If you want to use it for some shallow-root plants, a 100 mm in length could be enough (if you stick it obliquely into the soil – if a shallower depth is needed, you'll want to increase the width of the probe to keep enough area).

No matter what you do, any reasonable sized capacitive probe will have a very small capacity – in my experience around 80-200pF in air. The capacity is difficult to measure directly because the probe is designed to pick influences for external environment (you want to measure the moisture in the soil surrounding your probe, don't you?) thus anything around it, especially conductive media (such as a human body), is going to induce a change in its capacitance value.

Anyway, the important thing to be said here: when connecting the probe to the controller, use as short wires as you can afford – even after the probe is sunk into the soil (thus isolated from outside influences), these wires will still be able to pick external presences and influence notably the count of pulses – fortunately not significant enough to make this project unusable.

Last word of caution before the specific details: after soldering the connection wires to the probe, make sure that the connection is thoroughly insulated; the currents in the probe are on the order of microampere or less; unless the soil is bone dry, it is going to be able to conduct such small currents, thus shorting your probe.

Initially, I used a drop of superglue to cover each connection, but I discovered that superglue does not cure in volume as fast as it glues surfaces; as it tends to form a layer of dried glue on the surface of the drop while the interior can remain liquid/uncured for days. As such, I switched to "acrylic nail monomer+powder" (search ebay) and obtained an adherent, hard (and coloured) drop of plexiglass protecting the connection. Perhaps an overkill, but I didn't want to lose my just planted trees to an Australian summer during the “Godzilla El Nino” event.

Finally, the second photo of the section presents the probe in its two "incarnations": one a pure DIY (see the story of my extreme low tech DIY adventure at the end of this article) and one outsourced to the pcbway.com fab - you can guess which is which.

Step 2: The Controller - Schema

I decided to go with the simplest NE555 astable using the probe as the charge/discharge capacitor, count the pulses using an Arduino Mini-pro and also use the Arduino board to trigger the watering if the number of pulses go over a certain value (this means the capacitance of the probe – thus the soil moisture – dropped below the threshold value).

The PCB design I reached is a single side with all the components mounted through hole (DIP mount) – this makes it very simple to assemble, only a soldering iron is needed. The PCB trace pattern is attached as the PDF file at the end of this step (Back Cu layer only); a 4x layout on a 100x100mm panel (including snap lines) is available as Gerber files on the project page on github.

Explanations:

  • the left side is one (of the two possible) main variations of NE555 astable circuits.
  • the NE555 is powered by the Arduino's digital pin 6. Therefore, NE555 will only be active when the controller decides it's time to take a measurement;
  • the Q1 transistor acts as a relay for the pump, having the later as load in its connector. Its base is commanded by the digital pin 3 of the Arduino controller. I'm repeating the warning : do not connect directly to it a pump rated to more than 6W, use a relay in between;
  • the output of the NE555 astable is connected to the pin digital pin5 of the Arduino controller; this one is fixed (because it's the only one used by the FreqCounter library I'm using), all the other pin choices were rather governed by the traces on the PCB
  • the trimpot in the connection to the probe is used to tune the frequency – I'll come to this later – the 4K7 resistor just limits the frequency going close to the max (if you set a zero resistance on the trimpot)
  • the probe is connected by a single 2 pin header row; for the power and the pump the schema allows for two different connectors – not essential, but as I wasn't sure which one of pin-header/female-DuPont or terminal block would suit better my choice of enclosure
  • the diode connected to the pump terminals – the D_flyw1 flywheel diode – just in case the pump motor creates spikes in voltage when turned off – I didn't test for the spikes, but the 1N4148 is cheap enough and better be safe than sorry (the diode is rated at 1A for non-repetitive pulses 1ms pulses and 4A for non-repetitive pulse of 1μs; in my case it was enough - but don't blame me if it fails for your case)
  • the capacitor in the parallel with the power connector – filter out voltage fluctuations in case the controller is powered by a noisy line (not absolutely needed if you power the circuit from batteries)

Some comments: the NE555 astable uses the output pin (pin 3 of NE555) for both charging and discharging the probe capacitor (unlike the standard NE555 astable, which uses the VCC to charge the capacitor and pin 7 – the discharge pin – to drain it). Normally, this choice is a bit frown upon, because the impedance connected in the NE555's output could affect the pulse duration/frequency; however, the NE555 signal is presented to one of Arduino's pin configured as input – thus a very high impedance, therefore the change in the charge/discharge time is negligible. As the PCB space was at a premium for me (and I still wanted DIP-mount components rather than SMD ones), the advantage of using a lower number of components and simplifying the traces was good enough to go this way.

Now, what about the other connectors - the CONN_SUPPLY1, CONN_SETTINGS1, PPROG0/PGND0, what are they for? The detailed answer in the "Controller - the logic", meanwhile the short answer is: they are used in configuring the controller without the need of a computer.

Warning: the circuit is NOT protected against reversed polarity - when connecting the power, mind the +/- signs.
Warning: the Arduino board can fit in normal and inverse positions - the pinout is symmetrical. But if you plug it in reversed, you'll likely end with an unusable Arduino board (I did it once).

Step 3: The Controller - Assembly - Arduino Pro Mini Board

I chose to replace the angled pins from the original package with straight ones - while this adds to the height of the assembly, it make easier to connect to the controller while in a box.

Also, a minimal pinout (4 pins of 6) are sufficient: VCC, GND, Tx and Rx

Feel free to adjust to your needs

Step 4: The Controller - Assembly - Controller Board

Note the mounting orientation for the D_flywh1 diode and Rb1 resistor - they are vertical.

Note also the orientation of the NE555 - the top (has a "notch") is towards the "power in" side of the PBC

Step 5: The Controller - All Together

You can see

  • the "configuration board" (explanations a bit later) on the bottom side of the photo
  • the probe leads trimmed to about 25 cm (shorter is better), with a 2 pin DuPont connector - depending of your choice of enclosure, you may what to crimp the DuPont pins and slip in the DuPont housing only after you mount the circuit inside the enclosure
  • the pump is connected using the terminal block - mind the polarity
  • no power connected, but you get the idea

Warning: the circuit is NOT protected against reversed polarity - when connecting the power, mind the +/- signs.

Warning: the Arduino board can fit in normal and inverse positions - the pinout is symmetrical. But if you plug it in reversed, you'll likely end with an unusable Arduino board, not totally fried but no longer functioning normally.

Step 6: Controller - the Logic

Now, about the logic in the Arduino controller: count the pulses, if they get above a threshold, trigger the watering. The logic is simple, isn't it? Except after my first iteration, I discovered it is not only simple but also too simplistic. The shortcomings:

  • you cannot keep the soil measuring process running continuously if you're using batteries as your power source. While measuring, the controller uses about 35-40mA (more will be drawn when watering). A set of two 4R25X 6V batteries (aka “lantern batteries”) were depleted in about two weeks – multiply this with the number of watering points and you'll see it's no longer cheap. Better take moisture measurements with hours between them – use your common sense, the time between two measures will vary on the season, temperature, amount of soils around your plant, etc.
  • Even more, you cannot even keep your Arduino fully alive between two measurements, without doing anything between two measurements; a Pro Mini will still draw 20—25mA – so a battery set will last only 3-4 weeks. Better put it into deep sleep – in my experience, this drives down the consumption to a mere 3mA, enough for the same batteries to last for about 20 weeks (only later I learned about The Shrimp and other extremely low current ATM368 circuits, which would extend the life of a lantern battery set to longer than the physical life of the batteries themselves. Well, there will be a next time)
  • you cannot decide how much water you dispense by simply reading the probe until you consider “it's wet enough” - because it takes some time for the water to infiltrate the soil, therefore you'll either decide it too early (if the probe is close to where the water hits the ground, so the soil gets wet too quickly) or too late (if the probe is a bit too far and it takes some time for the water to actually infiltrate the soil). Better stick with the rule of “if it's too dry, pour a predetermined amount of water, stop and wait for a good while before testing again”
  • you can't preset the watering parameters at home, then go in the field and expect to work as fine as you 'tuned' it to. Each soil will have its own mineral content, structure, compactness, capacity to retain water, etc – which will impact the parameters quite significantly. Somehow, I didn't see myself going it the field carrying the laptop with me only to setup each watering point with its very specific parameters values.

Anyhow, the above shows that the controller logic configuration will need at least 3 parameters and, highly preferable, these 3 parameters should be settable without requiring the use of a computer:

  1. the "dryness threshold" - the level one considers watering is needed
  2. the amount of time to apply watering – this correlates well with the amount of water dispensed for the plant
  3. the time between two consecutive moisture readings (in between the Arduino will be put into deep sleep)

Of course, there is also the issue of probe readings (after uploading the program), if only for the sake of diagnosing what's going on.

Referring to the schema in the "The controller - schema", this is where the PProg0/Rgnd0/Pgnd0 – let's pompously call it “the configuration board” (lowish right of the schema) and CONN_Settings1/CONN_Supply1 (top of schema, above Arduino connectors) come it play: at boot time, the analog pins A0-A3 of the Arduino board are configured as INPUT_PULLUP during the setup stage and the logic checks the 4 pins and interpret the result as one command of the possible 16. Therefore, to “signal” a pin, you just need to connect a pin to the ground using the “configuration board” (stick the Pgnd0 DuPont pin of the “configuration board” into the Ground pin of the CONN_Supply1, then use the other Pprog0 pins to pull the corresponding Arduino configuration pins to the electrical ground).
Note: of course the whole thing could have been done with 4 toggle micro-switches and maybe they could be fit onto the board. But I preferred to keep the things as cheap as possible (and at a "macro" dimension - my eyes aren't what they used to be).

The list of setup commands - with the codes in the {A0,A1,A2,A3} order:

  • operational mode - {0,0,0,0} - no setup, the normal operation
  • set watering time - {1,0,0,0} - the controller will switch on the pump and keep it on until the wire is pulled out from the pin; in that moment, the controller saves the recorded watering duration and uses it for the next cycles;
  • set threshold moisture level - {0,1,0,0} - the controller read the current moisture level, interprets it as the minimal level and will trigger the watering when the value reaches this value (next measure cycle)
  • 3 mins between moisture testing - {1,1,0,0} - sets the period between two consecutive moisture probing cycles to 3 minutes – useful for testing purposes, not recommended for long term running
  • 1 hour between moisture testing - {0,0,1,0} - Sets the period between two consecutive moisture probing cycles to 1 hour.
  • 2 hours between moisture testing - {1,0,1,0} - Sets the period between two consecutive moisture probing cycles to 2 hours.
  • 3 hours between moisture testing - {0,1,1,0} - Sets the period between two consecutive moisture probing cycles to 3 hours.
  • 4 hours between moisture testing - {1,1,1,0} - Sets the period between two consecutive moisture probing cycles to 4 hours.
  • 6 hours between moisture testing - {0,0,0,1} - Sets the period between two consecutive moisture probing cycles to 6 hours.
  • 8 hours between moisture testing - {1,0,0,1} - Sets the period between two consecutive moisture probing cycles to 8 hours.
  • 12 hours between moisture testing - {0,1,0,1} - Sets the period between two consecutive moisture probing cycles to 12 hours.
  • diagnosis mode - {1,1,0,1} - performs humidity probing every 5 seconds and reports the number of recorded pulses through the USB serial interface - useful for system diagnosis
  • reserved - {0,0,1,1} - reserved for future extensions
  • reserved - {1,0,1,1} - reserved for future extensions
  • reserved - {0,1,1,1} - reserved for future extensions
  • reset to factory default - sets the threshold level to something that no soil (no matter how dry) is going to trigger watering, the interval between 2 humidity probing to 6 hours and the watering time to 5 seconds (i.e. establishes a configuration that will surely need change for any useful purpose)

You can download the source code from the project page on github.

Step 7: Verifications After Assembly (and Before Deployment)

Verifying your circuit after assembling it:

  1. with power, pump and probe detached, make up the “Diagnosis” setting configuration using the “configuration board” (configuration {1,1,0,1} as explained in the “Controller – the logic”)
  2. connect the Arduino board to the computer (through the UART adaptor and the USB cable) and upload the sketch – at this stage, the controller will be powered by USB
  3. start the Arduino IDE “Serial console” (adjust this step to your specific dev environ)

You will need to see values between 40,000 and 50,000 being echoed in the console every 3 seconds or so – the board counts the pulses over a 100ms period and outputs them – without any charge/discharge capacitor attached, the NE555 astable is expected to oscillate/pulse at values around 500kHz

If all you see is values of 0, it is likely the NE555 is defective or underpowered (you are using the 5V version of Arduino Pro Mini and the UART adapter, aren't you?)

Adjusting the “dry level” oscillation frequency and confirming waterproofing of your probe

  1. let the power and pump unconnected, let the “Diagnosis” setting configuration in place
  2. connect the probe to its socket and (preferably) let it hang in the air as far as possible of any objects (I'm doing it at the middle of the edge of a wooden table and let the probe hanging in air by its wires)
  3. adjust the trimpot until the values echoed in the console are as close as possible to 20,000
  4. now, get a hold with your hand on the probe. Depending on the dryness of your skin, the number of pulse should drop to a value between 8,000 and 12,000
  5. take a non-conductive recipient large enough to hold you probe, fill it with water and, while still connected to the controller, dunk the probe inside (may be a shallow recipient, just place the probe horizontally). You should note that the echoed count drops at around 2,000 or under – but if it drops straight to zero, your probe coating has a serious crack allowing the water to short the planar capacitor
  6. important: let the probe inside the water and examine the output for at least a couple of hours. You should notice a slow further decrease of the echoed values – in my case, it goes as low as 1,700 overnight, then it stabilizes. If it goes all the way to zero, the coating has a microscopic crack (the probe is unusable)

The last point shows that actually the “full wetting” of the probe is not instantaneous, it take time for the water to fill all the micropores of the probe surface. Which means you shouldn't make any calibration of the watering system straight after putting the probe in the soil (if you do, you will need to redo them).

Verifying the power side

Until now, all the verification where carried with the power sourced via the USB cable.

  1. disconnect the UART adaptor from the computer and let the pump unconnected and let the probe under water.
  2. unpin the “configuration board”
  3. connect the 12V power supply to one of the CONN_PWR1 or CONN_PWR2 connectors – it would be helpful if, at this stage, you connect at first the wires on the controller side and only afterwards make the connection to the power supply/batteries (a switch in the power circuit may help) Warning: the current circuit does not have any protection against reverse power connectors – make sure you know what you do, otherwise it's likely you'll ruin the circuit (I did it once)
  4. power on the controller (if you used a switch) or reset the Arduino board – the “power on” on the Arduino board should lit. In the default configuration (no configuration pins pulled to the ground), the setup stage will perform a set of 8 measurements, each one will light the “blinky” LED on Arduino board

If everything is correct, power off the controller, re-establish the “diagnosis” configuration using the “configuration board”, reconnect the UART adaptor to the probe (you may skip the “power” pin on the UART), power on the controller from the 12V supply, reboot the controller and examine again the count values echoed in the serial console – there should be little to no change.

Verifying the pump side of the circuit

  1. power off the controller and unpin the “configuration board”- let the controller in its "operational mode"
  2. connect the pump to one of the CONN_PUMP1 or CONN_PUMP2 connectors – mind the polarity
  3. power on the controller. In its setup sequence, the controller will switch on the pump for 5 seconds.

Step 8: Deployment of a Watering Point

Due to the fact that the probe needs to reach a moisture equilibrium with the surrounding soil and this takes time, the deployment needs to be performed in stages possibly days apart.

One thing to keep in mind: the watering system will measure the humidity of the area surrounding the probe – the implicit assumption is that whatever the probe measures is representative for the average humidity available to the plant. Where this becomes relevant is in the watering strategy, as you can choose anywhere between:

  • placing the probe closer to the plant and using small amounts of water in more frequent watering session (say, hours apart). This strategy would be suited for small plants with a small and localised root system and or potted plants (the water cannot escape the pot before wetting it thoroughly)
  • placing the probe further apart from the plant and applying large amount of water in unfrequent sessions (10 hours or days apart). This strategy will be suited in watering large plants in outdoors position (young or small trees)

Stage 1 – probe settle

At this stage, all the electrical connections are performed and the controller is mounted in the enclosure of you choice, but the pump will not be connected to the water supply.

If you like, you can keep the controller not powered at all, this stage is not meant to make any adjustments to the controller but only let the probe humidity reach the balance with the surrounding soil.

  1. sink the probe into the soil
  2. water the plant manually until the soil around the probe is to what you consider the optimum level of humidity (remember the implicit assumption of “whatever the probe measures is appropriate for the plant”?)
  3. depending on the watering strategy you choose and the soil structure, you may need to repeat this cycle a number of times a number of times before going into the next stage. Sinking the probe into the ground is likely to disturb the soil structure as well and you want the soil to resettle as good as reasonable possible.

Stage 2 – calibrating the watering system

  1. Setting the minimum level of acceptable moisture
    Reminder: as the moisture level is translated by the capacitance of the probe and this capacitance varies not only because of the humidity but also the soil characteristics (structure, mineral content, etc) it is impossible to calibrate a probe “in lab conditions” and have it working the same when deployed. Which means each watering point will need to be specifically calibrated.
    This step is mainly meant to establish the specific level on which the watering event is triggered, it is important that the probe is properly settled and the soil reached the level of minimum humidity acceptable. The followings assumes you decided that “in conditions like this, trigger the watering” (a “configuration by example” approach)
    1. make sure the pump is not connected to the water supply or the watering tube is diverted from the area – the setup phase of the controller logic cycles the pump for 5 seconds (as a mean to verify the pump works) and we definitely don't want to alter the humidity level before calibration
    2. using the “configuration board”, establish the “read minimal level” mode {0,1,0,0}
    3. power on the controller (or reboot it if already powered) and step away from it and the probe connections – you have 30 seconds to do so. The rationale for this: the capacitance of the probe is small enough to be influenced by your presence around the controller/probe wires – while the change induced by your presence in the number of counted pulses does not alter the measurements to the point of making the watering system unusable, the change is far from negligible (my estimation is a variation of +/-10%)
    4. once the measurement of the current soil has been acquired (and saved for future use) the controller will resume it normal cycle, switching on the pump for 5 seconds during the initialization (in the setup() function) – it is the signal by which you will know it's safe to come closer and continue the calibration process
  2. Configuring the watering time
    This step will tell the controller how much water you want to drop at one watering event – also performed in a “configuration by example” this involves:
    1. connect the pump to the water supply
    2. establish the “watering time” configuration using the “configuration board” - {1,0,0,0}
    3. reboot the controller. The controller will trigger the pump and will keep it going for as long as the setup configuration is maintained to the “watering time” config
    4. when you consider the amount of water already delivered, simply pull the “configuration” board from the setup pins – the controller will detect the change and will store the watering time to use at the next watering event
  3. Configuring the interval between two measurements ("soaking time")
    Finally, setting up the interval between two consecutive humidity measurements – mind you, it's not the interval between two consecutive watering event, but how long between one humidity measurement and another (neither of which may result in a watering event, if the humidity is not below limit)
    1. use the “configuration board” to establish the setup configuration corresponding to your choice from the set of predefined intervals – sorry, no custom settings here
    2. reboot your controller – once you hear the 5s pump test cycle, you know that the setting was recorded and is going to be used for the future
    3. unpin the configuration board and close the controller enclosure.

Congrats, you're done with this watering point, go to the next one.

Step 9: Hints to Source Dirt Cheap Components

Based on my experience, the only recommendation I can make is the www.pcbway.com for PCB fabbing - the prices for what I sent to them were low (the courier charges where higher than the PCB price - PCB-es were unexpectedly quite heavy for their size), the quality high, you are able to track the PCB-es through their process on their page, took about 2 days from placing the order to completion. For orders placed from OECD countries and in small quantities, I wouldn't be surprised for 10 days or less from order placement to DHL-to-your-door delivery.

For the rest below, don't even take them as recommendations, much less endorsements - take them as hints only (I decline any responsibility if something does not work because of the components you bought).
All I can say is that, using ebay and aliexpress.com with care (look on the seller reputation and read the feedbacks), the thing worked for me.

Below, I'm listing some searches on aliexpress.com very likely to bring back results for the same (or similar) components that I used:

Step 10: Adventures in DYI Land - Earlier Attempts

PCB etching - toner transfer

When I started to fool around with the probe patterns, I used only a Brother laser printer and some super cheap yellow toner transfer paper I bought from ebay, no photoresist and no solder mask.

Oh, boy: the printer, toner and transfer paper combination would not work at first – the toner would refuse to stick on the paper until I discovered that the paper coating, at the temperature the Brother printer needs to melt the toner, is not longer sticky enough for the toner. I wish I have read the “PCB toner transfer Flamethrower style” earlier (just to know how extreme one should be to deal with the Brother toner).

But, in the end, I discovered that, before printing, gently wiping just a bit of the coating with isopropyl alcohol will allow the toner to stick to the paper and (equally important) the toner to be transferred later onto the PBC with an cloth iron. Did I mention gently and just a bit? It's like in: take a gauze, spray it with a tiny amount of alcohol, let it dry for some 20 seconds (it should not feel damp, humid only rather) and pass it gently over the piece of transfer paper at most twice over the same place. Wipe too much of the paper coating and the toner won't transfer on the copper.

Even doing so, I needed to use a kitchen thermometer to find a setting for the iron for a temperature of around 120℃ and not much higher - stop the steam as well.

Even more: don't expect the traces to be very neat and have a sharp permanent marker to correct the missing traces.

The insulating layer over the probes - very low tech style

--

Warning: some discussion I had in the comments sections (thanks, diy_bloke) reminds me I didn't say anything about safety, more specifically about xylene. That's no joke, while it's not as deadly as toluene, xylene would have some nasty effects if not treated with respect - fortunately, the effects are reversible if you are exposed to a low concentration and/or for short times. Stay safe.

--

The protective layer over the traces – what can be simpler? Just dissolve some plastic in a suitable solvent, dip coat the probe (how hard can it to do it manually?) and you're done. Oh, how naïve I was.

Too thick of a layer and the probe won't have enough sensitivity; too thin of a layer and the dried coating will scratch when you stick it into the soil and your probe will end a shorted capacitor.

After multiple experiments going well over a week, I finished by using polystyrene foam dissolved in xylene (no, acetone won't do) until it gets to the consistency of a thin syrup (other plastic/solvent combination I tried would scratch/crack too easily – e.g. superglue in acetone - or will get a gummy consistence once dried (I suspect because of plasticizers). The polystyrene foam seems to have a low level of added plasticizers and the resulted coat is tough enough to resist minor abrasions.

Dunk the probe in the mixture then slowly raise it by its wires (you solder them already, haven't you?) so the the meniscus formed by the solution wetting the probe surface is/stays uniform all along the process (put your eye glasses on if you need them... I did). I used to raise it as slow as 40-50 seconds for the 100mm length – you'll know you raised it too fast (or your plastic/solvent syrup is too thick) if, after 5-10 minutes after dipping, a sizable drop forms at the end of your probe.

Let it dry for about 20 minutes, then use a heat gun (or hair-drier) to force the solvent evaporation - xylene is not as volatile as I would have liked, but other solvents have higher toxicity. While forced-drying don't let the temperature go over 60℃ (if you touch an edge of it, it should feel it somehow hot but bearable) and dry it until you don't feel the xylene smell coming out from your coated probe – don't worry, it doesn't take longer than 20 minutes and you don't actually need to smell it sooner than 10 minutes (because I can guarantee you, sooner than that it will still smell). What if you try to dry it at higher temperature, you ask? Well, the outer layer will dry faster, delaying the drying of the inner layer – it'll take longer. If you raise the temperature over the boiling point of the solvent – for xylene it's 134℃ - bubbles will form underneath, ruining your attempt to have a continuous uniform coat.

Wait... did you think is over? Once the first layer is dry, you'll have about 0.05-0.1mm of coat thickness – far too easy to scratch.

So you repeat the process. Except that now, you will have already one coat which will absorb some of the solvent (and, if you keep your probe too long, will completely dissolve it – make those 40-50 seconds count). And, because of this absorption, you will need to let it dry longer and then force-dry it longer.

And you'll need to do it at least 4 times (and at most 6 times – afterwards the probe becomes notably less sensitive to the external medium).

It takes about 8 hours to coat a single damned probe. Of course you can let each coat dry overnight at the ambient temperature and you'll have about a week for a whole batch of probes.

Or stop being that cheap and go to pcbway.com already (or use solder mask UV-curable paint only if you can obtain a uniform water-proof coat of no more than 0.2-0.3 mm thickness - good luck if you want to give it a try, I didn't)

Multi-PCB assembly

My early prototype involved the controller, a/the pump relay and the Arduino board all on their own PCB, connected with DuPont connector terminated wires. Even more, there wasn't a possibility to configure the controller except the use of the laptop.

The mounting inside the box? Hot glue (I'd post some pictures if I wasn't so ashamed of my - natural for a beginner - naivety).

My word of advice: just don't - it may seem to work on the bench but is totally unreliable in the field.

<p>Hi acolomitchi,</p><p>I'm building my own watering system for my garden and I'm looking for a reliable probe. I also read the comparison made by diy_bloke and I like your results.</p><p>Instead of use solder mask, I'd use epoxy paint to waterproof the sensor. And I'll use an hex inverter because I can drive it at 3.3V.</p><p>My trouble is the cable length. I'm thinking to keep the logic on the main controller and use a shielded cable with a length of 3/4 meters.</p><p>Is it too much long?<br>Should I remote the probe logic also?</p>
<p>&gt; My trouble is the cable length. I'm thinking to keep the logic on the <br>main controller and use a shielded cable with a length of 3/4 meters.</p><p>&gt; Should I remote the probe logic also?</p><p>Look, the length of the probe connection cables have influence in the stray capacitance you are picking from the environ. Now, the environ itself changes very little (yes, the plant will grow, but won't influence that much the stray capacitance). There is a single exception to the &quot;quasi-static env&quot; condition: the big blob of water nearby (that's how the wire capacitance see a human) who manipulate wire during the configuration stage - specifically &quot;<strong>Stage 2 &ndash; calibrating the watering system</strong>&quot; the &quot;1. <strong>Setting the minimum level of acceptable moisture</strong>&quot;. If you want to remote something, try to adjust the &quot;configuration board&quot; so that the wires you connect to the configuration pins are long enough (to allow <em>you</em> to stay remote) and lead to some switches (instead of being connected straight to the pull-down resistor).</p><p>If you want to shield the cable between the probe and the controller, the shield cannot stay at a &quot;floating potential&quot; - even if not connected to the probe, the shield need to be driven at the same potential as your active wire (a follower connected to the output pin of the ne555). But this will come with some additional components and problems (e.g. make sure the shield is not grounded - that is make the end of the shield waterproof as well). </p><p>I'm trying to find a link I read a longish time ago which shows a piece of (additional) circuitry and explains why, and I'm failing. Some links though:</p><p>* why shield - <a href="https://e2e.ti.com/blogs_/b/analogwire/archive/2015/02/18/what-are-you-sensing-active-shielding-for-capacitive-sensing_2c00_-part-1" rel="nofollow">https://e2e.ti.com/blogs_/b/analogwire/archive/201...</a></p><p>* how see first comment of this answer <a href="http://electronics.stackexchange.com/a/24662" rel="nofollow">http://electronics.stackexchange.com/a/24662</a> - the &quot;Horowitz &amp; Hil&quot; mention </p><p>&gt; Is it too much long?</p><p></p><p>Beat me if I know. As I admitted, I'm not an EE, all that I know is derived from fooling around and googling. I know I used up to 40 cm cables and, with the extra care I mentioned in &quot;Setting the minimal moisture level&quot;, I had no problems.</p>
<p>Great infos!<br>Infact my first idea was to ground the shield only at the probe side to avoid ground loops. But athis point I'll switch to a simple twisted cable (if I don't remember wrong, it should helps against parasitics).</p><p>I'll update after some tests.</p><p>Thanks a lot!</p>
<p>&gt; I'll switch to a simple twisted cable (if I don't remember wrong, it should helps against parasitics</p><p>Will help against induced (as in inductance) parasitics - any variable magnetic field will influence the two wires pretty much the same and in opposite ways. To put in in a different way: twisting makes the &quot;area&quot; delimited by the two wires that capture the variable magnetic field to be seen alternatively from one side then from the other side (thus the induced currents will cancel).</p><p>But since the circuit is working in the 7-20kHz range, I doubt the lines will pick up such influences (<em>maybe</em> you have unshielded electric motors around - perhaps a dodgy vacuum cleaner or a fan).</p>
<p>Regarding waterproofing.</p><p>&gt; Instead of use solder mask, I'd use epoxy paint to waterproof the sensor.</p><p>As a matter of (theoretic) principle: the thicker the waterproof insulation, the less sensitive the probe will be to the surrounding moisture - i.e. the lower variance in the probe capacitance.</p><p>If you want to go with my probe design, you'll obtain the best quality of the traces if you order the probes to a PCB fab - they'll do the solder mask layer anyway. And a correspondence on email with diy_bloke shows that the solder mask resisted in soil over the west European winter - not quite Siberia kind of winter, but winter nevertheless. This is to say - the solder mask is good enough, you don't need something more durable under normal circumstances. Of course, going PCB-fab-outsourcing won't be the cheapest option, you can always substitute elbow grease and embark on a total DIY.</p><p>If you want to go hardcore DIY, I'd still suggest UV curable solder-mask, even if you decide to apply it yourself. It still cheap, you can find it on ebay from $2 free delivery.</p><p>Finally if, for whatever you want to try epoxy, by all means - the more experiments the better the knowledge. Just keep in mind the theory (as thin a coating as possible) and make sure you let the prototype probe in water for 2-4 days, checking the water resistance along the way (diy_bloke had some surprises) And <strong>please do share your experience</strong> (comment on diy_bloke comparison 'ible or on this one).</p><p>---</p><p>I'll try to address your 'connection cable' part of the question in a separate comment.</p>
<p>Thank you for your suggestions.<br>I was thinking that epoxy was a better solution because solder mask can't be applied to the vertical side of pcb and I was scared of a pcb degradation over the time.</p>
<p>&gt; I was thinking that epoxy was a better solution because solder mask <br>can't be applied to the vertical side of pcb and I was scared of a pcb <br>degradation over the time.</p><p>Wikipedia suggest you shouldn't worry - </p><p>* the board is already a waterproof resin <a href="https://en.wikipedia.org/wiki/FR-4" rel="nofollow"> https://en.wikipedia.org/wiki/FR-4<br></a></p><p>* a professional UV cured solder mask should resist most of the &quot;attacks&quot; - very strong acids or bases, boiling/aggressive solvents or mechanical abrasion/scratching may create difficulties, but not water.</p>
<p>Hey,</p><p>I have made these probes based on the design in http://pcb.daince.net/doku.php?id=sensor_soil_2. Initially my plan was to read the sensors using a ATTINY84 and then use a ESP8266 module conneted to it through the serial port to trasnmit the data. Later i changed the design to use a Arduino Pro Mini and a nrf24 module. I use the Arduino capsense module to read the capacitance values of the sensors directly from the microcontroller.</p><p>Note that for extra protection I have coated the sensors with Plasti dip spray.</p><p>If I hold the sensor in my hand with my fingers tightly wrapped around, i get pretty consistent values with a variation of just 1 to 3%. But when i insert the sensor into the soil of a vegetable pot, then the readings that i get become very, very erratic - more than 20 to 30%. I even get a value of zero often.</p><p>I am really puzzled by this behavior. If there is a problem with either the sensor construction or the electronics then I should be getting erratic readings all the time. But thats not the case. If I hold the sensor with my fingers wrapped around, then I am getting consistent values.</p><p>Do you have any suggestions for me to fix this issue (where the sensors are giving very erratic values when inserted in soil)? Thank you, Gopi.</p>
<p>Reading the text in my email, I could have swear your probes aren't water tight - erratic readings are consistent with a bad plastic used for coating. Now after reading the comment here and seeing the photos, I see the solder mask and I know it <em>should</em> be OK - the polymer use for solder mask is water tight (if the fabber worth its salt and the deposition is pore free) and chemical resistant. </p><p>Erratic values which sometimes have 0 value are absolutely related with either:</p><p>1. a short - you try to load the capacitive probe, but the electric charge leaks</p><p>2. a cold solder joint - resistance varying with mechanical stress, possibly appearing disconnected at times (you try to charge/discharge the capacitor through a resistance varying erratically)</p><p>To eliminate any doubt in the coating, take the probe and dunk its &quot;sensing part&quot; in water. Keep it for 2-3 days cycling the reading every 10 seconds or so - with some coatings I tried (not solder mask, though), the plastic I used slowly absorbed water over days before failing on me.</p><p>Other things that may get the wrong way - your circuit part is only wrapped in foil (photo 3) or nor perhaps no wrapped at all - water may condense on the connections and influence the reading - it doesn't take much of a leakage current, at 5V with a discharge resistor close to 1MOhm, your peak current is going to be in the microamps range. If you are absolutely sure your sensing part of the probes are watertight and all connections are Ok, maybe it would worth potting the circuit part (pour some melted wax over the circuit side) - see https://en.wikipedia.org/wiki/Potting_(electronic...</p><p>Other suggestions?... mmmm... none for the moment. Good luck with the diagnosis - once you find the cause, the solutions are usually simple.</p>
<p>Thanks for the pointers! I will take a relook at everything and hopefully i can find the cause. Will update this thread again if I am able to fix the issues. Thanks again.</p>
<p>Hi, i liked your instructable. however, I didn't got the NE555 part. why there isnt any resistor between pin 8 &amp; 7 &amp; 6. how are you charging and discharging the capacitor from pin 3?. please help. thank you! </p>
<p>0. Because <strong>it works</strong> - see an explanation here: <a href="http://www.learnabout-electronics.org/Oscillators/osc44.php" rel="nofollow"> http://www.learnabout-electronics.org/Oscillators...</a> - read the &quot;50% duty astable&quot; section. The caveat in the article is: &quot;...the circuit may not always produce a 50% duty cycle... in practice the actual output voltage depends to some extent on the load placed on the output.&quot; In my case, the load is in 10-s of MR (input impedance of an Arduino input) - the output is fed in the Arduino's pin, the consumption is going to be nanoAmps.<br>Besides, since I'm counting pulses using Arduino, a 50% duty cycle is an advantage - true, not a big one, but still a symmetric trace offers the smallest chances of transient spikes influencing the count.</p><p>1. a lower number of components makes a cheaper circuit - not that much the price of components but the price of PCB-fabbing - smaller area and simpler traces will be cheaper at the fabber. As I wanted those to work in a field 150km from home I needed them as reliable as possible. And they where tens of circuits, not just a few, on a shortish term - thus I needed a fabber<strong>.</strong></p><p>2. most of the time, a lesser number of components will lead to a smaller consumption. It becomes important when you consider the exploitation cost - in my case (no mains in the field), it <em>had</em> to be batteries - if my circuit is going to cost $10 apiece and I need a $10 set of batteries, better that set of batteries last for some months rather than just weeks.</p>
<p>I ordered the probes from smart-prototyping.com by sending the Gerber files available on this project (8 files under square1-planecap/print/grbl). I got the following comment: &lt;&lt;After checked your Gerber file we found there are 5 separated sub-boards, it means we have to charge you additional 41USD for it. Or you can design a big outline without four lines inside, then you don't need to pay extra money.&gt;&gt; &lt;&lt;Boards which are separated only by silk-screen are not counted as sub-boards and don't have to be payed extra&gt;&gt;.</p><p>Can you please suggest what to do?</p>
<p>How many probes do you need?</p><p>&gt; After checked your Gerber file we found there are 5 separated <br>sub-boards, it means we have to charge you additional 41USD for it.</p><p>Just from curiosity, how many did you ask them to do for you? (just to understand what those $41 come when considered for one piece).</p><p>The probes are layouted, indeed, 5 pieces on a panel of 100x100mm, with a snap groove between them. You can ask them not to separate them and only draw a line on the silk layer, but it will be you to cut them along that line; believe me, cutting pcb-es is a thing to be hated - see here </p><p><a href="http://electronics.stackexchange.com/questions/1151/how-do-you-cut-pcb">http://electronics.stackexchange.com/questions/115...</a></p><p>As the probes are already printed and insulated, the only thing I'd recommend is the heavy-duty knife, use a new blade and score it carefully before snapping.</p><p>&gt; Can you please suggest what to do?</p><p>My advice? Change the pcb-fabber.<br>If they want you to pay extra, it's their right. As it is your right to reject the deal if it is ridiculous.</p><p>On pcbway.com, I paid $33 for 10 such panels (a total of 50 probes), with a snap groove already marked.</p><p>If you need just a few, I might have some spares, PM me and we'll discuss the price.</p>
<p>I offered smart-prototyping.com to either manufacture the boards with a dividing line on the silkscreen based on the already provided Gerber files or to reimburse me the money. They found that one of the files had the silkscreen with the necessary dividing lines so they are Ok to produce them without extra cost. I ordered 5 boards (5x5=25 probes) with a total cost -including shipping, of $16.79.</p>
<p>&gt; I ordered 5 boards (5x5=25 probes) with a total cost -including shipping, of $16.79.</p><p>Interesting. At this price, I guess the shipping is by snail-mail rather than expres courier, am I right?</p><p>&gt; They found that one of the files had the silkscreen with the necessary <br>dividing lines so they are Ok to produce them without extra cost.</p><p>Ok. If they don't score a snap V groove along that lines, take care how you separate them. Anything (scratch and/or <em>badly insulated connection</em>) that allows minute of water shorting two traces via soil moisture and your probe is useless.<br>(e.g. in my circuit, the NE555 bounces the probe between 1.67 and 3.33 V. Given the resistors, peak current is somewhere around 3.33V/25K=133uA - doesn't take much to drain such a low current).</p><p>&gt; I offered smart-prototyping.com to either manufacture the boards with a <br>dividing line on the silkscreen based on the already provided Gerber <br>files or to reimburse me the money.</p><p>In my experience with pcbway, they examine the gerber files and <strong>only after</strong> that they quote me the final price - so I pay nothing until their price is final. No surprises, no delays on haggling over the price; and if you explain them from the start what you want (e.g. separation V groove, etc), no delays whatsoever. Plus, you can monitor online the progress of the PCB fabbing between different stages.</p>
<p>Sure I will post &quot;I made it&quot; as soon as I get the solution to work. BTW, I got the PCBs on for two days ago. Here you go some pics:</p><p>1) Package</p><p>2) Small damage on the plastic envelope. No PCB damaged.</p><p>5 &amp; 6) Small failure on the silkscreen on two PCBs</p><p>7) One board is slightly bent</p>
<p>Thank you indeed.</p><p>Based on the photos, I'll stay clear from smart-prototyping. It's not the damage on the packaging that worries me, it's the defects on the solder mask (photos 5 and especially 6) - <em>potentially</em>, they can make the affected probes unusable outright or kill them in the long run (water getting under the solder mask) - the probes, including connection, must be <em>absolutely</em> waterproof.</p><p>If you need them all (can not afford to discard the low quality ones), I'd suggest you cover the affected areas with some waterproof coating - finger crossed the coating will stick on the existing solder mask.<br>A drop of UV-curable solder mask would do <a href="http://www.ebay.com/sch/i.html?_nkw=uv+curable+solder+mask"> http://www.ebay.com/sch/i.html?_nkw=uv+curable+so...</a></p><p>(make the area clean of any greasy substances, let the solvent evaporate, apply a small drop of resin on the affected area and spread it <em>thin</em>, expose it the UV - in the sun for 30 mins will do </p><p><a href="https://www.instructables.com/howto/uv+solder+mask/">https://www.instructables.com/howto/uv+solder+mask/</a></p><p>).</p><p>You'll need to cover the area of wire connections anyway, so alternatively you may apply the same solution for the damaged areas. <br>As explained in the 'ible, I used acrylic nail monomer+powder from ebay (the powder contains not only the pigment but the polymerisation catalyst as well). The aesthetics of the result may not be high (I'm not a nail artist), but the electrical insulation is perfect and the mechanical strength is better than that of a varnish or lacquer. </p>
<p>Good luck.</p><p>May I kindly ask you to post an &quot;I made it&quot; picture when you got them?</p><p>Do you intend to use them with the circuit in this 'ible? (the price I paid to pcbway for the controller board was $12 for 10 panels with 4 boards each. Without shipping. Dam', the express courier fees are - almost literally - highway robbery).</p><p>Cheers</p>
<p>Comparison between mine and your probe: </p><p><a href="https://www.instructables.com/id/Comparison-of-Capacitive-Soil-Probes">https://www.instructables.com/id/Comparison-of-Capa...</a></p><p>Conclusion: both good, yours better</p>
<p>With relay and pump</p>
<p>Works very well, I retracted the probe for the picture and got the deviceout of its usual container</p>
<p>Cool! This is the first time that I have seen someone use a capacitive moisture sensor. This is a much better idea than using a conductive sensor.</p>
<p>Not quite new:</p><p><a href="http://rayshobby.net/reverse-engineer-a-cheap-wireless-soil-moisture-sensor/" rel="nofollow">http://rayshobby.net/reverse-engineer-a-cheap-wire...</a></p><p><a href="http://zerocharactersleft.blogspot.com.au/2011/11/pcb-as-capacitive-soil-moisture-sensor.html" rel="nofollow">http://zerocharactersleft.blogspot.com.au/2011/11/...</a></p><p><a href="https://www.instructables.com/id/Soil-Moisture-Sensor-1/" rel="nofollow">https://www.instructables.com/id/Soil-Moisture-Sens...</a></p><p><a href="https://en.wikipedia.org/wiki/Capacitance_probe" rel="nofollow">https://en.wikipedia.org/wiki/Capacitance_probe</a></p><p>The &quot;novelty&quot; (I can't believe I'm the first to think of this): a simple good ol' (and dirt cheap) NE555 is enough for the job - no need of the hundred of MHz and expensive circuitry for Frequency/Time Domain Reflectometry</p>
<p>You're right about NE555 and the capacitive sensor. Here's the one more link where it is used: http://lazyelectronics.com/index.php/en/item/5-soilsensor-en</p>
<p>Here's another one, about 10 years old, no watering command but WiFi to base station for monitoring :</p><p><a href="http://hulk.bu.edu/pubs/papers/2007/TR-05-02-2007.doc">http://hulk.bu.edu/pubs/papers/2007/TR-05-02-2007....</a></p><p>A 555 astable followed by low pass filter to translate frequency-&gt;voltage.</p>
<p>Based on the nicks, I suspect you are the owner of the blog (&quot;Electronic Battle&quot; here, &quot;Electronic battleground&quot; in the opening of the videoclip). Am I right?</p><p>If so, I'm curious what your needs were/are (what problem did you want to solve), how your approach evolved/worked, what went well, (if you tested it in the field) what troubles one can expect. </p><p>I'm sure I'd like a lower consumption, perhaps I'll switch to a bare ATMega (maybe even the ATTiny) on the controller side - why, a set of batteries for 4-5 months costs me the same as the entire watering point.<br>Another thing that caused troubles in my case: algae in the stored water - tends to clog the water pumps. I'll try a filter, maybe adding some things to the water to kill the algae (but I'll need to be careful, I'm not sure what that would do to my plants. Perhaps some hydrogen peroxide in low concentration - should kill the algae and then decompose in a mater of days - the salts in the ground surely will catalyse the decomposition of the rest).</p>
<p>Whoa, mate, his probes are humongous! </p><p>Nevertheless, the principle stands; and a hat tip for his scientific exploration on to the effect of soil moisture on the probe.</p>
<p>Thanks, I sorta knew it (not that specific link). All the methods for capacitive probes will need to rely somehow on capacitance change - an oscillator would be the first thing someone should consider.</p>
<p>I agree with regard to the 'no need of ...etc'. I have used a 555 as well for this purpose but as I am not to familiar with it I found it to hang or lock up sometimes so went for an even simpler HCT14 as a relaxation oscillator. Not sure if it is the best but it works. I had initially considered using just plates and let the arduino do the capacitive measuring but that turned out to be too impractical: a seperate circuit is easier.<br><br>In your reply to 'Electronic Battle' I read you are troubled by Algae. Fortunately i didnt have that problem. Don't know why. My tank was just an open bucket containing 65 liters that i would fill up if it was going empty. Maybe your tank was bigger, considering you have 40 watering points<br>I have also just water from my fish pond. That has the bonus that it contained nutrients. Didnt clog up with algae, but I presume the fish took care of that.<br><br>With regard to the valves, yes I considered those too, but too expensive and as you say many need a positive pressure, just gravity isnt going to do it, unless you have a special valve. The cheapest pump I used was I think 3 euro. <a href="http://www.aliexpress.com/item/2016-High-Quality-New-Priming-Diaphragm-Pump-Spray-Motor-12V-For-Water-Dispenser-90-mm-x/32610263748.html">http://www.aliexpress.com/item/2016-High-Quality-N...</a></p><p>That was a non submersible kind but I have also used submersible pumps varying from 15 euro (garden center) to 6 euro (webshops)</p><p>Your step 10, about the coating is very informative. I always find it hard to give health warnings as many people do about say raising plants in car tyres, using lumber for plant beds and even using cardboard in your soil as it is hard to estimate the dangers and in the end, just about any product may contain toxic chemicals. Xylene may be the best in this case, just don't underestimate its toxicity. If you can smell it in fact you are already too close. But as said, it might be the best cover to use. I have heard of people using 'Dipit' but thats darned expensive and I suspect it isnt much different from what you are making yourself. I have heard of people just putting a paint cover over it and I in fact have used shrink tube. Heck... when I was testing I even used a plastic bag :-)<br>Great project </p>
<p>(apologies for the delay)</p><p>&gt; I had initially considered using just plates and <br>&gt; let the arduino do the capacitive measuring<br>It might work, the conversation with <a href="https://www.instructables.com/member/nqtronix" rel="nofollow">nqtronix</a> below caused me to think about. I'll need to get my hands on a pencil and paper to make some calculations and see if it has chances. If it has, then I'll breadboard another design.</p><p>&gt; In your reply to 'Electronic Battle' I read you are troubled by Algae.</p><p>Well, last year I raised some rain capture sails collecting the water in some IBC-es. But, after 3 months of &quot;winter&quot; (when it's supposed to rain, not much snow around), I collected about 400 litres of water. Come Sept, the meteo guys were saying something about El Nino, so it was time to panic. I bought another 12 secondhand IBC-es and drained the dam on the property into them (using secondhand firefighting hoses - I suspect they'd leak life hell under higher pressure, but for what I needed the were fine - just barely). So, you see, the water had lots of organics already - plus whatever food-safe content were in those IBC-es, I had some of the blooming with algae,</p><p>&gt; Xylene may be the best in this case, just don't underestimate its toxicity.</p><p>So true. Here's a story for the young-and-unaware (or old but still unaware)</p><p>Those rain-collection sails I mentioned above? Actually some cheap polyethylene tarps, UV will eat them in time. To give them a &quot;fighting chance&quot; I decide to coat them with something mixed with ZnO or TiO (white paint pigment). If it comes to coating them, why not use something to increase the contact angle and make the water droplets run quicker? So silicone caulk it was.</p><p>The only thing that would thin silicone caulking (to spread it easily) is xylene - you need to work fast thought and in small batches - one exposed to minute moisture it will start further polymerization - 10 minutes and it will be too thick to do any spreading. <br>After the first batch, I put the things on hold and ran to the hardware store for a gas mask, nursing a blinding headache for half a day. I'm still alive today and with a good amount of respect for xylene.</p>
<p>No need to apologize for delay, it isnt mandatory :-)<br>-I know using the arduino to do the capacitive measuring works, but I found most of the libraries tedious to work with, plus you would need a wire from yr capacitor to where your arduino is. Best not to have that wire too long. Anyway, I decided not to bother with it. Sometimes hardware is a better solution than software.<br><br>-yes that would explain the algae :-)<br><br>- my dad left me a hoist of chemicals among which Xylene, Toluene, and even some instable explosives. I did away with the Xylene and toluene and kept the explosive (e.g. Picrinic acid) That kinda shows my respect for these two solvents.<br>Can I suggest you buy decent tarp? simpler, cheaper, less effort :-) </p>
<p>&gt;Can I suggest you buy decent tarp? simpler, cheaper, less effort :-)</p><p>Sorry, mate. Australia seems to be the land of plenty... but not cheap. Especially when one needs to scale-up.</p><p>(and now I'll run and then I take cover)</p>
<p>well caulk must not be cheap either then :-) Nor would a hospital bill :-)</p>
<p>&gt; well caulk must not be cheap either then :-)</p><p>:) Fortunately, that one is cheap (-ish). The good thing about it: the water runs on the caulk coating like on top of oil - I'm even collecting fog water when there's fog.</p><p>&gt; Nor would a hospital bill :-)</p><p>Well, the gas mask wasn't very cheap (cheaper than a hospital bill), but at least it's one off - I'd call it an investment.</p>
<p>Just had a question about your software:<br>You configure the A0-A3 ports with INPUT_PULLUP as you use them for configuration of the various modes. However, that is equal to first writing a HIGH and then configuring as Input. So far so good..<br>But later in the setupAdjust(bool report) routine, you configure them as outputs, and then you make them low as they are not used anymore till the next setup.<br>Setup is being done by connecting the specific analog ports with a wire to either 0 or 5Volt.</p><p>I was wondering if when those wires are still connected when you write the port as output, the Ports do not have the chance of being damaged as for a fraction in time they are still HIGH and possibly shorted to ground. I have read that a digitalWrite can take up to 56 clock cycles or around 7000nS (=7mS), so even if 7 ms might not be that long, A3, the last one in line, may have to wait some 28mS.<br>A0 also will have to wait the time needed for 3 pinMode changes.<br>But then again, I guess you still have not blown up your ProMini :-)<br></p>
<p>&gt; But later in the setupAdjust(bool report) routine,<br>&gt; you configure them as<br> outputs, and then<br>&gt; you make them low as they are not used<br>&gt; anymore till <br>the next setup.</p><p>I suppose I could let them switched low first and then let them configured as input, their internal pull up/down resistors will protect them. But...</p><p>&gt; was wondering if when those wires are<br>&gt; still connected when you write <br>the port as<br>&gt; output, the Ports do not have the chance <br>&gt; of being damaged <br>as for a fraction in time<br>&gt; they are still HIGH and possibly shorted to <br>ground.</p><p>... they aren't supposed to be shorted to the ground, they are meant to be pulled to the ground. The &quot;configuration board&quot; uses a 470R to do this. At 5V, that means &lt;11mA per port (which is well below the Arduino's max specs: 40mA per port, 200mA max sourced from VCC).</p><p>Granted, for the sake of... ummm... robustness under adverse condition (someone not using the &quot;configuration board&quot;), it still a better idea to let switch them low and let them be inputs (commenting out the setPinMode(OUTPUT) sequence).<br>Even more, this will shave some bytes from the compiled code - may become important when switching the design to a ATTINY44 (256 bytes of RAM).</p><p>Will do it one of these days.</p>
<p>ah ok. missed the resistors. by the way, this would be an excellent candidate for direct port manipulation though that would affect portability a bit</p>
<p>&gt; direct port manipulation</p><p>Like in &quot;Set it by USB ot I2C port&quot;? If not, what do you mean by that?</p><p>If so... I considered the approach, but went away from it because:</p><p>1. portability - in the sense of &quot;don't need any fancy stuff to tell the device what to do&quot; - I didn't want to carry any laptop or tablet in the middle of nowhere where my trees are</p><p>2. if not over USB, communication will eat from the battery life (especially if WiFi)</p><p>3. if over USB, that USB cable will hang around the probe wires, influencing the sensed probe capacitance - see &quot;Step 8, Deployment of a watering point&quot;, &quot;Stage 2 - calibrating the watering system&quot;, point &quot;1. Setting the minimum level of acceptable moisture&quot;, specifically the 3rd item in the list, (the one that says &quot;... and step away from it and the probe connections...&quot;) </p><p>Probable a group of slide microswitches on the board would have done the job better, but my eyes aren't what they use to be - I felt that something closer to a &quot;macro&quot; size would be more appropriate.</p>
<p>sorry for not being more clear, coz it seems we are thinking two completely different things.<br>What I mean is that a sequence like:</p><p>pinMode(A0, OUTPUT);<br> pinMode(A1, OUTPUT);<br> pinMode(A2, OUTPUT);<br> pinMode(A3, OUTPUT);<br> digitalWrite(A0,LOW);<br> digitalWrite(A1,LOW);<br> digitalWrite(A2,LOW);<br> digitalWrite(A3,LOW);</p><p>could easily be written as:</p><p>DDRC=DDRC | B00001111<br>PORTC = B00000000<br>The advantage is that it is faster and therefore not only the time the current flows through the setup resistors is less, your circuit can go back to sleep sooner again, saving battery life if even a little.<br><br>with 'portability' I mean 'portability of your code to another controller, although within the arduino family this shouldnt be much of a problem</p>
<p>Ah, I see. Haven't got that far into AVR guts, I jumped (and stopped) at timers.</p><p>Thanks for the tip, I'll have a look when the time allows - it's interesting not necessarily because of the time spent into the sequence (this happens only in the setup phase) but because of the compiled binary size (if I am to go with a bare ATTINY) </p>
<p>cost wise an attiny44 is a good choice. It is cheaper than the 85, but only has 4k or memory. oddly though it is also cheaper than the Attiny24 that only has 2k and as expected cheaper than the attiny84.<br>Usually also cheaper than the 2313.<br>Looking at sop14 price. couldnt find dil. But SOP has half the pin space that DIL has. steady hand and a keen eye should be able to do that. Just have to get/keep yr code under 4k</p>
<p>also it would save you 438 bytes</p>
<p>&gt; also it would save you 438 bytes</p><p>This can't be. </p><p>As it is right now, the entire sketch compiles around 256B (maybe a bit over), libs and vars (thus messages for serial) included. Check for yourself.</p><p>(it may be that the compiler is pretty mighty when it comes to code optimization)</p>
<p>as I didnt have all the libraries installed yet, I just put the above statements (pinmodes and digitalwrites) in a program setup and compiled. That gave 896 bytes.<br>Then I replaced them with the two port manipulation statements and compiled again: 458 bytes. So I figured the difference 438 bytes would be the savings. Oddly though 1 extra digitalWrite will cost 286 bytes but two extra will cost only 294 bytes, so, the proof of the pudding is in the eating: Put libraries in place, compiled your code :6290 bytes. <br>replaced the statements: 6236 bytes. Thats of a completely other magnitude in savings: only 54 bytes.<br>Obviously the compiler works in mysterious ways</p>
<p>Here's an idea for those of us that have burned pro minis by installing them backwards:</p><p>Instead of putting all pins on the pro mini, and sockets on the PCB, put 1 set of pins on the pro mini, and the other set of pins on the PCB. so each side will have a row of pins and a row of sockets. Almost murphy proof, except for setup time. If you are careful enough, not really an issue.</p><p>Yes, I have several pro minis in my junk box from this reversed installation issue.......</p>
<p>the only thing wrong with that idea is that I didnt think of it myself. Brilliant</p>
<p>Brilliant!!! </p><p>?????!</p>
You could use a dishwasher water valve for about $30 but you'd have to put it in a waterproof box for outdoor use. What are the benefits of using capacitive sensors instead of resistive?
<p>&gt; You could use a dishwasher water valve for about</p><p>&gt; $30 but you'd have to put it in a waterproof box for outdoor use.</p><p>$30? Man, I'm too tight to cough up $30 per watering point. In my view, for the 40 of them, the budget would balloon straight into the stratosphere.</p><p>I considered valves as well at the beginning, by the best price I could find was $12. And then, they would require a positive pressure at the inlet (wouldn't close properly otherwise), and all I had/have is 1m water head.</p><p>&gt; What are the benefits of using capacitive sensors instead of resistive?</p><p>Capacitive sensors will resist corrosion, I expect they'll be more stable/reliable over time.<br>Especially in an acidic soil. Passing currents through metallic electrodes in an acidic medium resembles an electrolysis cell too much for my taste - I wouldn't cry after some fast rusting nails, but the salts resulting from the measurement process will influence the measurement process itself (and again, some platinum electrodes are beyond my budget). </p><p>Umm... speaking about resistive sensors - I might consider some conductive-ink-on-a-plastic type of electrodes (graphite powder in xylene dissolved polystyrene works reasonable well). The only problem - after solvent evaporation their resistance varies with the mechanical stress: apply a pressure on the painted surface, the resistance go down. Some post-processing is needed.</p>

About This Instructable

15,856views

245favorites

License:

More by acolomitchi:Automatic watering system with capacitive probe and Arduino on the cheap (and I mean it) 
Add instructable to: