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
Components
Component | Description | Quantity | Unit price | Total |
---|---|---|---|---|
Wago electrical lever connectors 2-way | 10 | 0.59 | 5.9 | |
Wago electrical lever connectors 3-way | 5 | 0.78 | 3.90 | |
Wago electrical lever connectors 5-way | 1 | 1.04 | 1.04 | |
Water proof distribution box IP54 80x80x45 | 1 | 1.2 | 1.2 | |
Water proof distribution box IP54 70x40 | 3 | 1.40 | 4.20 | |
Domino bar x12 | 1 | 1.9 | 1.9 | |
7 core Multi conductor cable wire 15m 1mm | 1 | 31.32 | 31.32 | |
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.
Electronic part
Prerequisites
Overview
Components
Component | Description | Quantity | Site | Price |
---|---|---|---|---|
Relay AC 250V 10A ; DC 30V 10A Relay card module AC/DC 5V 4 channels | 1 | Ebay | 8.00 € | |
10 x Cables male/female female/female male/male | 30 | ebay | 1.00 € | |
Raspberry PI 3 | 1 | Farnell | 37.69 € | |
Power supply Micro USB 5V 2500mA | 1 | Amazon | 8.99 € | |
Micro SD Card 16go class 10 | 1 | amazon | 9.90€ | |
Bread board | 1 | ebay | 3.50€ | |
- | - | - | - | 69.08 € |
Wiring
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
[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.