ESP32-S3 Ethernet Relay Board — SignalK, MQTT & Victron Venus OS Integration
Firmware for Waveshare ESP32-S3 8DI/8RO board with W5500 Ethernet. Integrates SignalK, MQTT, and Victron Venus OS for marine/industrial relay control.
Summary
ESP32-S3 기반 릴레이 제어 시스템에서 안정적인 유선 네트워크를 구현하기 위해 WIZnet W5500을 사용하는 프로젝트입니다. W5500은 하드웨어 TCP/IP 오프로딩을 통해 Wi-Fi 없이도 안정적인 MQTT, SignalK, Victron 통신을 가능하게 하며, 산업 및 해양 환경에서 신뢰성 있는 제어 시스템을 제공합니다.
AI(Claude)로 생성된 이미지
What the Project Does
이 프로젝트는 Waveshare ESP32-S3-ETH-8DI-8RO 보드를 기반으로 한 산업용 I/O 제어 펌웨어입니다. 주요 기능은 다음과 같습니다:
- 8개의 릴레이 출력(ON/OFF)을 MQTT 또는 SignalK로 제어
- 8개의 디지털 입력 상태를 읽어 네트워크로 전송
- W5500 Ethernet을 통해 유선 네트워크 연결 (Wi-Fi 미사용)
- SignalK 서버와 WebSocket으로 통신 (해양 데이터 시스템)
- MQTT 브로커와 양방향 메시지 교환
- Victron Venus OS와 연동하여 에너지 시스템 데이터 통합
데이터 흐름은 다음과 같이 구성됩니다:
부팅 → DHCP IP 획득 → MQTT / SignalK / Victron 연결 → 입력 상태 읽기 → 릴레이 제어 → 상태 전송AI(Claude)로 생성된 이미지
Where WIZnet Fits
이 프로젝트에서 WIZnet W5500은 네트워크 전송 계층을 담당합니다.
- ESP32-S3와 SPI 기반으로 연결된 외부 Ethernet 컨트롤러
- TCP/IP 스택을 하드웨어에서 처리 (CPU 오프로드)
- 최대 8개의 소켓을 통해 MQTT, WebSocket, 내부 서비스 동시 처리
특히 이 구조는 다음과 같은 환경에서 유리합니다:
- 금속 구조물 내부 (선박, 산업 설비)에서 Wi-Fi 불안정
- 릴레이 제어와 같은 지연 민감 작업에서 안정성 요구
- ESP32가 네트워크 처리 대신 애플리케이션 로직에 집중 가능
결과적으로 W5500은 단순한 네트워크 인터페이스가 아니라, 안정적인 제어 시스템을 위한 필수 인프라 역할을 수행합니다.
Implementation Notes
이 프로젝트는 W5500을 ESP32 Arduino Core의 ETH.h를 통해 사용합니다.
네트워크 초기화 및 연결 흐름 (구조 기반 설명)
- 부팅 시 W5500이 DHCP로 IP 획득
- 이후 MQTT, SignalK(WebSocket), Victron에 동시 연결
- 루프에서 입력 상태를 읽고 메시지 발행
이 구조는 다음과 같은 이유로 중요합니다:
- W5500이 TCP/IP 처리를 담당 → ESP32의 FreeRTOS 작업 분리 용이
- 여러 네트워크 프로토콜을 동시에 유지하면서도 안정성 확보
- Wi-Fi 연결 상태에 영향을 받지 않는 결정론적 동작
※ 실제 코드는 Arduino ETH abstraction을 사용하므로 직접적인 W5500 레지스터 제어는 나타나지 않습니다.
(내부적으로 W5500 드라이버가 처리)
AI(Claude)로 생성된 이미지
Practical Tips / Pitfalls
- SPI 배선 품질이 중요 (특히 SCK 신호 노이즈 주의)
- DHCP 실패 대비 정적 IP 설정 옵션 고려
- MQTT keepalive 설정을 짧게 유지하여 연결 상태 감지
- W5500 소켓 수(8개)를 초과하지 않도록 서비스 구성
- 릴레이 제어 시 watchdog 타이머 적용 권장
- 산업 환경에서는 Ethernet 케이블 차폐(STP) 사용 권장
FAQ
Q: 왜 W5500을 사용하나요?
A: 하드웨어 TCP/IP 스택을 통해 ESP32의 CPU 부하를 줄이고, Wi-Fi 간섭 없이 안정적인 유선 통신을 제공합니다. 특히 릴레이 제어와 같은 실시간 작업에 적합합니다.
Q: ESP32-S3에 어떻게 연결되나요?
A: SPI 인터페이스로 연결되며, ESP32 Arduino Core의 ETH.h 라이브러리를 통해 초기화 및 제어됩니다.
Q: 이 프로젝트에서 W5500은 어떤 역할을 하나요?
A: MQTT, SignalK(WebSocket), Victron 통신을 동시에 처리하는 네트워크 전송 계층 역할을 수행합니다.
Q: 초보자도 구현 가능한가요?
A: ESP32 개발 경험과 기본적인 MQTT 개념이 있다면 구현 가능하지만, 산업용 네트워크 구성에 대한 이해가 있으면 더 안정적으로 적용할 수 있습니다.
Q: Wi-Fi 대신 Ethernet을 사용하는 이유는?
A: Wi-Fi는 간섭과 신호 감쇠로 인해 지연이 불안정하지만, Ethernet은 일정한 지연과 높은 신뢰성을 제공하여 산업 및 해양 환경에 적합합니다.
Overview
This project provides open-source firmware for the Waveshare ESP32-S3-ETH-8DI-8RO relay board — a compact industrial I/O module featuring an ESP32-S3 microcontroller, WIZnet W5500 Ethernet, 8 relay outputs and 8 digital inputs. The firmware integrates seamlessly with SignalK, MQTT, and Victron Venus OS, making it ideal for marine automation and industrial control systems.
Hardware architecture
The board combines the powerful ESP32-S3 with a dedicated W5500 Ethernet controller and a TCA9554 I2C IO expander to manage 8 relay outputs and 8 digital inputs independently.
Image generated by AI(Cladue)
What This Project Does
- Controls 8 relay outputs (ON/OFF) via MQTT commands or SignalK actions
- Monitors 8 digital inputs (DI) via TCA9554 I2C IO expander and publishes status
- Connects to local network via WIZnet W5500 Ethernet (no Wi-Fi dependency)
- Integrates with SignalK marine data server over WebSocket
- Publishes and subscribes to MQTT broker (PubSubClient, port 1883)
- Supports Victron Venus OS MQTT integration for energy system dashboards
- Uses FastLED for optional onboard status LED indication
- Stores settings persistently using ESP32 Preferences (NVS)
Integration architecture
The firmware connects simultaneously to SignalK, MQTT, and Victron Venus OS over wired Ethernet, enabling reliable bidirectional control and monitoring.
Image generated by AI(Cladue)
Hardware Used
- Board: Waveshare ESP32-S3-ETH-8DI-8RO
- MCU: ESP32-S3-WROOM-1U-N16R8 (16MB Flash, 8MB Octal PSRAM)
- Ethernet: WIZnet W5500 (built into board, via ETH.h)
- IO Expander: TCA9554 (I2C) — controls 8 relays + reads 8 DI
- LED: FastLED-compatible onboard indicator
Software & Libraries
- Platform: pioarduino (Arduino core 3.x on PlatformIO)
- ETH.h, WiFi.h, WebServer.h, Preferences.h — bundled with Arduino core 3.x
- fastled/FastLED — status LED control
- robtillaart/TCA9554 — I2C IO expander driver
- knolleary/PubSubClient — MQTT client
- bblanchon/ArduinoJson — JSON parsing for SignalK/MQTT payloads
- links2004/WebSockets — WebSocket client for SignalK
- Build flag: -DWEBSOCKETS_NETWORK_TYPE=NETWORK_ESP32 (plain ws:// without SSL)
Communication flow
After boot, the W5500 obtains an IP via DHCP, then the firmware simultaneously connects to all configured brokers and enters a continuous polling loop for relay control and DI monitoring.
Image generated by AI(Cladue)
How to Build & Flash
- Clone:
git clone https://github.com/SFH008/esp32-s3-eth-relay-board - Open in PlatformIO (VS Code extension recommended)
- Configure your broker IPs and credentials in the source
- Connect the board via USB-C (USB CDC enabled)
- Flash:
pio run --target uploadat 921600 baud - Open Serial Monitor at 115200 baud to watch DHCP, MQTT, and SignalK connection status
FAQ
Q1. Why use W5500 Ethernet instead of Wi-Fi for relay control?
Relay boards in marine or industrial environments are often located in engine rooms or metal enclosures where Wi-Fi is unreliable. The WIZnet W5500 hardware TCP/IP stack provides a stable, interference-free wired connection — critical for safety-related relay switching.
Q2. What is SignalK and why integrate it?
SignalK is an open-source marine data standard that aggregates sensor data (GPS, engine, electrical) on a vessel. Integrating this relay board allows automation actions — e.g., turn on bilge pump relay when a water sensor triggers — directly from the SignalK ecosystem.
Q3. How does Victron Venus OS integration work?
Victron Venus OS exposes an MQTT broker on the local network. This firmware subscribes to com.victronenergy.relay topics and can mirror Victron relay states, or publish DI readings back into the Victron dashboard as auxiliary inputs.
Q4. Can I use only MQTT without SignalK or Victron?
Yes. The three integrations are independent. You can enable just MQTT and send commands from Home Assistant, Node-RED, or any MQTT client using the relay/cmd topic pattern.
Q5. What is the TCA9554 and why is it needed?
The TCA9554 is an I2C IO expander that adds 8 additional GPIO pins to the ESP32-S3. On this board it controls the 8 relay coils and reads the 8 digital input states, freeing up the ESP32's native GPIOs for Ethernet and communication tasks.
Q6. What MQTT topics are used for relay control?
Relay commands are received on relay/cmd (JSON payload: relay index + state), and current relay/DI status is published to relay/status. The topic structure is configurable in the source code.
Key Takeaway
This project bridges the gap between industrial I/O hardware and modern marine/IoT protocols. By combining WIZnet W5500 wired Ethernet, SignalK, MQTT, and Victron Venus OS integration on a single ESP32-S3 board, it enables reliable remote relay control and monitoring in environments where Wi-Fi is not an option.
Source Code: https://github.com/SFH008/esp32-s3-eth-relay-board
