Picture
For automated irrigation, it is useful to have feedback that shows that the system is working as expected. Flow meters -like magflow- are the standard tools of the trade here.
An alternative solution is to measure the pressure drop when irrigation valves are opened. When calibrated with the utility company water meter, this can give a good indication of irrigation times and irrigation water volume.

The following is a quick setup to accomplish this, but not intended for permanent use as the power consumption is such that a 6V lantern battery lasts only 6 days.
Three main components are needed: an Arduino Uno board, an Adafruit data logger shield, and a 200 PSI pressure transducer (
Eyourlife Universal 200PSI Pressure Transducer Sender Solenoid for Oil Fuel Gas Air Water, $21 @ Amazon.com).
See for transducer also: http://www.vanderleevineyard.com/1/post/2015/03/vinduino-water-pressure-meter.html
The pressure transducer replaces the PSI gauge before the main valve of the irrigation system.

Below graph shows the data that was recorded and written on an SD card in the datalogger over a period of 6 days. It shows two main irrigation events per day (block 1 and block 2), where pressure drops from 120 PSI to 30 PSI. The fluttering pressure during block 2 irrigation indicates that the landscaping sprinklers were set to start around the block 2 irrigation time.
This can cause incomplete watering of our lawn due to low pressure, so we'll adjust the sprinkler timer to start later.
Picture





Here is the Arduino code, based on libraries and examples from Adafruit:

//  SD card datalogger

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 rtc;
const int chipSelect = 10;
File dataFile;

void setup()
{
Serial.begin(9600);
Wire.begin();
// rtc.begin();
// rtc.begin(DateTime(F(__DATE__)
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
//rtc.adjust(DateTime(2015, 4, 25, 8, 11, 0));

Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:

pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
while (1) ;
}
Serial.println("card initialized.");
// Open up the file we're going to log to!
dataFile = SD.open("datalog.txt", FILE_WRITE);
if (! dataFile) {
Serial.println("error opening datalog.txt");
// Wait forever since we cant write data
while (1) ;
  }
}

void loop()
{
int sensorValue = analogRead(A0);
int psi = (sensorValue-97)*.24445;
DateTime now = rtc.now();

Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(' ');
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.print("\t");
Serial.print (psi);
Serial.println();

dataFile.print(now.month(), DEC);
dataFile.print('/');
dataFile.print(now.day(), DEC);
dataFile.print(' ');
dataFile.print(now.hour(), DEC);
dataFile.print(':');
dataFile.print(now.minute(), DEC);
dataFile.print(':');
dataFile.print(now.second(), DEC);
dataFile.print("\t");
dataFile.print (psi);
dataFile.println();

dataFile.flush();

// Take 1 measurement every minute
delay(60000); 
}
 
 
Picture
Cost management and water use reduction have been the main reasons why we wanted to automate the irrigation of our vineyard.
So far, our vineyard irrigation was done manually. Labour intensive, and probably not the most efficient use of irrigation water.
In order to optimize water usage, it is better to irrigate more frequently using shorter times and avoid evaporation by scheduling at night.

Our irrigation system uses 2" pipes, and water pressure
at our water mains connection is around 120 PSI. We have 2 irrigation blocks of approximately 1500 vines, each vine is served with 2 drippers of 1 gallon/hr. To avoid excessive pressure drop, we irrigate only one block at a time @ 50 gallons/minute.

We found that the Hunter Sprinkler ICV201GDC ICV irrigation control valves are very suitable for our purpose. These valves come optionally with a DC latching solenoid (Hunter Sprinkler 458200 DC Latching Solenoid) that can be used in combination with a battery operated controller. That saves trench digging and running wires to operate the irrigation valves with a controller from the house.
Added bonus of the Hunter valve is the option of being controlled by a micro controller like the Arduino.

Picture
The latching solenoid can easily be controlled with an Arduino board and a low cost motor driver module. 
We purchased a driver module (L9110S DC Stepper Motor Driver Module H Bridge) on-line for less than $6.
The module needs 2 digital control lines (Arduino pin 13: latching on, and pin 12: latching off) per solenoid. The L9110S is a dual motor driver, so 2 valves can be controlled by one single module.
The solenoid needs 9V to operate, a small battery provides this to the motor driver module.
The solenoid requires only a 10 msec
-or longer- pulse to switch state, so the average consumed energy from the battery can be very low.
The motor driver board comes with an indicator LED that should be removed to avoid battery drain.

Here is a simple Arduino demo sketch:

/*
  Turns on a Hunter DC latching solenoid on for one second, then off for one second, repeatedly.
  This example code is in the public domain.
 */
 
int a = 13;
int b = 12;

void setup() {                
  // initialize the digital pin as an output.
  pinMode(a, OUTPUT);
  pinMode(b, OUTPUT);    
}

void loop() {
  digitalWrite(a, HIGH);   // turn the valve on (HIGH is the voltage level)
  delay(10);               // wait 10 milliseconds
  digitalWrite(a, LOW);    // end drive pulse by making the voltage LOW
   delay(1000);               // wait for a second
 digitalWrite(b, HIGH);   // turn the valve off (HIGH is the voltage level)
  delay(10);               // wait 10 milliseconds
  digitalWrite(b, LOW);    // end drive pulse by making the voltage LOW
  delay(1000);
}

 
 
Picture
Measuring water pressure in agricultural irrigation systems is standard practice. One application is checking for pressure drop when irrigation valves are opened, and thus give feedback that valves work correctly.
Pressure difference can also be used to measure the amount of water flowing, and help tune for even distribution of irrigation water.

Here's how to make a digital water pressure meter, based on the Arduino Pro Mini micro controller board, and the Vinduino PCB.
The used pressure sensor is a $20 device, available on-line. It has a stainless steel housing and comes complete with a watertight connection cable. There are several ranges available. We purchased the 200 PSI version, the same range as the analog meters installed in our vineyard.

This sensor gives an output voltage between 0.5V and 4.5V that scales linearly with the measured pressure, 50 psi per volt.

Hooking the sensor up to the Arduino board is easy. Only 3 wires are required: 5V supply (connect to Arduino Vcc pin), ground, and a sensor_out signal (connect to Arduino A0 analog in pin).

Here is example code to test the pressure sensor:

// "Vinduino" portable PSI sensor code V1.00
// Date March 7, 2015
// Reinier van der Lee
// www.vanderleevineyard.com

// include the library code only for LCD display version
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);

  // set up the LCD's number of columns and rows:
  lcd.begin(8, 2);
  lcd.print ("Pressure");  
}

void loop() {

float sensorVoltage = analogRead(0);   // read the sensor voltage
int psi = ((sensorVoltage-95)/204)*50;
lcd.setCursor (0,1);
lcd.print (psi);
lcd.print (" PSI");
Serial.println (psi);

delay (1000);
}



 
 
Picture
Meet the next generation of Vinduino!
The prototype picture shows the main parts:

  • lowest cost Arduino board
  • 3 inputs for gypsum soil sensors
  • RTC board for timed measurement and battery saving system sleep/wake up
  • low cost APC220 RF module for miles of coverage with a suitable antenna
Future plans include: making a PCB available for easy reproduction, solar battery charging support, Arduino code improvements. Stay tuned for further updates!

 
 
Picture
In cases where soil is extremely dry or wet, the Vinduino measurement becomes less accurate. This is due to the Arduino 10-bit ADC (voltage measurement) resolution, that will become an increasingly stronger factor in the extreme corners of the measurement range.

The graph on the left shows how the measurement accuracy changes with the sensor resistance value. A lower reference resistor value gives better accuracy in the lower sensor resistor range, and for better measurement accuracy at high sensor resistance a higher value reference resistor helps. 

The goal of Vinduino is to help with irrigation management, so we are not really interested in high accuracy when the soil is totally soaked or bone dry, beyond the point of permanent plant wilting. We need best accuracy at the target soil moisture level. With this data in mind, my choice is for using 4700 Ohm, as this gives good accuracy in the most common soil moisture range.  With the described sensor design, 100% moisture gives a sensor value around 300 Ohm, at 50% soil moisture the sensor reads 1 kilo Ohm. Refer to the Vinduino sensor calibration blog post for more details.

Whatever resistance value you choose for the R1 and R2 resistors connected to the sensor, should be declared in the software code. So for using 4k7 Ohm resistors (4700 Ohm), the Arduino code should be changed to:
const long knownResistor = 4700;  // Constant value of known resistor in Ohms
For ultimate accuracy, as resistors usually come with a tolerance of 5% or 1%, you can measure the real resistance with a multimeter and enter that as known resistor value.

Picture
Checking the accuracy based on ADC resolution for a reference resistor of 4700 Ohm, shows better than 3% measurement accuracy for soil moisture between 80%-20%, and 1% accuracy for the lowest moisture level (where irrigation should switch on). This should be good enough for our purpose.

 
 
I received many questions about the details of the gypsum soil moisture sensor, so here is a picture overview of the casting step details. Please make sure to use stainless steel machine screws only, the galvanized types oxidize rendering the sensor useless.
The mould I used is a 3/4" PVC pipe coupler. Sand down the inside to make it smooth, helping to release the cast when hardened. Use tape to keep the gypsum from leaking out. The saw cut allows for prying the mould open with a screw driver, you should be able to push out the cast easily.

After connecting the wires, isolate the external electrodes and connections with liquid tape to make sure that the there is no external parallel electrical path
.
Picture
And here is another way of making a gypsum sensor. Check out below link for more details: http://unpuntilloalambre.blogspot.com.es/2014/01/gypsum-block-for-soil-moisture-sensor.html

 
 
The Vinduino project goal is to provide an accessible measurement tool for smart irrigation management. Although the Vinduino soil moisture measurement project was originally developed for saving the irrigation cost of our vineyard, it can equally well be used for other agricultural applications, a school science project, or even to reduce the water consumption of sprinklers in your own backyard. While this is a "technical" project, we have tried to keep it low cost, accessible, and easy to reproduce.

The updated version 3.0 of the Vinduino code for the Arduino open source micro controller board is now available for free download, thanks to contributions from Theodore H. Kaskalis. Technology Management Department, University of Macedonia, Greece.
Theodore co-authored a paper about smart digital farming: An Embedded System for Smart Vineyard Agriculture

Vinduino 3.0 improvements include:
  • streamlined and corrected code
  • sensor calibration equation
  • median noise filter instead of averaging filter

Download the Vinduino code here (5kb) ("save link as")

For an overview of all Vinduino project related postings click here

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
Picture
Merry Christmas! The new version of the Vinduino code for the Arduino open source micro controller board is now available for free download.

Improvements include:
  • moisture percentage indication 1% - 100%
  • sensor calibration equation
  • wider sensor resistance range
  • Support for the "Ohm" character

Download code here (5kb) ("save link as")

For an overview of all Vinduino project related postings click here

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 
 
Picture
The Arduino micro controller board used in our Vinduino project measures the electrical AC resistance of gypsum soil moisture sensors. As we are interested in the actual soil moisture in our vineyard, we wanted the Vinduino reader to display soil moisture as well as sensor resistance. First step to get there is calibration of the sensors to find the relation between resistance and moisture level.
The calibration method described here is a simplified version of the gravimetric calibration method described on-line by the Arizona university. We assume that there is equilibrium between soil- and sensor moisture.

We measured the weight and electrical resistance of 6 sensors, starting with sensors that were fully soaked and saturated with water, and keep repeating the measurements until the sensors were completely dry. The weight difference between fully saturated and completely dry sensors was used as calibration point for 100% and 0% moisture respectively. The idea behind this is that the soil sensor would reach moisture equilibrium with the surrounding soil, and moisture in the sensor is assumed to be the same as the surrounding soil moisture level.

The measurement results are shown in below scatter chart. Note that the vertical scale (resistance) is logarithmic.
The trend line (continuous line) was used to convert measured electrical resistance into moisture level  percentage. For sensor 3 and sensor 6 we found that trapped air from casting the gypsum was the probable cause for measurement differences between 40-15% moisture. Apart from that, all 6 measured sensors followed the same moisture/resistance curve pretty close. We have not made measurements at different temperatures to check temperature dependency.

Conversion equations (Excel) found for this particular type of sensor are:
Resistance=331.55*POWER(Moisture,-1.695)
Moisture=POWER((Resistance/331.55),(1/-1.695))

Please refer to the Vinduino code for implementation of the conversion equation.

Measurement data tables (Excel file) can be downloaded from this link. Sensor Calibration

For an overview of all Vinduino project related postings click here


Picture

 
 
Picture
With the wine in the tanks and vineyard work winding down, this is a good moment to share the programming part of the Vinduino soil moisture sensor. For a description of the hardware and how to make a gypsum block soil moisture sensor, please refer to the previous "Vinduino" postings.

The program below can be used for a very basic version without LCD display, or for a version with LCD display as shown in the picture.
To use below code without display, you can remove the programming lines starting with "lcd.set" and " lcd.print". Also the library code "LiquidCrystal.h" is not needed.

Programming the Arduino board is easy. Download the latest software code version here and upload the code to the Arduino board.

For an overview of all Vinduino project related postings click here