Files
learning-garden/sources/brewery-pid-replacement.md
psb-gemma 8d40f7c165 Phase 2 baseline: full wiki clone with silo audit manifest
Audit summary: 2890(73), PSB(86), Hacker(40), shared(71), agent(10)
Pre-migration snapshot from openclaw-wiki tag: pre-migration
2026-05-14 01:21:23 +00:00

7.4 KiB
Raw Blame History

pageType, id, title, sourceType, sourcePath, ingestedAt, updatedAt, status
pageType id title sourceType sourcePath ingestedAt updatedAt status
source source.brewery-pid-replacement brewery-pid-replacement local-file /home/topher/.openclaw/workspace-crash-bot/projects/brewery-pid-replacement.md 2026-05-02T21:16:19.602Z 2026-05-02T21:16:19.602Z active

brewery-pid-replacement

Source

  • Type: local-file
  • Path: /home/topher/.openclaw/workspace-crash-bot/projects/brewery-pid-replacement.md
  • Bytes: 6887
  • Updated: 2026-05-02T21:16:19.602Z

Content

# Brewery PID Controller Replacement

**Status:** Prototyping — Path Decided
**Created:** 2026-04-16
**Updated:** 2026-04-16 (major revision)
**Tags:** `brewery`, `esp32-s3`, `esphome`, `pid`, `home-assistant`, `pt100`, `max31865`, `nextion`, `custom-pcb`

---

## Summary

Replace 8 existing Chinese commodity PID controllers in a commercial brewery with custom ESP32-S3-based PID controllers with Nextion displays, ESPHome firmware, and Home Assistant integration. All 8 units are interchangeable — heating vs cooling is a software setting.

---

## System Overview

**8 PIDs total:**
| # | Vessel | Type | Control |
|---|--------|------|---------|
| 1 | Fermenter 1 | Cooling | Glycol valve |
| 2 | Fermenter 2 | Cooling | Glycol valve |
| 3 | Fermenter 3 | Cooling | Glycol valve |
| 4 | Fermenter 4 | Cooling | Glycol valve |
| 5 | Glycol Chiller | Monitoring/Control | Chiller |
| 6 | HLT | Heating | 4× SSR → contactors |
| 7 | Mash RIMS | Heating | 1× SSR → contactor |
| 8 | Kettle | Heating | 4× SSR → contactors |

**Existing sensors:** PT100 (3-wire) in all vessels

**Control signals:**
- **Hot side:** ESP32 → G3MB-202P → 120V AC contactor coil → heating element
- **Cold side:** ESP32 → G3MB-202P → 120V AC coil relay → 24V relay → glycol valve
- Both sides use identical output hardware — mode is set in ESPHome YAML

---

## Architecture (2026-04-16 revision)

**Per-PID architecture — one unit per vessel:**
```
[Surenoo NX4880E043] ← UART ← [Custom PCB]
  4.3" 480×800 display     ├── ESP32-S3 Supermini
                           ├── MAX31865 (PT100)
                           └── G3MB-202P (SSR output)
```

**Why per-PID over central:**
- Each vessel is independently controlled
- Hot-swappable — swap a board without affecting others
- No single point of failure
- Simpler wiring (sensors/outputs local to each vessel)
- Interchangeable like-for-like with original PIDs

**Software: ESPHome** (not Arduino)
- Native HA integration — no custom MQTT code
- `climate.pid` component for PID loop
- `max31865` sensor component
- `nextion` display component
- OTA updates

---

## Hardware Decisions (2026-04-16)

### Per-Unit Hardware Add-ons (Protection & Reliability)
| Component | Unit Cost | Notes |
|-----------|-----------|-------|
| 100nF decoupling caps (×3) | ~$0.10 | On VCC pins |
| TVS diodes (SMBJ5.0A) | ~$0.20 | 5V rail clamping |
| 220Ω resistor (SSR gate) | ~$0.05 | G3MB-202P LED input |
| Reverse polarity diode (SMB5819) | ~$0.10 | 5V input protection |
| Hardware watchdog (TPS3823) | ~$0.50 | Reset on ESP32 hang |
| RC filter (49.9K + 100nF) | ~$0.15 | PT100 input filtering |
| **Total add-ons** | **~$1.10** | |

**Hardware Watchdog (TPS3823):**
- 3-pin voltage supervisor chip
- Watches ESP32's heartbeat (toggle a GPIO periodically)
- If ESP32 hangs and stops toggling, watchdog resets it after ~1.6 seconds
- Essential for unattended commercial installations
- Research: search "TPS3823 ESP32 watchdog" for wiring diagram
- Alternative: software watchdog in ESPHome handles most cases, hardware is belt-and-suspenders

### Per-unit total
| Section | Cost |
|---------|------|
| Custom PCB (components) | ~$11-12 |
| Protection add-ons | ~$1.10 |
| Display (NX4880E043) | ~$37 |
| **Per unit total** | **~$49-50** |

**8-unit system total: ~$392-400**

### Output Driver Detail

**G3MB-202P SSR:**
- 2A output, 120-380V AC
- DIP-4 package, PCB-mount
- Logic-level input (3.3V from ESP32 works)
- Random fire (fine for coil loads)
- ~$1.50 in quantity

**Why G3MB-202P over SSR-10DA module:**
- DIP-4 is much smaller than panel-mount SSR modules
- Enough current rating for contactor coils (50-100mA)
- One part to stock for both hot and cold sides

**MOV across output terminals** — spike protection for inductive coil

### ESP32-S3 Supermini (AITRIP)

- 5-pack ~$13 on Amazon
- GP1-GP48 GPIO broken out
- Type-C USB for programming
- 160MHz (underclocked but fine for PID)
- Dual-core ESP32-S3

---

## Display: Surenoo NX4880E043

**Specs:**
| Spec | Value |
|------|-------|
| Size | 4.3" |
| Resolution | 480×800 (tall) |
| Touch | Capacitive (CTP) |
| MCU | 200MHz |
| Flash | 128MB |
| GPIOs | 8 available |
| RTC | Yes (coin cell backup) |
| Interface | Serial UART |
| Bezel | Slim/flush mount |
| Price | ~$35-40 |

**Why NX4880E043 over JC4827W543:**
- Nextion editor — drag-drop UI design
- ESPHome native `nextion` component support
- 128MB flash for fonts and assets
- 8 GPIOs on the display module itself
- RTC built-in

**Why NX4880E043 over official Nextion:**
- ~$35-40 vs $89+ for equivalent Nextion
- Same Nextion instruction set and editor
- Slimmer bezel

---

## Software: ESPHome

### YAML Components Needed

```yaml
# ESPHome config per unit
climate:
  - platform: pid
    name: "${vessel_name} PID"
    sensor: pt100_sensor
    output: ssr_output
    default_target_temperature: 70°F
    heat_output: ssr_output    # or separate heat/cool outputs
    # PID tuning parameters

sensor:
  - platform: max31865
    name: "${vessel_name} Temperature"
    cs_pin: GPIOXX
    # 3-wire PT100 config

output:
  - platform: gpio
    pin: GPIOXX
    id: ssr_output

display:
  - platform: nextion
    # Bind to temperature sensor, setpoint, mode
```

### HA Integration

- Native ESPHome API — zero-config discovery
- HA sees each PID as a `climate` entity
- Setpoint control from HA UI
- Temperature history graphing
- Automation triggers on temp reached

---

## Next Steps

- [ ] Find Nextion in lab (or order NX4880E043)
- [ ] Write starter ESPHome YAML for one unit
- [ ] Prototype: ESP32-S3 + MAX31865 + G3MB-202P wired up
- [ ] Test PID loop and HA integration
- [ ] Design custom PCB in EasyEDA
- [ ] Order PCB prototypes (JLCPCB)
- [ ] Build and test first complete unit
- [ ] Flash all 8 units with vessel-specific YAML
- [ ] Scale to full installation

---

## Decision Log

### 2026-04-16 — Major revision

**Changes from original plan:**
- ✅ **Switched from Arduino to ESPHome** — user prefers ESPHome + easy HA integration
- ✅ **Switched from central architecture to per-PID** — hot-swappable, no single point of failure
- ✅ **Display: NX4880E043 Surenoo Nextion** instead of CrowPanel 7"
- ✅ **Custom PCB** using AITRIP ESP32-S3 Supermini + MAX31865 module + G3MB-202P
- ✅ **Per-unit BOM: ~$48-49** (down from ~$93 central architecture)
- ✅ **8-unit total: ~$390-395** (vs $700+ for official Nextion)
- ✅ **Hot/cold is software switch** — same hardware for all 8 units

### 2026-04-16 — Original architecture (superseded)
- Central ESP32 + 2× CrowPanel 7" = ~$213
- Custom Arduino firmware (not ESPHome)
- Per-vessel architecture also considered

---

## Related Projects

- [[fermentation-dashboard.md]] — separate brewery HA dashboard (TILT hydrometer)
- [[pihole-blocker.md]] — CM4 board could be brewery server

Notes

Referenced By