Skip to the content
PCBKitNew board
2 layers72.6 × 74.9 mmEsp8266 sprinkler controller, the printed circuit board in 3D

Esp8266 sprinkler controller

bmpc/esp8266_sprinkler_controller2

Lawn irrigation control system with a ESP8266 and a solenoid for each sprinkler station

Size
72.6 × 74.9 mm
Copper layers
2
Thickness
1.6 mm
Parts
39
Nets
45
Pads
140
Tracks, vias
478, 1
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
30 Jul 2022
Updated
2 Aug 2025

Overview

Esp8266 sprinkler controller is an open-source printed circuit board by bmpc, from the bmpc/esp8266_sprinkler_controller repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 72.6 × 74.9 mm with 39 parts on 45 nets, routed with 478 tracks and 1 via.

It is built around the ESP-12F, L293D and 74HC595, with the SS8050CBU among its other parts. Its parts include 11 capacitors, 9 resistors, 6 ICs, 5 connectors and 2 diodes. It belongs with the home automation and IoT boards and the ESP8266 boards of this library.

Main components

4

README

README.md

ESP8266 sprinkler controller

A WiFi lawn irrigation controller using an ESP-12F WiFi module to drive up to 4 sprinkler stations.

The sprinkler stations can be controlled and programmed remotely using Home Assistant.

The ESP8266 board communicates with Home Assistant using an MQTT broker on the local WiFi network. The ESP8266 listens to events in order to turn on/off and to program the schedule for each sprinkler station.

The controller is powered by a 9V battery as this is also the voltage required to activate the solenoids for each sprinkler. Being a battery powered device, the efficiency of the circuit is very important. The ESP8266 needs to be in deep sleep as much as possible and only wake up for activating/deactivating sprinkler stations.

There is also an interface mode that can be activated explicitly using Home Assistant. In interface mode, the ESP8266 will not go into deep sleep and is always ready to receive commands to activate/deactivate stations and configure the system. This mode is useful if we need to test a specific sprinkler station or if we need to trigger the stations manually.

The controller is also equipped with a reset button which will force the system to wake up from deep sleep, and go into interface mode (if enabled).

Controller circuit

MQTT Topics

Subscribe

TopicPayload formatPayload exampleRetained
lawn-irrigation/station{x}/set{"on","off"}|{"duration in milliseconds"}"on|18000" ; "off"false
lawn-irrigation/station{x}/config{"cron expression"}|{"duration in milliseconds"}"0 30 6 1-31/2 * *|900"true
lawn-irrigation/interface-mode/set{"on","off"}"on" ; "off"true
lawn-irrigation/enabled/set{"on","off"}"on" ; "off"true

Publish

TopicPayload formatPayload exampleRetained
lawn-irrigation/station{x}/state{"on","off"}"on" ; "off"false
lawn-irrigation/interface-mode/state{"on","off"}"on" ; "off"false
lawn-irrigation/log<string>"log string"true

How to configure Home Assistant

The esp8266 sprinkler controller is configured from Home Assistant using MQTT switches and input fields.

As an example, here is my lawn irrigation card within the Home Assistant dashboard. I have three sprinkler stations configured:

Home Assistant control card

Each station is controlled by a different MQTT switch. The switches automatically display the station state and are also used to trigger the stations manually (provided that the controller is in interface mode).

Besides the station controller switches and CRON inputs, there are two additional switches to toggle:

  • the interface mode
  • the irrigation itself. When the irrigation controller is in interface mode, the ESP8266 will not go into deep sleep and the user can toggle the stations directly.

The irrigation toggle switch can be used to skip the programmed schedule. As an example, it is possible to disable the irrigation if rain is forecast for the next 12 hours or is has rained in the last 12h.

Apart from the switches, Input Text Fields are used to configure the CRON expression and duration for each station. An automation is also required so that an MQTT event is published whenever the text field changes.

If a station is activated due to the configured cron expression schedule, the respective switch will be updated automatically with the current status as an MQTT event is sent from the controller whenever there is a station event.

You can find an example on how to configure these MQTT switches and text fields on the HA examples included in this repository:

Circuit

Power

Because the solenoids that activate the sprinklers require 9V to activate, this circuit is powered by a 9V battery (two 9V batteries in parallel to be precise). A voltage regulator is used to step down from 9v to 5v so that we can power some 5v ICs in the circuit. The ESP-12F requires 3.3V. Therefore, another voltage regulator was added to step down from 5v to 3.3v. This is not ideal, as there are two voltage regulators but in this case we require 3 different voltages and it would not be practical to have multiple batteries for the same circuit.

Latching solenoids and the L293D ICs

There are two L293D ICs in this circuit. These are Quadruple Half-H Drivers that are designed to provide bidirectional drive currents. The L293D is also designed to drive inductive loads such as solenoids and motors. These ICs allow us to drive the 9v power lines to the solenoid with a 3.3v logic signal provided by the ESP8266.

A latching solenoid uses an electrical current pulse or internal permanent magnet material to maintain a set position without the constant application of power. Latching solenoids (also known as bistable solenoids) have two standard positions; de-energized with the plunger fully extended and de-energized with the plunger held in position by permanent magnets.

Electrical polarity is vital to proper latching a solenoid. As current flows in one direction, adds to the pull of the permanent magnet. Sending a current through the coil field in the opposite direction cancels the magnet’s attraction and releases the plunger from the latched position.

These L293D ICs are required in order to control our latching solenoids because we need to provide opposite polarities depending on if we are activating or deactivating the solenoid.

Each L293D can control two solenoids. Hence two L293D ICs were used to drive a total of 4 solenoids/sprinkler stations.

The lack of pins and the 8-bit shift register

Because the ESP12-F only provides 11 GPIO digital pins, an 8-bit shift register was included so we can have more digital lines to drive the four possible solenoids/stations.

Power Efficiency

This is a very important topic as this circuit is powered with standard 9v batteries. Depending on the battery type, usually a 9v battery has a capacity of around 300 mAh. We must guarantee that our circuit is as efficient as possible. Ideally, the standby current of the circuit should not exceed 50uA. In these conditions, I estimate around 300 to 400 days on double 9v batteries.

Operating normally, without any changes to improve the efficiency of the circuit, the average current is about 90mA to 130mA. This includes the ESP8266 making WiFi requests, the two L293D ICs, the 8-bit shift register, and added the voltage regulators.

If we put the ESP8266 in deep sleep mode, the current drops to about 50mA to 60mA. This is still too high. The culprits are the two L293D ICs which have a very high quiescent current of about 30mA each.

Hence, to reduce the quiescent current of the L293D ICs, the power is supplied to these ICs only when stations need to be activated/deactivated. To achieve this, a simple NPN transistor is used to turn off the shift register and both L293D ICs. This transistor is driven by the ESP8266.

Even though the L293D ICs are not connected to power in standby mode, some pins can have enough voltage to pull the ESP-12F GPIO15 line HIGH thus preventing the ESP-12F from booting. The solution was to add a diode between the GPIO15 enable line and the L293D chip.

After these improvements, I measured the standby current of the circuit to around 20uA.

RTC accuracy on the ESP8266

The max deep sleep time of the ESP-12F is about 3 to 4 hours. Therefore, the ESP needs to wake up every 3 hours or so and get right back to sleep if no action is required (no station needs to be started or stopped).

Also, it turns out that the ESP8266 doesn't have a very precise RTC (Real Time Clock). On a 3 hour period, my ESP8266 RTC would drift ahead around 14 minutes. Without a more precise clock, and considering our use case, we can just go back to sleep for the remaining time.

Schematic

Circuit Schematic

BOM

PartQty
ESP-12F (ESP8266)x1
L293D (Quadruple Half-H Drivers)x2
74HC595 (8-bit shift register)x1
MCP1702-5002E/TO (voltage regulator)x1
MCP1702-3302E/TO (voltage regulator)x1
SS8050CBU (NPN transistor)x1
100Ω resistorx1
1k resistorx4
10k resistorx4
100 uF electrolytic capacitorx2
10 uF electrolytic capacitorx1
1 uF ceramic capacitor (104)x8
SD101A (Schottky Diode)x1
Switch (reset)x1
Barrel Jack Switchx1
Screw terminalx4
9v batteryx2
Rainbird solenoidsx3

ESP8266 Project

The ESP8266 project was built using Platform IO.

The platformio.ini file contains the default parameters to run the targets below. You can change this file or provide the parameters in the context of each pio run <target> command (usage).

Build

In order to compile and build the project you just need to run the following command.

pio run build

Upload

You can upload the sketch using serial port or OTA (Over The Air).

The sketch is ready to receive (OTA) updates. In order to upload OTA, you need to set the upload_port parameter with the IP address or your ESP8266. For serial upload, just se the upload_port parameter with the appropriate serial interface.

pio run upload

Parts

39
QtyValueFootprintReferences
8C_SmallCapacitor_THT:C_Disc_D3.0mm_W1.6mm_P2.50mmC1, C2, C4, C5, C6, C7, C8, C9
410KΩResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR1, R2, R3, R4
41KΩResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR5, R7, R8, R9
4MountingHole_3mmMountingHole:MountingHole_3mmHole1, Hole2, Hole3, Hole4
2C_Polarized_SmallCapacitor_THT:CP_Radial_D4.0mm_P2.00mmC10, C11
2D_SchottkyDiode_THT:D_A-405_P7.62mm_HorizontalD1, D2
2L293DPackage_DIP:DIP-16_W7.62mm_SocketU5, U6
1100ΩResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_HorizontalR6
174HC595Package_DIP:DIP-16_W7.62mm_SocketU4
1Barrel_Jack_SwitchConnector_BarrelJack:BarrelJack_HorizontalJ1
1C_PolarizedCapacitor_THT:CP_Radial_D4.0mm_P2.00mmC3
1ESP-12FRF_Module:ESP-12EU2
1MCP1700-3002E_TO92Package_TO_SOT_THT:TO-92U3
1MCP1700-5002E_TO92Package_TO_SOT_THT:TO-92U1
1SS8050CBUPackage_TO_SOT_THT:TO-92Q1
1SW_PushConnector_PinSocket_2.54mm:PinSocket_1x02_P2.54mm_VerticalSW1
1Screw_Terminal_01x02 ST1TerminalBlock:TerminalBlock_bornier-2_P5.08mmJ2
1Screw_Terminal_01x02 ST2TerminalBlock:TerminalBlock_bornier-2_P5.08mmJ3
1Screw_Terminal_01x02 ST3TerminalBlock:TerminalBlock_bornier-2_P5.08mmJ4
1Screw_Terminal_01x02 ST4TerminalBlock:TerminalBlock_bornier-2_P5.08mmJ5

Questions

How big is the Esp8266 sprinkler controller PCB?

It measures 72.6 × 74.9 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Esp8266 sprinkler controller use?

39 parts, built around the ESP-12F, L293D, 74HC595 and SS8050CBU. 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 Esp8266 sprinkler controller KiCad files?

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

Can I use the Esp8266 sprinkler controller design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

Similar boards

  • 2 layers70 × 50 mmRobotika, the printed circuit board in 3D

    Robotika

    MewnianSquire/Robotika

    UAS Pemrograman Robotika

    29 partsMIT
  • 2 layers144.1 × 108.1 mmK9AY switch, the printed circuit board in 3D

    K9AY switch

    ra0sms/K9AY_with_wifi

    Receive antenna K9AY with WI-FI control interface

    144 parts2MIT
  • 2 layers100 × 100 mm8Dimmers, the printed circuit board in 3D

    8Dimmers

    LudovicLemarinel/EspHomeAutomation

    Home Automation based on ESP8266 and MQTT

    74 parts3
  • 2 layers100 × 100 mmFlipdot H Bridge, the printed circuit board in 3D

    Flipdot H Bridge

    comakingspace/FlipDotDisplay

    They were bought at the Makerfaire Hannover 2016.

    76 parts3
  • 2 layers72.2 × 53.6 mmLow cost robotics, the printed circuit board in 3D

    Low cost robotics

    gabs911/low_cost_robotics

    Low cost robotics platform for STEM programs.

    19 parts2MIT
  • 2 layers75.7 × 59.4 mmBbot pcb, the printed circuit board in 3D

    Bbot pcb

    SharpCoder/bbot

    balancing robot

    16 parts1MIT
  • 2 layers67 × 63 mmMotor driver, the printed circuit board in 3D

    Motor driver

    timohueser/Prosthetic_Hand

    3D printable prototype of a 6 DOF prosthetic hand.

    63 parts1GPL-3.0