Skip to the content
2 layers100 × 90 mmValvenode, the printed circuit board in 3D

Wired RS-485 field-bus irrigation valve controller for Raspberry Pi farm automation

Size
100 × 90 mm
Copper layers
2
Thickness
1.6 mm
Parts
39
Nets
41
Pads
146
Tracks, vias
219, 34
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
3 May 2026
Updated
12 Jun 2026

Overview

Valvenode is an open-source printed circuit board by vinthewrench, from the vinthewrench/valvenode repository on GitHub. It is a 2-layer board of 100 × 90 mm with 39 parts on 41 nets, routed with 219 tracks and 34 vias.

It is built around the ATTINY4313-PU, MAX485EPA(LX) and 151033GS03000, with the 1N4148WS and P6SMB18A among its other parts. Its parts include 11 capacitors, 6 resistors, 5 ICs, 4 connectors and 3 diodes. It belongs with the audio and music boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

5

README

README.md

ValveNode

ValveNode is a wired field-bus irrigation valve-control system for my Raspberry Pi farm automation stack.

This project is a continuation of the work described in Off-Grid Farm Automation with Raspberry Pi.

The irrigation side started with a Raspberry Pi, relay outputs, and conventional sprinkler valve wiring, described in Raspberry Pi Internet of Things - part 2: Controlling the Irrigation valves. That proved the basic idea: local software can control real irrigation hardware without a cloud service or proprietary controller. It also exposed the usual field problems: long wire runs, voltage drop, power loss, serviceability, and too many individual valve wires returning to one box.

I later experimented with more efficient solenoid drive hardware using a DRV103 in Not Another Sprinkler Valve Article. That design gives a conventional valve a strong opening pulse and then reduces average power with PWM, which matters for long wire runs and battery-backed operation.

As the farm kept expanding, the wiring problem started to matter more than the valve-control problem. Every new irrigation zone meant another long wire run back to the controller, more trenching, more splices, more voltage drop, and more things to troubleshoot later. At that point, spending a few extra dollars per valve for latching solenoids was worth it if it let the field wiring become a simple 4-wire RS-485 network.

ValveNode takes the next step: instead of pulling every valve wire back to the controller, it moves small controller cards out into the field.

A Raspberry Pi talks to a Valve Master over I2C. The Valve Master starts a 4-wire RS-485 field cable carrying power and data. Valve Node cards sit along that cable, and each card drives a local latching irrigation solenoid with a short polarity-controlled pulse.

The goal is simple: irrigation control that is local, wired, understandable, repairable, and expandable.

Overview

The project has two primary components:

  • valvenode-master
    ATmega88PB-based I2C-to-RS-485 master controller.

    valvenode-master

  • valvenode-slave
    ATtiny4313-based RS-485 valve node for controlling latching irrigation valves.

valvenode

The upstream controller talks to the Valve Master over I2C. The Valve Master controls field power and communicates with downstream Valve Nodes over RS-485.

ValveNode topology

Latching Solenoids

ValveNode is designed around low-voltage DC latching irrigation solenoids. The initial supported solenoids are:

ManufacturerPartDescriptionNotes
Hunter458200DC latching solenoidCommon Hunter solenoid for battery-operated and DC-latching valve control
Rain BirdK80920 / TBOSPSOL9 V DC potted latching solenoidFits many Rain Bird valve bodies, including DV, DVF, ASVF, PGA, PEB, PESB, GB, EFB-CP, BPE, and BPES series valves

A latching solenoid is not powered continuously. The Valve Node drives it with a short polarity-controlled pulse through the H-bridge: one polarity opens the valve, the opposite polarity closes it, and then the output is turned off.

Project Goals

  • Wired field-bus control for irrigation valves
  • No cloud dependency
  • No wireless dependency
  • Local 12 V field-power switching
  • Half-duplex RS-485 node communication
  • AVR-based firmware that can be understood, built, and serviced
  • KiCad hardware source included
  • Separate master firmware, simulator, Linux test tool, and node firmware

Repository Layout

text
valvenode/
├── valvenode-master/
│   ├── docs/
│   ├── firmware/
│   ├── hw/
│   │   └── 1.0/
│   ├── sim/
│   └── test/
└── valvenode-slave/
    ├── docs/
    ├── firmware/
    ├── hw/
    │   ├── 1.0/
    │   └── 1.1/
    └── test/

Valve Master

Path:

text
valvenode-master/

The Valve Master is the central controller for the valve-node network.

It performs these jobs:

  • Accepts host commands over I2C
  • Controls switched 12 V field-bus power
  • Sends RS-485 commands to downstream valve nodes
  • Receives valve-node replies
  • Maintains node discovery state
  • Reports status and command results to the host
  • Provides local visual status indication
  • Exposes AVR ISP programming access

Default I2C address:

text
0x09

Address 0x08 is reserved for a separate power-control board, so 0x09 is used as the default Valve Master address.

Valve Master Hardware

Path:

text
valvenode-master/hw/1.0/

Important KiCad source files:

text
valvenode-master.kicad_pro
valvenode-master.kicad_sch
valvenode-master.kicad_pcb

The master board uses:

  • ATmega88PB-AU
  • MAX485-style RS-485 transceiver
  • Relay-switched 12 V field-bus output
  • FAULT input
  • COMM and FAULT indicators
  • AVR ISP header
  • I2C host-side interface

Valve Master Firmware

Path:

text
valvenode-master/firmware/

Files:

text
makefile
valvenode_master.c

The firmware implements the production Valve Master behavior:

  • I2C slave interface
  • Register map
  • Deferred command handling
  • RS-485 transmit/receive control
  • Field-bus power control
  • Node discovery
  • Valve-node command dispatch
  • Result and reply registers
  • Fault/status reporting

Directed RS-485 commands include timeout handling and retry behavior. A single missed node reply should not turn into an immediate hard failure on a slow irrigation field bus.

Build:

bash
cd valvenode-master/firmware
make

Valve Master Simulator

Path:

text
valvenode-master/sim/

Files:

text
makefile
valvenode_master_sim.c

The simulator models the master command/register behavior for bench testing without hardware.

Build:

bash
cd valvenode-master/sim
make

Valve Master Linux Test Tool

Path:

text
valvenode-master/test/

Files:

text
makefile
Doxyfile
src/

Source files:

text
I2C.cpp
I2C.hpp
LogMgr.cpp
LogMgr.hpp
TimeStamp.cpp
TimeStamp.hpp
Valve_master.cpp
Valve_master.hpp
main.cpp

The test tool is a Linux-side C++ program used to talk to the Valve Master over /dev/i2c-*.

The main C++ class is:

text
Valve_master

It wraps the Valve Master I2C register map and command model.

Typical responsibilities:

  • Open the Linux I2C device
  • Select the Valve Master I2C address
  • Read and write registers
  • Submit commands
  • Wait for command completion
  • Read command results
  • Read reply registers
  • Read discovered node map
  • Query firmware versions
  • Control field power
  • Ping nodes
  • Set valve/channel state

Build:

bash
cd valvenode-master/test
make

Common valve commands:

bash
./valve status
./valve power on
./valve power off
./valve who
./valve map
./valve ping 1
./valve set 1 1 on
./valve set 1 1 off
./valve channel 1 1 status
./valve version master
./valve version 1
./valve identify 1
./valve cancel

Provisioning commands:

bash
./valve config
./valve assign 7
./valve move 7 8

Hammer Test

Path:

text
valvenode-master/test/hammer.sh

hammer.sh repeatedly exercises the full Valve Master path.

Test pattern:

text
power on
ping nodes
initial status nodes
loop:
  set ON nodes
  status nodes
  set OFF nodes
  status nodes
final status nodes
power off

Example:

bash
cd valvenode-master/test
./hammer.sh 25
NODES="1 3 4 5 6" CHANNEL=1 ./hammer.sh 500

Optional settings:

bash
CHANNEL=2 ./hammer.sh 25
VERBOSE=1 ./hammer.sh 25
VALVE_BIN=./valve ./hammer.sh 25
NODES="1 3 4 5 6" ./hammer.sh 25
RETRY_ON_FAIL=1 ./hammer.sh 25

Recent bench result:

text
500 loops
5 nodes tested: 1 3 4 5 6
channel 1
10,016 commands
0 failures
100% first-try pass rate

Generate local Doxygen docs:

bash
cd valvenode-master/test
doxygen Doxyfile
open docs/html/index.html

Valve Master I2C Register Model

The host talks to the master through a small register map.

Important registers include:

text
REG_COMMAND
REG_STATUS
REG_ARG0
REG_ARG1
REG_ARG2
REG_RESULT
REG_POWER_STATE
REG_NODE_COUNT
REG_REPLY_NODE
REG_REPLY_CMD
REG_REPLY_ARG0
REG_REPLY_ARG1
REG_VERSION_HI
REG_VERSION_LO
REG_NODE_MAP

Important command values include:

text
CMD_POWER_ON
CMD_POWER_OFF
CMD_WHO
CMD_PING
CMD_SET_CHANNEL
CMD_GET_CHANNEL_STATUS
CMD_GET_NODE_VERSION
CMD_IDENTIFY
CMD_CANCEL
CMD_CONFIG
CMD_ASSIGN
CMD_CLEAR_ERROR
CMD_SET_ERROR
CMD_CLOSE_ALL

Important status bits include:

text
STATUS_BUSY
STATUS_ERROR
STATUS_POWER_ON

Important result values include:

text
RESULT_OK
RESULT_BAD_COMMAND
RESULT_BAD_NODE
RESULT_BAD_CHANNEL
RESULT_NODE_NOT_FOUND
RESULT_UNSUPPORTED_CHANNEL
RESULT_CONFIG_REQUIRED
RESULT_ADDRESS_IN_USE
RESULT_BUSY
RESULT_RS485_TIMEOUT
RESULT_RS485_BAD_CHECKSUM
RESULT_RS485_BAD_REPLY
RESULT_POWER_OFF

Valve Node

Path:

text
valvenode-slave/

The Valve Node is the remote field device. It receives RS-485 commands and drives a 12 V latching irrigation valve.

Core functions:

  • Receive framed RS-485 commands
  • Check destination address
  • Respond to discovery and status commands
  • Drive a latching valve using a polarity-controlled pulse
  • Turn the H-bridge fully off after each pulse
  • Report current logical valve state

Valve Node Hardware

Paths:

text
valvenode-slave/hw/1.0/
valvenode-slave/hw/1.1/

Important KiCad source files:

text
valvenode.kicad_pro
valvenode.kicad_sch
valvenode.kicad_pcb

The 1.1 hardware directory is the newer active revision.

The node hardware uses:

  • ATtiny4313
  • 5 V RS-485 transceiver
  • VNH7100BAS / VNH7100BASTR H-bridge
  • 12 V latching irrigation valve output
  • 12 V field-bus input
  • Local 5 V regulator
  • Optional status LED

Basic field connection:

text
+12 V
GND
RS-485 A
RS-485 B

The design is intended for direct-burial irrigation cable.

Recommended cable:

  • 18/4 acceptable for shorter runs
  • 16/4 preferred for longer runs or higher node counts

Valve Node Power Architecture

The node receives 12 V from the field cable.

Power paths:

  • 12 V directly feeds the valve driver supply
  • 12 V feeds a local 5 V regulator
  • 5 V powers the ATtiny4313 and RS-485 transceiver

Recommended protection and stability parts include:

  • Bidirectional TVS across the 12 V input
  • Bulk capacitance near the H-bridge supply
  • 0.1 uF local decoupling at MCU and transceiver
  • Additional 5 V bulk capacitance near the MCU
  • Reverse-polarity protection where practical

For master-side field power switching, allow roughly 250 to 300 ms after switching on the 12 V field bus before sending node commands.

Valve Node Firmware

Path:

text
valvenode-slave/firmware/

Files:

text
makefile
valvenode.c
valvenode_example_commands.txt

The firmware target is the ATtiny4313.

Firmware responsibilities:

  • UART receive
  • RS-485 command parsing
  • Address matching
  • Optional checksum checking
  • Valve open pulse
  • Valve close pulse
  • Status reporting
  • Ping reply
  • WHO discovery reply
  • Safe H-bridge shutdown after each pulse

Build:

bash
cd valvenode-slave/firmware
make

Valve Node Test Tool

Path:

text
valvenode-slave/test/

Files:

text
makefile
src/main.cpp

The vnode utility is used for direct bench testing of valve nodes over a serial port. It assumes the computer is connected to the RS-485 bus through a USB-to-RS-485 adapter.

This bypasses the Valve Master and talks directly to the nodes.

Build:

bash
cd valvenode-slave/test
make

Example:

bash
./vnode -d /dev/ttyUSB0 who
./vnode -d /dev/ttyUSB0 ping 1
./vnode -d /dev/ttyUSB0 open 1 1
./vnode -d /dev/ttyUSB0 close 1 1

Typical output:

text
$ ./vnode -d /dev/ttyUSB0 who
device: /dev/ttyUSB0
baud:   9600
tx: :FFW\r
rx: :01WB8  [checksum ok] node=1 WHO
rx: :02WB9  [checksum ok] node=2 WHO

vnode can also be used to configure a fresh node, assign its address, and verify that it answers before it goes into the field.

RS-485 Valve Node Protocol

The Valve Master and Valve Nodes communicate over a half-duplex RS-485 bus.

The node protocol is command/response. The master sends a framed command. A node replies only when addressed or when participating in a controlled discovery response.

Typical commands:

text
PING
STATUS
OPEN
CLOSE
WHO
IDENTIFY
CONFIG
ASSIGN
VERSION

Typical behavior:

  • PING confirms node presence
  • STATUS reports logical valve/channel state
  • OPEN sends the open-polarity valve pulse
  • CLOSE sends the close-polarity valve pulse
  • WHO is used for node discovery
  • IDENTIFY asks a node to identify itself
  • CONFIG enters configuration behavior
  • ASSIGN sets or changes a node address
  • VERSION reports firmware version

Broadcast state-changing commands should be avoided unless explicitly implemented and safe.

Useful Linux I2C Commands

List I2C buses:

bash
i2cdetect -l
ls -l /dev/i2c-*

Scan I2C bus 1:

bash
i2cdetect -y 1

Look for the Valve Master at address 0x09.

Check user permissions for I2C:

bash
groups
ls -l /dev/i2c-*

If needed, add the user to the i2c group on Linux:

bash
sudo usermod -aG i2c $USER

Then log out and back in.

Development Notes

  • The Valve Master default I2C address is 0x09.
  • The Valve Master controls field-bus 12 V power.
  • The Valve Nodes are not autonomous irrigation controllers.
  • Valve Nodes execute direct command/response behavior.
  • Latching valves must be driven with short pulses, not continuous power.
  • H-bridge outputs must be turned off after each pulse.
  • RS-485 bus direction control must be handled carefully to avoid bus contention.
  • Field wiring should assume noise, voltage drop, wet boxes, lightning exposure, and field-service abuse.

Current Project Status

The repository currently contains:

  • Valve Master hardware design
  • Valve Master firmware
  • Valve Master simulator
  • Valve Master Linux I2C test tool: valve
  • Valve Master hammer test: hammer.sh
  • Valve Node hardware revisions
  • Valve Node firmware
  • Valve Node direct RS-485 test tool: vnode
  • Protocol and design documentation

Current bench status:

  • Valve Master can switch field power
  • Valve Master can communicate with multiple valve nodes over RS-485
  • Valve nodes respond to discovery, ping, set, and status commands
  • hammer.sh has completed a 500-loop, 10,016-command bench test across five nodes with zero failures

Remaining validation:

  • Confirm final latching-solenoid open/close polarity with real valve bodies
  • Test final assembled boards in outdoor enclosures
  • Validate longer real field-cable runs
  • Continue field reliability testing before treating the system as deployed infrastructure

Parts

39
QtyValueFootprintReferences
6.1ufRCER71H104K0DBH03A:RCER71H104K0DBH03AC2, C4, C5, C7, C10, C11
3470ΩResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_HorizontalR2, R3, R4
347ufCapacitor_THT:CP_Radial_D5.0mm_P2.00mmC3, C8, C9
2151033GS03000LED_THT:LED_D3.0mmLED1, LED2
2VNH7100BASTRVNH7100BASTR:SOIC127P600X175-16NU3, U4
1+12TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-4-5.08_1x04_P5.08mm_HorizontalJ1
1100KResistor_THT:R_Array_SIP7RN2
110KResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_HorizontalR1
110ufCapacitor_THT:CP_Radial_D5.0mm_P2.00mmC6
11KResistor_THT:R_Array_SIP12RN1
11N4148WSDiode_THT:D_DO-35_SOD27_P7.62mm_HorizontalD1
120KResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_HorizontalR5
1470ufCapacitor_THT:CP_Radial_D5.0mm_P2.00mmC1
15.6KResistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P7.62mm_HorizontalR6
1ATtiny4313-PPackage_DIP:DIP-20_W7.62mmU1
1AVR-ISP-6Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ2
1D45V5F5D45V5F5:D45V5F5U2
1LOGOLOGOG***
1LOGOAARDVARK:aard1X
1MAX485EPAPackage_DIP:DIP-8_W7.62mmU5
1P6SMB18ADiode_SMD:D_SMB_HandsolderingTVS1
1RESETButton_Switch_THT:SW_PUSH_6mmSW1
1VALVE1TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ4
1VALVE2TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-2-5.08_1x02_P5.08mm_HorizontalJ3

The 35 most common of 39 parts.

More from vinthewrench/valvenode

2
  • 2 layers90 × 60 mmValvenode master, the printed circuit board in 3D

    Valvenode master

    vinthewrench/valvenode

    Wired RS-485 field-bus irrigation valve controller for Raspberry Pi farm automation

    54 parts15
  • 2 layers100 × 70 mmValvenode, the printed circuit board in 3D

    Valvenode

    vinthewrench/valvenode

    Wired RS-485 field-bus irrigation valve controller for Raspberry Pi farm automation

    44 parts15

Similar boards

  • 2 layers82.5 × 85.3 mmBSPD-27, the printed circuit board in 3D

    BSPD-27

    Full-Blue-Racing/BSPD-27

    BSPD for the fbr27 car

    108 parts
  • 2 layers65.3 × 64.1 mmPanel, the printed circuit board in 3D

    Panel

    GMagician/Oled-Board

    Simple OLED board

    33 parts2GPL-3.0
  • 2 layers203.2 × 149.9 mm65C02 Computer, the printed circuit board in 3D

    65C02 Computer

    dbuchwald/6502

    DB6502: 65C02 based computer inspired by BE6502

    68 parts177MIT
  • 2 layers98 × 135 mmDMH VCO 40106 PCB, the printed circuit board in 3D

    DMH VCO 40106 PCB

    DeMarco/DMH-VCO-40106

    VCO module based on the CD40106 Hex Inverter chip

    147 parts5
  • 2 layers86 × 60 mmMotor Controller 2020, the printed circuit board in 3D

    Motor Controller 2020

    camhan22/Motor-Controller

    12-48VDC 65A Continuous 150A Peak brushed DC motor driver

    51 parts3GPL-3.0
  • 2 layers38.2 × 110.1 mmMidi to cv, the printed circuit board in 3D

    Midi to cv

    rafaelmartins/eurorack

    Designing and building an Eurorack synthesizer at home.

    48 parts2
  • 2 layers97 × 49 mmTimerbox, the printed circuit board in 3D

    Timerbox

    dunz0r/Circuits

    Schematics, PCBs, libs

    29 parts

Questions

How big is the Valvenode PCB?

It measures 100 × 90 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Valvenode use?

39 parts, built around the ATTINY4313-PU, MAX485EPA(LX), 151033GS03000 and 1N4148WS. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Valvenode KiCad files?

From the vinthewrench/valvenode repository on GitHub, at the commit this page was made from: the board is valvenode-slave/hw/1.0/valvenode.kicad_pcb and its schematic valvenode-master/hw/1.0/valvenode-master.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Valvenode design in my own project?

Its repository states no licence, so its author keeps all rights: ask vinthewrench before reusing the design.