Skip to content

Hardware Guide

Overview

This guide walks you through building the Pool Controller hardware — from selecting parts to final assembly. Even if you’ve never soldered before, the step-by-step instructions will help you get it right.

Target audience: DIY electronics enthusiasts with basic soldering experience. Total cost: under 100€ (excluding pumps and pool infrastructure).

Safety First ⚠️

  • The controller switches 230V AC mains voltage to the pumps. Improper wiring poses risk of electric shock or fire.
  • Only work on the circuit when disconnected from power.
  • Use a residual-current device (RCD) for the pump circuit.
  • Keep sensor wiring (low voltage) physically separate from mains wiring.
  • If in doubt, consult a qualified electrician for the mains connection.

Required Parts (BOM)

#ComponentQtyApprox. CostNotes
1ESP32 Development Board (e.g. ESP32 DevKit V1, NodeMCU-32S)110–15€Ensure it has at least 4MB flash
2DS18B20 Temperature Sensor (waterproof, stainless steel probe, 1m cable)28–12€One for pool water, one for solar collector
32-Channel 5V Relay Module (with optocoupler isolation)15–8€Must be active-high (see notes below)
4Resistor 4.7kΩ (¼W or ⅛W, metal film or carbon film)2< 1€Pull-up for the OneWire data lines
5Breadboard + jumper wires (for prototyping) OR Perfboard + pin headers/screw terminals (for permanent build)13–8€
6USB power supply 5V/≥1A (e.g. phone charger)15–10€For the ESP32 alone
7Hookup wire, 0.14–0.5mm² (AWG 26–20), various colors3–5€
8Optional: enclosure (ABS/PVC project box, IP54 or better)15–10€Protect from splashes/dust
9Optional: screw terminals (2-pin, 5mm pitch)4–62–3€For removable sensor/power connections
10Optional: DS3231 RTC module13–5€Backup timekeeping (not required for normal NTP operation)
Total~45–75€Without enclosure; well under 100€

Where to Buy

All parts are widely available on Amazon, AliExpress, eBay, or at electronics distributors like Reichelt, Pollin, Conrad (DE/AT/CH).

  • ESP32: Search for “ESP32 DevKit V1” or “ESP32 NodeMCU-32S”. Avoid ESP32-S2/S3/C3 variants unless you adapt the firmware — the project targets standard ESP32 (Xtensa dual-core).
  • DS18B20: Look for stainless steel, waterproof probes with 1m cable. Cheaper plastic-encapsulated sensors work too but are less durable outdoors.
  • Relay Module: Read the module specification carefully. The firmware uses active-high logic (GPIO HIGH → relay ON). Many cheap modules are active-low with a jumper to switch. Check the documentation or use a jumper wire to verify before wiring permanently.
  • Resistors: Any 4.7kΩ ±5% resistor works. Buy a 100-pack for < 3€.

Pin Assignment (Firmware Defaults)

The firmware uses these GPIO pins (defined in src/Config.hpp):

ConstantGPIOPurpose
PIN_DS_SOLARGPIO15DS18B20 data — Solar collector temperature
PIN_DS_POOLGPIO16DS18B20 data — Pool water temperature
PIN_RELAY_POOLGPIO18Relay control — Pool circulation pump
PIN_RELAY_SOLARGPIO19Relay control — Solar heating pump

Note on GPIO15: This pin is a Strapping pin on the ESP32 — it affects the boot process if pulled HIGH or LOW at startup. The firmware works reliably with it here, but if you experience boot issues, consider moving the DS18B20 sensors to GPIO32/33 and updating src/Config.hpp accordingly (see the Wiring Optimization section).


Wiring Diagram

                         +-------------------------+
                         |         ESP32           |
                         |                         |
  DS18B20 SOLAR DATA --->| GPIO15   (PIN_DS_SOLAR) |
  DS18B20 POOL  DATA --->| GPIO16   (PIN_DS_POOL)  |
  Relay IN1 (Pool)  ---->| GPIO18   (PIN_RELAY_POOL)|
  Relay IN2 (Solar) ---->| GPIO19   (PIN_RELAY_SOLAR)|
                         |                         |
  3.3V ------------------>| 3V3                     |
  GND ------------------->| GND                     |
                         +-----------+-------------+
                                     |
                                     | common GND
                                     v
         +--------+--------+--------+--------+
         |        |        |        |        |
    +----+--+  +--+----+  |   +----+--+  +--+----+
    |Solar  |  | Pool  |  |   | RLY1  |  | RLY2  |
    |DS18B20|  |DS18B20|  |   |(Pool) |  |(Solar)|
    |       |  |       |  |   |       |  |       |
    | VDD --+--+ VDD --+--+---> 3.3V  |  |       |
    | GND --+--+ GND --+-------> GND  |  |       |
    |DATA --->| GPIO15|  |   |       |  |       |
    |       |  |DATA -->|  |   | VCC  |  | VCC  |
    +-------+  +-------+  |   | -- 5V |  | -- 5V|
                           |   | GND  |  | GND  |
                           |   |      |  |      |
                    4.7kΩ  |   | IN1  |  | IN2  |
                     |     |   | <-18 |  | <-19 |
                     v     |   +------+  +------+
                3.3V ----+-+--- 3.3V

Wire Connections (Step by Step)

1. Temperature Sensors (DS18B20)

The DS18B20 has three wires (on waterproof probes: typically red = VDD, yellow/white = DATA, black = GND — but verify with your sensor’s datasheet):

DS18B20 WireConnect to
Red (VDD)ESP32 3.3V
Black (GND)ESP32 GND
Yellow/White (DATA)GPIO15 (solar) or GPIO16 (pool)

Critical — add the pull-up resistor:

Connect a 4.7kΩ resistor between the DATA wire and the 3.3V line. One resistor per sensor, as close to the sensor wire connection as possible.

    ESP32 3.3V ──┬── 4.7kΩ ──── DS18B20 DATA
                  │
                DS18B20 VDD

Without this resistor, the sensor will not be detected — this is the #1 cause of “no sensor found” errors.

2. Relay Module

Relay ModuleConnect to
VCC (or VDD)5V (from the ESP32 board’s VIN/5V pin, or external 5V supply)
GNDGND (common with ESP32)
IN1GPIO18 (pool pump)
IN2GPIO19 (solar pump)

Relay Logic: The firmware sets the GPIO pin HIGH (3.3V) to activate the relay. If your module switches with LOW (active-low), flip the jumper or adapt the firmware (see src/RelayModuleNode.cpp).

Load wiring (230V side):

    L ──┤ RCD ├──┤ MCB ├──┬──┤ Relay-COM1 ├── Pool Pump ── N
                           └──┤ Relay-COM2 ├── Solar Pump ── N
  • Connect the pump’s live wire to the relay’s COM (common) terminal.
  • Connect the relay’s NO (normally open) terminal to the pump.
  • The other pump wire goes to neutral (N).
  • Always wire the 230V circuit through an RCD and appropriately rated MCB.

3. Power Supply

ComponentSupplySource
ESP32 board5V USB (regulated)Phone charger, USB port, or dedicated 5V PSU
Relay module (coils)5VFrom ESP32 VIN pin OR external 5V supply
DS18B20 sensors3.3VFrom ESP32 3.3V output pin
(Optional) RTC DS32313.3VFrom ESP32 3.3V output pin

Important: The ESP32’s on-board 3.3V regulator can supply ~600mA. The DS18B20 sensors draw < 5mA total — well within limits. If you add many additional 3.3V components, consider an external 3.3V regulator.


Step-by-Step Assembly

Prototyping on a Breadboard

  1. Place the ESP32 on the breadboard straddling the center gap
  2. Connect power rails: 3.3V and GND rails on both sides
  3. Insert the 4.7kΩ resistors: Between the DATA row and 3.3V rail
  4. Connect DS18B20 sensors: Use jumper wires for VDD (3.3V), GND, and DATA
  5. Connect the relay module: Jumper wires for VCC (5V), GND, IN1, IN2
  6. Power via USB: The ESP32’s VIN/USB pin provides 5V for the relay module
  7. Double-check all connections before applying power
  8. Verify: See First Power-On below

Pool Controller breadboard prototype with ESP32, two DS18B20 temperature sensors, 4.7kΩ pull-up resistors, and 2-channel relay module

💡 Tip: Use different colored jumper wires for clarity — e.g., red for power (3.3V/5V), black for GND, yellow for sensor data, blue for relay control.

Permanent Assembly on Perfboard

Once you’ve verified the circuit on a breadboard, build the permanent version:

  1. Plan the layout: Arrange components on the perfboard before soldering. Keep the 230V relay terminals at one edge, sensors at the opposite edge.
  2. Solder in this order:
    • Pin headers / screw terminals for the ESP32 (socket it, don’t solder directly)
    • Resistors (4.7kΩ)
    • Pin headers for the relay module (socket it too)
    • Screw terminals for sensor connections
  3. Wire routing: Use solid core wire for connections. Keep data lines short.
  4. Inspect for solder bridges: Check each joint with a magnifier or multimeter (continuity test).
  5. Mount in enclosure: Use standoffs or double-sided foam tape. Drill holes for sensor and relay cable entries. Use cable glands (PG7/PG9) for a water-resistant seal.

Manufacturing Tips

Soldering

  • Use leaded solder (Sn60Pb40 or Sn63Pb37) for easiest handling — it flows better than lead-free, especially for beginners.
  • Flux: Use rosin-core solder; add liquid flux for stubborn joints.
  • Temperature: Set iron to 320–350°C for leaded, 370–400°C for lead-free.
  • Iron tip: Clean with a wet sponge or brass wool before every joint.
  • Good joint: Shiny, concave fillet that flows around the component lead. A dull, cracked, or ball-shaped joint is bad — reheat and add fresh solder.

Enclosure

  • Choose an ABS or PVC project box with at least IP54 rating for outdoor installation (splash protection).
  • Drill ventilation holes if the relay module gets warm, but angle them downwards to reduce water ingress.
  • Mount the ESP32 on M2.5 or M3 nylon standoffs to avoid short circuits.
  • Label external connectors (pool sensor, solar sensor, pump 1, pump 2, USB power).
  • Use cable glands (PG7 for thin sensor cables, PG9 for thicker power cables) where wires enter the enclosure.

Cable Management

  • Label both ends of each wire with heat-shrink wrap or small adhesive labels — future-you will thank past-you.
  • Keep sensor and relay wires separate inside the enclosure to minimize electrical noise coupling.
  • Strain relief: Tie internal wires to mounting posts or use cable ties so that pulling on external cables doesn’t stress solder joints.
  • Service loop: Leave enough slack inside the enclosure so you can open it and work without disconnecting everything.

Outdoor Sensor Installation

  • DS18B20 probes are waterproof but the cable entry at the sensor end is not always fully sealed. Apply heat-shrink tubing over the cable joint or use self-amalgamating silicone tape for outdoor installations.
  • Route sensor cables in conduit (PVC or flexible) where they are exposed to mechanical stress (lawn, pavement).
  • Max cable length: DS18B20 works reliably up to ~30m with a 4.7kΩ pull-up and twisted-pair cable. For longer runs, reduce the pull-up to 2.2kΩ or use a dedicated OneWire driver.
  • Position the pool sensor in the pump circuit (after the filter, before the pump return) for accurate average pool temperature.
  • Position the solar sensor at the hottest point of the solar collector (usually the top outlet pipe).

Power Supply Options

OptionProsCons
USB phone charger (5V/1A+)Cheap, readily available, safeLimited current for additional peripherals
DIN-rail PSU (Mean Well HDR-15-5 or similar)Professional, reliable, fits in electrical cabinetSlightly more expensive (~15€)
ESP32 VIN from USB + relay from same 5VSimple wiringTotal current must stay under ESP32 board’s limit

Recommendation: If you’re installing in a permanent location near your pump control panel, use a DIN-rail 5V PSU (e.g., Mean Well HDR-15-5). It’s clean, reliable, and can power both the ESP32 and the relay module without issue.


First Power-On and Testing

1. Visual Inspection

Before connecting power:

  • Check for solder bridges between adjacent pins
  • Verify polarity of all components (DS18B20 VDD/GND, relay VCC/GND)
  • Ensure no stray wire strands are shorting neighboring pins
  • Measure resistance between 3.3V and GND — should be > 10kΩ (not shorted)

2. Power On

  1. Connect USB power (or 5V PSU)
  2. The ESP32’s built-in LED should flash quickly (boot sequence)
  3. After ~3 seconds, the LED blinks slowly — waiting for WiFi

3. Verify Sensors

Open the serial monitor (9600 baud):

Pool Controller v3.3.0
Starting up...
Initialized pins: GPIO15, GPIO16, GPIO18, GPIO19
Solar Temp: GPIO15
Pool Temp:  GPIO16
Pool Relay: GPIO18
Solar Relay: GPIO19

If sensors are connected and working:

Solar temperature: 25.3°C
Pool temperature:  22.1°C

If you see Sensor error or -127°C, check:

  • 4.7kΩ pull-up resistor present on each DATA line?
  • DS18B20 VDD connected to 3.3V (not 5V)?
  • DS18B20 GND connected to common ground?
  • DATA pin matches the firmware configuration?

4. Test Relays

From the Web UI (Configuration tab) or via serial command:

Mode: manual
Pool pump: ON  → relay should click, pump starts
Solar pump: ON → relay should click, pump starts

If relay doesn’t click:

  • Is the relay module powered (5V between VCC and GND)?
  • Is the logic level correct (active-high vs active-low)?
  • Does the LED on the relay module light up when GPIO goes HIGH?

Troubleshooting

SymptomLikely CauseFix
“Sensor error” or -127°CMissing pull-up resistorAdd 4.7kΩ between DATA and 3.3V
“Sensor error”Wrong GPIO pinCheck PIN_DS_SOLAR/PIN_DS_POOL in src/Config.hpp
Intermittent sensor readingsLoose connection or noiseCheck solder joints, separate data from relay wires
Relay doesn’t activateWrong logic levelCheck active-high vs active-low; add jumper or change firmware
Relay clicks but pump doesn’t run230V wiring issueCheck COM/NO terminals, verify pump connection
ESP32 won’t boot (brownout)Insufficient powerUse 5V/≥1A power supply; add 100µF capacitor near VIN
ESP32 resets when relay switchesVoltage spike on relay coilAdd flyback diode across relay coil, or use module with built-in protection
Sensor readings jump when relay switchesElectrical noiseRoute sensor wires away from relay/power wires

Optional: Wiring Optimization

The default pins (GPIO15/16/18/19) work reliably for most users. If you experience boot instability or want the most robust configuration, use these optimized pins instead:

FunctionDefault PinOptimized PinReason
DS18B20 SolarGPIO15GPIO32GPIO15 is a Strapping pin — removing OneWire from it eliminates any boot risk
DS18B20 PoolGPIO16GPIO33Clean separation from remaining Strapping pin GPIO0
Relay PoolGPIO18GPIO25ADC2 pads (GPIO18/19) are avoided; GPIO25 is a clean digital output
Relay SolarGPIO19GPIO26Same as above

To use optimized pins, edit src/Config.hpp:

constexpr uint8_t PIN_DS_SOLAR{32};     // was 15
constexpr uint8_t PIN_DS_POOL{33};      // was 16
constexpr uint8_t PIN_RELAY_POOL{25};   // was 18
constexpr uint8_t PIN_RELAY_SOLAR{26};  // was 19

This pinout is already analyzed and recommended in the ESP32 Schematic Optimization document (German).


References

Last updated on