Irrigation Automation — Solenoid Valves, Zones, and the End of 5am Walks to the Tank
How to build a multi-zone drip irrigation controller that opens valves based on soil moisture and weather forecasts. Wiring, zone planning, and what KES 18,0...
Irrigation Automation — Solenoid Valves, Zones, and the End of 5am Walks to the Tank
The Kenyan horticulture farmer who walks out at 5am to open the irrigation tap and again at 7am to close it loses about 18 productive hours a week to a job that should take zero. Irrigation automation is the IoT use case with the highest immediate quality-of-life impact for many farmers.
This post is the practical guide to building it. Six zones, soil-moisture-triggered or schedule-triggered, override-from-phone, fail-safe-closed if power is lost. About KES 18,000 in parts. Two weekends to install.
What automation actually does for you
A good irrigation system makes these decisions every day:
| Decision | Manual approach | Automated approach |
|---|---|---|
| When to start watering | You decide by clock or feel | Sensor says soil moisture is below 50%, system starts |
| How long to water | Standard time (e.g. 30 min) | Stop when soil moisture reaches 70% |
| Whether to water at all | You go anyway | Skip if rain is forecast in next 24 hours |
| Which zones get water today | All of them, by habit | Only the dry zones; others wait |
| What happens at night | Nothing, you sleep | System checks moisture, waters if needed |
The biggest wins are usually water savings (10–30%), labour time, and yield improvements from never under- or over-watering.
The components in a 6-zone setup
Water tank ─┬─ main pipe ─┬─ Valve 1 ─► Zone 1 (tomatoes)
│ ├─ Valve 2 ─► Zone 2 (capsicum)
│ ├─ Valve 3 ─► Zone 3 (kale)
│ ├─ Valve 4 ─► Zone 4 (onions)
│ ├─ Valve 5 ─► Zone 5 (beans)
│ └─ Valve 6 ─► Zone 6 (nursery)
│
└─ Flow meter ──► Controller box (Pi + relays)
At the controller box:
A Raspberry Pi (or an ESP32 controller, for a simpler standalone setup)
A 6-channel 12V relay board
A 12V DC power supply, wall-mounted with mains-rated wiring
A flow meter on the main pipe (optional but very useful for leak detection)
A physical override switch per zone (manual open, regardless of automation state) At each valve:
A 12V DC normally-closed solenoid valve, rated for the pressure of your water supply
Two thin wires running back to the controller box The two wires can run 20–50m on standard 0.5mm² speaker cable. They carry low voltage that is safe to handle.
Choosing the right valve
The valve is the part you must not skimp on. A leaky valve costs you a season.
Specifications to look for:
| Spec | Acceptable | Why |
|---|---|---|
| Voltage | 12V DC (not 24V AC) | Easier to control safely, cheaper PSU |
| Pressure rating | At least 0.05 MPa (your gravity head) up to 1.0 MPa | Most gravity-fed Kenyan tanks are well within this |
| Body material | Brass for high-pressure; plastic acceptable for gravity | Brass lasts longer |
| Failure mode | Normally closed | Power fails = water off, never flooded |
| Connection size | Match your pipe (½" or ¾" most common) | |
| Cable gland | Yes | Field installations get rained on |
Where to buy:
Ngara/Grogan Rd in Nairobi for physical inspection and same-day stock
AliExpress for cheaper bulk orders (4-6 week lead time)
Avoid anything under KES 800 — the diaphragm seals fail in a season Quality test before installing:
Connect to 12V briefly. Listen for a sharp click.
Connect a water source and confirm full open / full close.
Cycle 20 times. Confirm consistent operation.
Leave under pressure for 24 hours. Confirm no leak in closed state. This 30-minute bench test before deployment saves weeks of debugging in the field.
How the rules actually fire
The controller runs rules like:
For Zone 1 (tomatoes):
- If soil moisture < 50% AND no rain forecast in next 24h:
Open valve for up to 60 minutes
Close valve when moisture reaches 70% OR 60 minutes elapses
- Always close at night (07:00–18:00 only)
- Skip if flow meter shows unusual flow (possible leak)
These rules live on the Pi. They run even if your internet is down. The only thing that needs internet is the weather forecast — and that updates once an hour, so a 24-hour internet outage simply means rules fall back to "irrigate based on soil only."
You override from your phone:
- "Open Zone 3 for 15 minutes right now" — for spot watering
- "Disable all zones for the next 24 hours" — when you are away or harvesting
- "Pause Zone 6" — when the nursery is being transplanted Every automated action gets logged so you can see what happened while you were not watching.
Zone planning — the most important step
Most irrigation problems are zone-planning problems, not technical problems. A few rules:
One crop per zone
Each crop has different moisture targets. If tomatoes and kale share a zone, you under-water one and over-water the other. Worth the extra valve.
Match zone size to flow rate
If your tank supplies 2,000 litres/hour and you want each zone to deliver 500 litres of drip per cycle, you can run one zone at a time. Trying to open all six zones simultaneously starves them all.
Rough planning:
| Crop area per zone | Drippers per zone | Typical flow needed |
|---|---|---|
| 200 m² | 50 drippers @ 2 L/hr | 100 L/hr |
| 500 m² | 100 drippers @ 2 L/hr | 200 L/hr |
| 1,000 m² | 200 drippers @ 2 L/hr | 400 L/hr |
If your tank cannot supply more than 1,000 L/hr, do not try to run more than two large zones at once.
Slope and drainage
- Zones at the top of a slope dry faster than those at the bottom
- Zones on heavy clay drain slower than zones on sandy loam
- Match zone boundaries to soil type changes where possible
Water budgeting
A 10-acre farm with diversified vegetables typically uses 25,000–60,000 litres per day during the dry season. If your borehole or tank cannot supply that, the automation will not magically fix it — but it will use the available water more efficiently across zones.
Leak detection with a flow meter
A KES 1,500 flow meter installed on the main pipe is the cheapest insurance you can buy. It detects:
- Burst pipes (sudden high flow with valves closed)
- Failed valves stuck open (flow when no valve was opened)
- Slow leaks (small constant flow at night when nothing should be running) The controller compares actual flow with expected flow per zone. Out-of-range readings trigger an alert.
A real example: a Naivasha tomato farmer caught a buried-pipe leak that was costing 800 litres a day for two months. The flow meter paid for itself the day it was installed.
Toolkit and budget
What you need (6-zone setup):
| Item | Cost (KES) | Where |
|---|---|---|
| 6× 12V DC solenoid valves (½" or ¾") | 6,000–9,000 | Ngara or AliExpress |
| 1× 6-channel 12V relay board | 800 | AliExpress |
| 1× 12V 3A DC power supply | 1,200 | AliExpress or local hardware |
| 1× Pi 4 (or ESP32 standalone) | 9,000 (if not already owned) | Nerokas |
| 1× flow meter, ½" or ¾" | 1,500 | Ngara |
| Twin-core 0.5mm² cable, 150m | 1,500 | Local hardware |
| Weatherproof junction boxes (×6) | 1,200 | Local hardware |
| Plumbing fittings, tape, etc. | 2,000 | Ngara |
| Total (assuming Pi reused) | ~14,200 |
Steps:
- Plan zones on paper. Walk the farm.
- Buy valves, bench-test each one before going to the field.
- Wire the controller box at the homestead.
- Trench cable to each valve location.
- Plumb each valve into the main line.
- Configure rules on the Pi.
- Test each zone individually before enabling automation.
Time: 2 weekends from "I have parts" to "the farm waters itself."
Common irrigation automation failures
| Symptom | Likely cause | Fix |
|---|---|---|
| Zone never opens | Valve coil burned out, or relay not switching | Test valve with 12V direct; test relay separately |
| Zone opens but no water flows | Plumbing pressure too low; valve installed backwards | Check flow direction arrow on valve; verify pressure |
| Valve drips when "closed" | Diaphragm worn, debris under seat | Disassemble, clean; replace if old |
| Multiple zones open at once | Faulty relay board (channels stuck) | Replace relay board |
| Random valve openings at night | Voltage spike during brownouts | Add a flyback diode across each valve coil |
| Flow meter reads zero always | Wired backwards, or low flow below sensitivity | Check wiring; check minimum flow rating |
What to do next
Start with two zones, not six. Get the wiring, rules, and override behaviour confident on a small system. Once you have run two zones automatically for a month, scaling to six is straightforward.
The single biggest gain from irrigation automation is not water savings — it is the gift of consistent watering. Crops grown under a sensor-driven schedule are notably more uniform in size and quality than those grown by daily improvisation. Buyers pay better for uniform produce.
Alongside the hardware, track your input costs and harvest quantities at shira.farm. At the end of the season the soil + irrigation data plus the cost-and-yield numbers tell you exactly how much the automation saved you.
See it in action
Tap this exact setup on our interactive visual guide — photorealistic farm scenes with clickable explainers showing what every device does, what it costs, and which Shira tier unlocks it.
Open the IoT Showcase