The aim of this tutorial is to wire the electrical part of a sprinkler system. At the end of this tutorial, we will be able to control the sprinkler system from a Raspberry PI.

Electrical part

Prerequisites

Overview

Valves box final
Valves box final

Components

Component Description Quantity Unit price Total
borne_auto_levier_2 Wago electrical lever connectors 2-way 10 0.59 5.9
borne_auto_levier_3 Wago electrical lever connectors 3-way 5 0.78 3.90
borne_auto_levier_5 Wago electrical lever connectors 5-way 1 1.04 1.04
boite_étanche_IP54_80x80x45 Water proof distribution box IP54 80x80x45 1 1.2 1.2
boite_étanche_IP54_D70xP40 Water proof distribution box IP54 70x40 3 1.40 4.20
barrette_12_dominos_2.5mm Domino bar x12 1 1.9 1.9
multi_conducteur_7_brins 7 core Multi conductor cable wire 15m 1mm 1 31.32 31.32
transformer Transformer 220VAC/24VAC 1 31.19 31.19
- - - - 80.65€

Wiring

Electrical connection

  • Join electrical box to valves boxes with 7 multi-conductors wire
  • Install one distribution box at the entrance of the valves box.
  • Connect power supply to solenoid valve 24V with a transformer.

Tools: Electrical screwdriver, wire cutter, wire stripper.

Sprinkler electric part
Sprinkler electric part

Electronic part

Prerequisites

Overview

Electronic part
Electronic part

Components

Component Description Quantity Site Price
relay_card_raspberry Relay AC 250V 10A ; DC 30V 10A Relay card module AC/DC 5V 4 channels 1 Ebay 8.00 €
cable_MM_MF_FF 10 x Cables male/female female/female male/male 30 ebay 1.00 €
raspberry_pi_3 Raspberry PI 3 1 Farnell 37.69 €
power_supply_micro_USB_5V_2500mA Power supply Micro USB 5V 2500mA 1 Amazon 8.99 €
micro_sd_16go_class_10 Micro SD Card 16go class 10 1 amazon 9.90€
breadboard_raspberry Bread board 1 ebay 3.50€
- - - - 69.08 €

Wiring

Sprinkler Overview
Sprinkler Overview

Note:Connect relay with Raspberry PI (Control electronics). Each relay are supplied in 3.3V via Raspberry PI.

Software part

Prerequisites

Program

Get clone from github or this project.

git clone https://github.com/jluccisano/rpi-sprinkler-control.git

See more details:

https://github.com/jluccisano/raspberry-scripts/tree/master/scripts/home-automation

Follow install step describe in the README.md.

pip install https://github.com/jluccisano/rpi-sprinkler-control/archive/v0.0.2.tar.gz
pip show rpi-sprinkler-control
Name: rpi-sprinkler-control
Version: 0.0.1
Summary: Control your sprinkler system via a Raspberry PI
Home-page: https://github.com/jluccisano/rpi-sprinkler-control
Author: Joseph Luccisano
Author-email: joseph.luccisano@gmail.com
License: UNKNOWN
Location: /home/pi/.local/lib/python2.7/site-packages
Requires:

Create a service

See more

[Unit]
Description=Home Automation Server
After=multi-user.target

[Service]
ExecStart=/usr/bin/python /opt/home-automation/server.py
Type=simple
Restart=on-abort
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

Install release package

  • Connect to Rpi via SSH
  • Install package
  • Create Service
  • Run

Test

Get state of each valve

python zone_control.py get

Get state of specific zone

python zone_control.py get --zone 1

Set state of specific valve

python zone_control.py set --zone 1 --state 1

Set state of each valve

python zone_control.py set --state 1

Toggle state of specific valve

python zone_control.py toggle --zone 1

Now we are able to control sprinkler system from a Raspberry PI. That’s already a good point but we need to control directly from his mobile and from anywhere… Go to the next tutorial.