Raspberry Pi Irrigation Control – Part 4

In the past three tutorials we have assembled the irrigation board, wrote the code to run our system, and figured out how to run it on a schedule. In the last part of this tutorial series we are going to look at installing our irrigation controller and some of the most common setups.

Overview:
Before we get started, you should have completed the previous three sections of this tutorial. At this point your piping and irrigation should also be completed to the point where it can be run once the controller is installed. If you are replacing your existing system it is a good time to get in there and label each of the wires. This section will be very subjective to your setup and the location you are installing the Pi – so we will not be too specific!

Requirements:

parts

This tutorial requires several items:
[list type=”check”]

  • A completed assembly from Part 1 of this tutorial set
  • Completed code from Part 2 of this tutorial set
  • Completed setup from Part 3 of this tutorial set
  • 1 x Pi 3 / 3+ capable power supply
  • A USB Keyboard & Mouse
  • A HDMI compatible monitor
  • Internet access
  • Desktop Computer / Laptop
  • [/list]

    Step 1 – Connecting To The Pi

    Step4

    Before we get too carried away and move the system outdoors – lets make sure we can still access it easily without having to drag a keyboard / monitor / mouse outside to change our settings. We are going to do this by setting up a remote desktop. This allows us to view the Raspberry Pi desktop from another computer on the network as if we were right in front of the Pi. Once the remote desktop is enabled we can log in to the Pi and change our settings from our computer without leaving the couch / desk / etc.

    Step 2 – Enable VNC

    Step4

    From the menu, open Raspberry Pi Configuration and select the “Interfaces” tab. On that tab, enable VNC. That’s it, the Pi is configured. The Raspberry Pi Foundation has a great writeup with a bunch more detail about VNC and its more advanced functions here.

    Step 3 – Install A VNC Viewer

    Step4

    The other half of the setup is done on whatever device you want to use to work on your Raspberry Pi. We recommend using VNC Viewer – it is freely available and works on just about any operating system: https://www.realvnc.com/en/connect/download/viewer/

    Step 4 – Test It Out

    step10

    On the Raspberry Pi, grab your IP address by hovering the mouse cursor over the network connection logo in the top right corner. Load up VNC Viewer on your controlling device (computer) and type the IP address of your Pi in. You will be prompted with a security warning and then a username and password. The username and password are your normal credentials for the Pi. So if you haven’t changed anything it would be username: pi , password: raspberry

    Once that is entered, the Raspberry Pi desktop should appear on your screen. Pretty cool huh?

    Time to shut it down and move it outdoors.

    Step 5 – Where To Locate The Pi

    Now that we can remotely access the Pi, it can be installed anywhere and still relatively easy to work on. This part is very relative to your setup / location – but the Pi should be installed somewhere that the Pi can be easily powered and wires can be easily run to wherever the solenoids are located. You will also need to consider the sensor locations and how the wires will be run. Finally, the Pi also needs to be protected from the elements – so if it is outdoors you may want to consider a weatherproof box.

    Step 6 – Connecting The Solenoid Wires

    Solenoids can be connected up a few different ways. Most commercial systems will have a common power wire with a return wire for each solenoid. For situations where solenoids are not located near one another or for custom builds this many not be the case. The Irrigation Board can handle both situations.

    If you have a single common power wire (commercially installed irrigation systems): connect the common wire to S1’s “+” pin. Now connect each of the return wires to their respective channels “-“ pin as shown here:


    Step4

    If you have individual power wires, just run each pair of wires to their respective “+” and “-“ pins. As shown here:

    Step4

    Step 7 – Sensors

    Depending on where your control box is located, you may need to extend wires to position your sensors where you want them. If you are lucky, many professionally installed sprinklers have extra unused wires in their control cables that can be commandeered to connect sensors. Otherwise, additional cable may need to be run to get your sensors. If running cables is a pain – it may be easier to relocate the Pi closer to where the sensors are needed.

    Step 8 – Powering The Solenoids

    Most commercial systems use a 24VAC power supply – so if you are replacing an existing irrigation controller you can’t reuse the power supply. This is due to the design of the circuits and the power requirements of the Pi. Instead, we are going to replace it with a DC Power supply. A 12VDC 3A supply should be more than sufficient to drive most irrigation solenoids along with the Pi. We do suggest testing this first as it will depend on the type of valve, the age of the valve, and the water pressure; higher voltages may be required to get the valve to trigger. To connect it to the board, either cut the DC Barrel off the end of the cable or use one of these DC Barrel Adapters if you prefer.

    Step 9 – Powering The Pi

    Step4

    There are a few ways to do this – the easiest is to use the same 12V 3A supply to power the Pi by way of the optional power regulator slot on the Raspberry Pi Irrigation Board. We are using a 2.5A version of the 5V Buck Regulator by Pololu. This allows the Raspberry Pi to run of the input voltage for the solenoids. This regulator has a very wide input range – so even if you are running up around 24VDC for higher powered solenoids it will keep everything going quite nicely!

    Alternatively, you can power the Pi separately using a normal Raspberry Pi Power Supply and skip the Pololu voltage regulator – just note that this will not power the solenoids. You will still need that 12V 3A power supply in addition to the Pi power supply in this case.

    Step 10 – Power It Up And Test

    Double check all your connections and if everything checks out, go ahead and power it up. Test your VNC connection and then fire up Idle3 and load your program. Now run the program and test your system. Within a second or so you should see the first red light on the board turn on and water should start flowing (assuming your plumbing is hooked up!) At the end of the cycle you should receive your email with all your stats. You will likely need to adjust run times and settings going forwards – but with VNC running that is done from the comfort of your desk!

    Close Idle3, close your VNC connection and leave the Pi running. It should run automatically at the pre-defined times we set up in the last step from now on.

    [info]Have A Question?
    If you have any questions, or need further clarification please post in the comments section below; this way future users of this tutorial can see the questions and answers!
    [/info]