Skip to the content
2 layers63.2 × 39.1 mmWaterValveX4, the printed circuit board in 3D

4-way water valve control with flow meter and I2C / GPIO pin headers

Size
63.2 × 39.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
50
Nets
33
Pads
123
Tracks, vias
213, 10
Pours
2
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
28 Jun 2024
Updated
2 Oct 2025

Overview

WaterValveX4 is an open-source printed circuit board by hansrune, from the hansrune/WaterValveX4 repository on GitHub. It is a 2-layer board of 63.2 × 39.1 mm with 50 parts on 33 nets, routed with 213 tracks and 10 vias.

It is built around the L7805 and IRLML2502. Its parts include 15 resistors, 12 diodes, 9 connectors, 4 transistors and 3 capacitors. It belongs with the audio and music boards and the ESP32 boards of this library.

Main components

2

README

README.md

Valve Controller X4

Work in progress / still a prototype...

A DYI 4x valve controller based on ESP32c3. This device is mainly intended for irrigation control, typically using 12V solenoid valves. You can also use ball valves with automatic return on power off.

This board is tested with ESPhome and ESPEasy firmware (build instructions below), and is easily used with home automation systems that support MQTT auto discovery, the native Home Assistant API, and the many controllers that ESPEasy supports

Introduction

Some of the main features and benefits

  • 4x outputs
    • For controlling up to four valves at a time
    • Each valve should draw less than 1A - or you can add to the PCB trace thickness using wire
  • Flow sensor input
    • A flow sensor input is available
    • Can be open collector / hall sensor. Pulled up to 3.3V level internally. 5V supply on terminal
  • I2C support
    • An I2C pin header with power supply is available to use with I2C sensors
    • ... or you can use the same GPIO pins for any other purpose of your choise
  • WiFi based
    • This is almost a must have for most home automation systems
    • OTA support
    • Configuration backup, restore and bulk updates.
  • Firmware of your choise
    • ESPEasy with Domoticz over http. Device creation uses virtual sensors
    • ESPEasy with Domotics and Home Assistant via MQTT. Device creation uses a MQTT configuration text file.
    • ESPHome to Home Assistant via MQTT and auto discovery
    • ESPHome to Domoticz via MQTT and auto discovery
    • ... and as the hardware supports using both Arduino and ESP-IF development kits, almost any other firmware can be created.
  • Seed Studio XIAO ESP32C3
    • This device is shielded and comes with an external IPX antenna connector
    • FCC and CE regulations approved

Setup and mounting

The main parts includes a simple flow sensor and a pressure reduction device:

The adapter parts are 3D prints

I use a long box with a closing / latched lid. This is designed for outdoor use. Will tolerate rain, but not frost.

Please note the bottom holes. In case water is leaked, it has a way to drain out of the box

Indicators

Each of the four valve outputs has a LED indicator at the back of the PCB

  • LED D11 will indicate low level input from the flow meter
  • LED D1
    • no change indicates out of power, device death/freeze or other
    • a duty cycle 1:1 will indicate a reset is ongoing

Implementation and design

The schematic diagram is available here. The KiCad EDA project is in the same folder

GPIO pin usage

PINCapabiltyFunction
GPIO2Acticve low outputLED D2 - not used
GPIO3Active high outputValve 1
GPIO4Active high outputValve 2
GPIO5Active high outputValve 3
GPIO6I2CSDA
GPIO7I2CSCL
GPIO8Active high outputValve 4
GPIO9Active low outStatus LED
GPIO10Pulled up inputFlow meter input
GPIO20RX / 1-wireSerial or 1-wire sensor
GPIO21TX / 1-wireSerial or 1-wire sensor

Hardware - getting started

This project uses my KiCad-lib-ESP32 repository as a git submodule. To check this out, use the following:

bash
git clone --recurse-submodules https://github.com/hansrune/WaterValveX4.git 

Materials used

This project uses the Seed Studio XIAO ESP32C3 RISC-V module. This tiny device has proven to be more reliable than most ESP8266 modules used in earlier versions. This module also comes with an IPX connector for connecting an external antenna, and is delivered with a simple external antenna for good range. This device is also EMI shielded and certified.

A 4x valve like the below attached with a washing machine attachment hose

A selection of 3D printable (STL and FreeCAD) adapters is available here

Any available 12V DC power supply delivering 2A or more should do for the control board and the valves.

There are many options and possible pinouts for DC-DC converters for the 12V to 5V conversion. A linear regulator (L7805) will need a heatsink, so a DC-DC converter is recommended.

The MOSFETs need a low Vgs trigger voltage, i.e. well under 3V on full load. I have used Si2302/N025P for the N-channel, SOT-23 package.

Resistors are 0805 size. Screw terminals are 3.5mm, which is a tight fit when ferrules are being used.

For more information, use this KiCad BOM

Hardware assembly

Soldering a prototype by hand is possible if you have a steady hand and a small solder iron tip. A microscope is recommended to inspect the solder joints properly.

Recommend to do the SMD parts first, then other components.

Hardware tests

You should test at least the following before adding the ESP32 module:

  • Attach a battery and check that the valve can be operated both NO and NC
  • Add power and check that 5V conversion is OK
  • Apply 5V to GPIO 1, 5, 3 and 8 in turn to check that the output works with the indicators at the PCB back side

Firmwares

ESPHome

ESPHome firmware can be set up from this ESPHome configuration repository using the test_waterx4.yaml file as a template

Follow the README for instructions on what you will likely want to change.

By default, MQTT auto discovery is being used. This should work out of the box with Home Assistant, Domoticz and other that support Home Assistant MQTT Auto Discovery

In Home Assistant, the device has these controls. Valves are labelled a, b, c and d. The -1 is the controller instance

... and flow sensor / total counter:

ESPEasy

ESPEasy can be used with a number of different controllers / home automation systms. A custom firmware build description is available here

ESPEasy requires many settings. For configuration settings and rule files, you can upload the files from this page as a starting point. Please make sure to change name, unit number, controller IP addresses, NTP, syslog host and latitude/longitude. This configuration uses both a MQTT controller and a Domoticz controller. Change to what you need.

Bugs and tweaks

Version 2.0 of the PCB needs the flow sensor input components mounted as shown:

  • A 1N4148 diode replaces R14 - cathode faces terminal connector
  • A 5.1 kohm resistor replaces D7 - for a pull-up
  • R12 is not mounted

Licensing

This project is licensed under the GNU General Public License v3.0 for the software, CERN-OHL-W for the hardware, and CC BY-SA for the documentation and ideas.

Parts

50
QtyValueFootprintReferences
81kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR6, R7, R8, R9, R10, R11, R13, R15
7LEDLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolderD1, D2, D3, D5, D8, D10, D11
410kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR2, R4, R5, R12
41N4007Diode_THT:D_DO-41_SOD81_P3.81mm_Vertical_KathodeUpD4, D6, D9, D12
4IRLML2502Package_TO_SOT_SMD:SOT-23_HandsolderingQ1, Q2, Q3, Q4
4MountingHole_PadMountingHole:MountingHole_3.2mm_M3_ISO14580_PadH5, H6, H7, H8
3330Resistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R3, R16
3Screw_Terminal_01x03TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-3-3.5-H_1x03_P3.50mm_HorizontalJ6, J7, J8
210uFCapacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-A_Pad1.58x1.35mm_HandSolderC1, C3
2Conn_01x04_MaleConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ1, J5
1100nFCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC2
11N4148Diode_SMD:D_MiniMELFD7
1Barrel_JackLOCAL1:BarrelJack1J2
1Conn_01x01_MaleConnector_PinHeader_2.54mm:PinHeader_1x01_P2.54mm_VerticalJ4
1Conn_01x03_MaleConnector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ3
1L7805Package_TO_SOT_THT:TO-220-3_VerticalU3
1Project_DCDC_01LOCAL1:DCDC_01U1
1Screw_Terminal_01x02TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-2-3.5-H_1x02_P3.50mm_HorizontalJ9
1SeedStudio XIAO ESP32 C3 v1LOCAL1:XIAO_ESP32C3_THTU2

Similar boards

  • 2 layers75.5 × 52.5 mmStm32, the printed circuit board in 3D

    Stm32

    eddyem/stm32samples

    Code samples and ready projects based on bare-metal STM32

    89 parts208
  • 4 layers60 × 28 mmRailLink, the printed circuit board in 3D

    RailLink

    Misaka0x2730/RailLink

    Compact isolated version of J-Link v9.

    83 parts134
  • 8 layers120 × 60 mmDFTBoard, the printed circuit board in 3D

    DFTBoard

    juliancoy/zynqPCB

    An 8-layer board in Kicad built upon Xilinx Zynq Chip. Includes sound output, HDMI, DDR3, and Arduino Uno style header for screen connection

    299 parts75MIT
  • 2 layers92.5 × 82.8 mmRifle and sensors, the printed circuit board in 3D

    Rifle and sensors

    DAlexis/caustic-lasertag-system

    Caustic project is a full-featured indoor and outdoor lasertag system

    268 parts16
  • 4 layers122.2 × 115.1 mmScan controller kicad, the printed circuit board in 3D

    Scan controller kicad

    fwachsmuth/Filmkorn-Raw-Scanner

    The Filmkorn Raw Scanner, turning 8mm and 16mm films into lossless 12-bit CinemaDNG

    170 parts13MIT
  • 2 layers68 × 81.5 mmController, the printed circuit board in 3D

    Controller

    orlopau/coffee-scale

    Scale for espresso and filter coffee.

    55 parts11
  • 2 layers42.3 × 24.5 mmMq7adapter, the printed circuit board in 3D

    Mq7adapter

    fablab-paderborn/mq7-adapter-board

    MQ7 Adapter Board

    15 parts9
  • 2 layers158 × 34 mmTaggerMainboard, the printed circuit board in 3D

    TaggerMainboard

    Infinitag/Hardware

    Files for the INFINITAG hardware

    75 parts6

Questions

How big is the WaterValveX4 PCB?

It measures 63.2 × 39.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the WaterValveX4 use?

50 parts, built around the L7805 and IRLML2502. 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 WaterValveX4 KiCad files?

From the hansrune/WaterValveX4 repository on GitHub, at the commit this page was made from: the board is KiCad/WaterValveX4.kicad_pcb and its schematic KiCad/WaterValveX4.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the WaterValveX4 design in my own project?

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