Arduino Irrigator

Arduino Irrigator

An arduino based automatic irrigation solution for gardens and farms.

Preparation

Get the Parts

Prepare Monitor Hardware

The irrigator system builds on top of the monitor system. To build the irrigator, first follow the instructions for setting up the monitor.

After following those instructions the soil moisture sensor will be installed and should look like this...

Install Sketch

Connect USB Cable

Connect the USB cable between the device and the garden computer.

Choose an Installation Approach

Choose between creating a device (including network functionality) or simply uploading the sketch on its own. You don't need to run both because the "create" script takes care of uploading.

Create Irrigator Device

If you want to use the Linear MQTT user interface then you need to create the device on the host computer.

This automated setup script does the following:

  • uploads sketch to device
  • adds device to Linear MQTT Dashboard user interface
  • adds device info to /devices/ directory

Arduino Nano

Use the following commands for an arduino nano compatible microcontroller.

Syntax:

  • sh create-garden-irrigator-nano.sh [DeviceLabel] [DeviceName] [Port]

Notes:

  • The port needs to match the USB/serial port that the microcontroller is connected to.
  • Don't include the /dev/ in the [Port] argument. Use ttyUSB0 instead of /dev/ttyUSB0.

Example:

  • sh create-garden-irrigator-nano.sh "Irrigator1" irrigator1 ttyUSB0

The output should look similar to this:

Arduino Uno

Use the following command for an arduino uno compatible microcontroller.

Syntax:

  • sh create-garden-irrigator-uno.sh [DeviceLabel] [DeviceName] [Port]

Notes:

  • The port needs to match the USB/serial port that the microcontroller is connected to.
  • Don't include the /dev/ in the [Port] argument. Use ttyUSB0 instead of /dev/ttyUSB0.

Example:

  • sh create-garden-irrigator-uno.sh "Irrigator1" irrigator1 ttyUSB0

The output should look similar to this:

Upload the Irrigator Sketch

Notes:

  • If you've already run the "create" script above then you don't need to run this as it has already been run.
  • This script can be used if you want to update or re-upload the sketch directly.

Arduino Nano

Use the following command for an arduino nano compatible microcontroller.

Syntax:

  • sh upload-irrigator-nano-sketch.sh [Port]

Notes:

  • The port needs to match the USB/serial port that the microcontroller is connected to.
  • Don't include the /dev/ in the [Port] argument. Use ttyUSB0 instead of /dev/ttyUSB0.

Example:

  • sh upload-irrigator-nano-sketch.sh ttyUSB0

The output should look similar to this:

Arduino Uno

Use the following command for an arduino uno compatible microcontroller.

Syntax:

  • sh upload-irrigator-uno-sketch.sh [Port]

Notes:

  • The port needs to match the USB/serial port that the microcontroller is connected to.
  • Don't include the /dev/ in the [Port] argument. Use ttyUSB0 instead of /dev/ttyUSB0.

Example:

  • sh upload-irrigator-uno-sketch.sh ttyUSB0

The output should look similar to this:

Once you see data being written to the screen the device is running, and should now respond to commands.

Press CTRL+C to exit back to the terminal prompt.

Disconnect USB Cable

Disconnect the USB cable so the power is off before continuing with assembly.

Assembly

Install the MOSFET module

The MOSFET module allows high power devices such as the pump to be switched on and off using a microcontroller.

Connect 3 wires to the MOSFET module:

  • Black - GND
  • White - VCC
  • Gray - SIG

Connect the 3 wires to the arduino nano development board:

  • Black - G
  • White - V
  • Gray - D11 (digital pin 11)

The MOSFET module and arduino nano expansion board should now be connected like this:

Connect USB Cable

Connect the USB cable to the device so it powers on.

Test the MOSFET module

The LED on the MOSFET module should now be flashing on and off:

If the LED is flashing at on and off then it appears the MOSFET module is wired up correctly.

Disconnect USB Cable

Disconnect the USB cable to power off the device before continuing.

Install the Voltage Regulator

Connect a female DC jack to the MOSFET module input terminal:

Connect two short wires to the MOSFET output terminal:

Connect the MOSFET module output terminal to the voltage step down (buck) input terminal:

Install a Power Splitter

Connect the male ends of a DC jack splitter cable to both the arduino nano expansion board and the MOSFET module input:

Connect 12 Power Supply

Connect a 12v power supply to the power splitter.

Check the Voltage Regulator

The arduino will turn on then the MOSFET module and the voltage step down (buck) regulator should now both flash on and off:

Adjust the pump voltage

Use a screwdriver to adjust the potentiometer on the voltage step down (buck) regulator if necessary.

Notes:

  • The recommended voltage is between 3v and 6v for most small peristaltic pumps in this project.
  • The lower the voltage the slower the water will be pumped.
  • Do not exceed the maximum voltage of the pump or it may be destroyed. Depending on the type of pump the maximum may be either 6v or 12v.

For many small pumps 3v is a good starting point.

Disconnect Power

Disconnect the 12v power supply before continuing.

Connect the Pump

Various pumps or valves can be attached to this system but in this example a small peristaltic pump will be installed.

Connect a male DC jack to the output terminal of the voltage step down (buck) regulator:

Connect the output jack of the voltage step down (buck) regulator to the input jack of the pump:

Connect 12v Power

Connect the 12v power supply to the project.

Check the Pump

The device will turn on, then you should hear the pump buzzing on and off.

If the pump is switching on and off then the device appears to be working correctly.

Notes:

  • The irrigator sketch turns the pump on for a short burst, then off again to wait for the water to soak in, then repeats until the soil moisture level reaches the threshold. This is intentional behavior to avoid saturating the soil too rapidly and/or flooding.
  • The burst on duration and off duration can be modified via a mobile application. Follow the the networking walkthrough for instructions on how to set it up.

Test the Irrigator

Connect the 12v Power Supply

Connect the 12v power supply to the device.

Connect the USB Cable

Connect the device to the host computer using a USB cable.

Note: This step is optional. It's only required if you want to view the serial data coming from the device.

Monitor Device Output

View the device output:

  • pio device monitor
  • The output should look similar to this:

Submerge the soil moisture sensor into water, damp soil, or equivalent:

The sensor readings should change and be similar to this:

Notice the R (raw) value decreases and the C (calibrated) value increases. This means it's detecting the water.

The pump should switch off and stay off because it senses the water.

If the pump:

  1. turns on (in bursts) when the soil moisture sensor is dry and
  2. turns off when the soil moisture sensor is wet

...then it appears the irrigator system is working.

Test again by removing the soil moisture sensor to ensure the pump comes back on after a few seconds.

Troubleshooting

Test the Soil Moisture Sensor Readings

The soil moisture sensor readings can be tested to ensure that it's working correctly.

Test the Soil Moisture Sensor Power

The soil moisture sensor power can be tested to ensure that it's working correctly.

Test Pump Output

The pump output can be tested to ensure that it's working correctly.

Calibrate via Mobile Device

The simplest way to calibrate the irrigator is to set up networking and then use a mobile device.