Wiznet makers

irina

Published August 03, 2026 ©

184 UCC

5 WCC

104 VAR

0 Contests

0 Followers

0 Following

Original Link

Plug-In-Battery (ESP32-C6 PV Bridge)

A PV-system bridge with an ESP32-C6 as its "brain": W5500 wired Ethernet talks MQTT to Victron, while Zigbee exposes battery values to Home Assistant.

COMPONENTS
PROJECT DESCRIPTION

저자 소개

이 프로젝트는 GitHub 사용자 @antoskoro96-spec 가 공개했으며, 기기 식별자(Zigbee fingerprint)에 제조사명이 "MarkoLab", 모델 ID가 ESP32C6_Battery_Bridge 로 지정돼 있습니다 — 개인/소규모 랩 성격의 자작 프로젝트로 보입니다. 실사용(Victron 태양광 + Home Assistant) 환경을 겨냥한 브리지 펌웨어이며, README를 모듈별 읽기 순서·MQTT 토픽·확장 방법까지 상세히 문서화한 점에서 직접 운용하며 다듬은 실용 프로젝트로 읽힙니다. (실명·소속 등 상세 신상은 공개 범위가 제한적이라 단정하지 않습니다.)

프로젝트가 하는 일

Plug-In-BatteryESP32-C6 를 중심으로 태양광 저장 시스템의 두 세계를 잇는 모듈식 브리지입니다.

  • 읽기 경로 (Victron → ESP → Zigbee): 배터리 SoC·전압·전류·전력 을 Victron MQTT에서 받아 Zigbee로 Home Assistant에 노출
  • 쓰기 경로 (Zigbee → ESP → Victron): Grid Setpoint(계통 목표 전력), Max Feed-In(최대 역송전 한계) 을 Home Assistant에서 설정해 MQTT로 Victron에 전달
  • 신뢰성 설계: 쓰기값마다 "requested(요청값)"과 "actual(MQTT 확인값)"을 분리 관리 → 잘못된 UI 피드백 방지, 재시도 로직, 한계값 클램프
  • 모듈 구조: config.h(설정·핀·토픽·한계) / state_store(전역 상태) / eth_manager(이더넷) / mqtt_bridge(Victron MQTT) / zigbee_bridge(Zigbee) / plug_in_battery.ino(오케스트레이션)
  • 별도 Zigbee2MQTT 외부 컨버터(markolab_battery_test.mjs + configuration.yaml)로 Home Assistant 엔티티(soc·voltage·current·power·grid_setpoint·max_feedin_power) 노출

COMPONENTS 

ComponentNotesQty
ESP32-C6시스템 "두뇌" — Ethernet/MQTT/Zigbee 브리지 (Zigbee 지원 SoC)x 1
WIZnet W5500 이더넷 모듈유선 이더넷 (SPI) — Victron과 MQTT 통신 경로x 1
Victron 시스템GX/Venus OS 등 MQTT 제공 (배터리·인버터)x 1
Zigbee 코디네이터 + Zigbee2MQTTHome Assistant 통합x 1

WIZnet이 들어가는 위치

이 브리지의 네트워크(LAN) 계층W5500 유선 이더넷입니다. eth_manager 모듈이 W5500을 전담합니다.

  • 역할: ESP32-C6가 W5500 유선 이더넷으로 Victron 시스템과 MQTT 통신합니다. Victron에서 배터리 데이터를 구독(subscribe)하고, 설정값(Grid Setpoint/Max Feed-In)을 발행(publish)하는 그 물리 경로가 W5500입니다.
  • 연결: SPI. eth_manager.cppSPI 초기화 → W5500 기동 → 정적 IP 설정 → 링크/IP 모니터링 → 네트워크 끊김 시 MQTT 연결 해제까지 처리합니다.
  • 핀 설정: 이더넷 핀은 config.h에 정의되어 있습니다(README 명시). 정확한 GPIO 번호·정적 IP·MQTT 호스트/포트는 config.h에서 확인하세요.
  • 동작 모드(참고): 이 프로젝트는 Arduino/ESP-IDF 기반(.ino)으로 ESP32의 소프트웨어 네트워크 스택(lwIP)을 사용합니다. 이런 구성에서 W5500은 보통 하드웨어 TCP/IP(TOE)가 아니라 MACRAW(L2 NIC) 모드로 쓰이며, TCP/IP·MQTT 처리는 ESP32의 lwIP/클라이언트가 담당합니다. (정확한 초기화 방식은 eth_manager.cpp 소스 확인 권장)

즉 W5500은 이 브리지에서 Victron ↔ Home Assistant 데이터가 오가는 안정적인 유선 통신 토대입니다. 태양광/배터리 시스템은 상시 가동·신뢰성이 중요하므로, WiFi 대신 유선 이더넷을 쓰는 설계가 합리적입니다.

구현 메모

  • 플랫폼: Arduino (ESP32-C6, .ino + 모듈식 .h/.cpp).
  • MQTT 토픽: 읽기 N/.../Dc/Battery/{Voltage,Current,Power,Soc}, 확인 N/.../Settings/CGwacs/{AcPowerSetPoint,MaxFeedInPower}, 쓰기 W/.../Settings/CGwacs/..., keepalive R/.../keepalive.
  • 한계값(config.h 예): GRID_SP_MIN/MAX, MAX_FEEDIN_MIN/MAX — Zigbee 입력·MQTT 확인·내부 검증에 공통 적용.
  • Zigbee 엔드포인트: 읽기 genAnalogInput 10~13(SoC/전압/전류/전력), 쓰기 genAnalogOutput 14~15(Grid Setpoint/Max Feed-In). fingerprint modelID=ESP32C6_Battery_Bridge, manufacturerName=MarkoLab.
  • 문서: 저장소에 Plug_In_Battery.pdf 포함, README에 모듈별 설명·확장 절차 정리.

안전 및 주의

  • ⚠️ 이 시스템은 Grid Setpoint·Max Feed-In 등 인버터 동작 파라미터를 실제로 변경합니다. 태양광 계통연계 설정은 전력·안전·규정과 직결되므로, 한계값(config.h)을 신중히 설정하고 현지 계통연계 규정을 반드시 준수하세요.
  • 초기 단계(스타 0)의 개인 프로젝트이며, 저장소에 라이선스 명시가 없으니 재사용 전 원저작자에게 확인하세요.

유사 프로젝트

https://maker.wiznet.io/gunn/projects/esp32-w5500-gateway-modbus/

두 프로젝트 모두 ESP32 + W5500 유선 이더넷으로 에너지 시스템을 게이트웨이/브리지한다는 점에서 유사합니다. Plug-In-Battery는 Victron 태양광을 MQTT↔Zigbee로 브리지하고, gunn의 프로젝트는 Modbus 게이트웨이입니다. 둘 다 W5500 유선으로 상시 가동 데이터를 안정적으로 나릅니다.

항목Plug-In-BatteryESP32 W5500 Gateway Modbus (gunn)
성격PV 브리지(MQTT↔Zigbee)산업 데이터 게이트웨이
MCUESP32-C6ESP32
상대 시스템Victron / Home AssistantModbus 기기
W5500유선 이더넷(SPI), MQTT 경로유선 이더넷(SPI), Modbus 경로
데이터배터리 SoC·전압·전류·전력Modbus 레지스터

FAQ

Q: 이 프로젝트는 무엇인가요? A: ESP32-C6로 Victron 태양광 시스템과 Home Assistant를 잇는 브리지입니다. 배터리 값을 읽고, 계통 설정값을 씁니다.

Q: W5500은 어떻게 쓰이나요? A: 유선 이더넷(SPI)으로 Victron과 MQTT 통신하는 네트워크 계층입니다. eth_manager가 SPI 초기화·정적 IP·링크 모니터링을 처리합니다.

Q: W5500 핀은 무엇인가요? A: config.h의 Ethernet pin configuration에 정의돼 있습니다. 정확한 GPIO는 소스를 확인하세요.

Q: W5500이 하드웨어 TCP/IP(TOE)를 쓰나요? A: Arduino/lwIP 기반 구성에서는 보통 MACRAW(L2 NIC)로 동작하고 TCP/IP는 ESP32의 소프트웨어 스택이 처리합니다. 정확한 방식은 eth_manager.cpp 확인 권장.


What the Project Does

Plug-In-Battery is a modular bridge built around an ESP32-C6 that links two worlds of a solar-storage system.

  • Read path (Victron → ESP → Zigbee): battery SoC, voltage, current, power are received from Victron over MQTT and exposed to Home Assistant via Zigbee
  • Write path (Zigbee → ESP → Victron): Grid Setpoint and Max Feed-In are set from Home Assistant and sent to Victron over MQTT
  • Reliability by design: each writable value tracks "requested" vs "actual" (MQTT readback) → avoids false UI feedback, adds retry logic and limit clamping
  • Modular structure: config.h (settings/pins/topics/limits) / state_store (global state) / eth_manager (Ethernet) / mqtt_bridge (Victron MQTT) / zigbee_bridge (Zigbee) / plug_in_battery.ino (orchestration)
  • A separate Zigbee2MQTT external converter (markolab_battery_test.mjs + configuration.yaml) exposes Home Assistant entities (soc, voltage, current, power, grid_setpoint, max_feedin_power)

Where WIZnet Fits

The bridge's network (LAN) layer is the W5500 wired Ethernet, handled by the eth_manager module.

  • Role: the ESP32-C6 uses W5500 wired Ethernet to talk MQTT to the Victron system — subscribing to battery data and publishing setpoints (Grid Setpoint / Max Feed-In) over that physical path.
  • Connection: SPI. eth_manager.cpp handles SPI init → W5500 startup → static IP → link/IP monitoring → MQTT disconnect on network loss.
  • Pins: the Ethernet pins are defined in config.h (per README). Check config.h for exact GPIOs, static IP, and MQTT host/port.
  • Mode (note): this is an Arduino/ESP-IDF project (.ino) using the ESP32's software network stack (lwIP). In such setups the W5500 typically runs in MACRAW (L2 NIC) mode rather than its hardware TCP/IP (TOE), with TCP/IP and MQTT handled by lwIP/client on the ESP32. (Confirm the exact init in eth_manager.cpp.)

So the W5500 is the stable wired backbone carrying data between Victron and Home Assistant. Solar/battery systems need always-on reliability, so wired Ethernet over WiFi is a sensible choice here.

Implementation Notes

  • Platform: Arduino (ESP32-C6, .ino + modular .h/.cpp).
  • MQTT topics: read N/.../Dc/Battery/{Voltage,Current,Power,Soc}, readback N/.../Settings/CGwacs/{AcPowerSetPoint,MaxFeedInPower}, write W/.../Settings/CGwacs/..., keepalive R/.../keepalive.
  • Limits (config.h): GRID_SP_MIN/MAX, MAX_FEEDIN_MIN/MAX — applied to Zigbee input, MQTT readback, and internal validation.
  • Zigbee endpoints: read genAnalogInput 10–13 (SoC/V/A/W), write genAnalogOutput 14–15 (Grid Setpoint / Max Feed-In). Fingerprint modelID=ESP32C6_Battery_Bridge, manufacturerName=MarkoLab.
  • Docs: repo includes Plug_In_Battery.pdf; README documents each module and extension steps.

Safety & Notes

  • ⚠️ This system actually changes inverter operating parameters (Grid Setpoint, Max Feed-In). Grid-tied solar settings affect power, safety, and regulations — set the limits (config.h) carefully and follow your local grid-interconnection rules.
  • Early-stage personal project (0 stars); no license is stated in the repo — check with the author before reuse.

Similar Project

https://maker.wiznet.io/gunn/projects/esp32-w5500-gateway-modbus/

Both use an ESP32 + W5500 wired Ethernet to gateway/bridge an energy system. Plug-In-Battery bridges Victron solar via MQTT↔Zigbee; gunn's project is a Modbus gateway. Both carry always-on data reliably over wired W5500.

ItemPlug-In-BatteryESP32 W5500 Gateway Modbus (gunn)
NaturePV bridge (MQTT↔Zigbee)Industrial data gateway
MCUESP32-C6ESP32
Peer systemVictron / Home AssistantModbus devices
W5500Wired Ethernet (SPI), MQTT pathWired Ethernet (SPI), Modbus path
DataBattery SoC·V·A·WModbus registers

FAQ

Q: What is this project? A: An ESP32-C6 bridge linking a Victron solar system to Home Assistant — reading battery values and writing grid setpoints.

Q: How is the W5500 used? A: As the network layer for wired-Ethernet MQTT to Victron; eth_manager handles SPI init, static IP, and link monitoring.

Q: What are the W5500 pins? A: Defined in config.h (Ethernet pin configuration). Check the source for exact GPIOs.

Q: Does the W5500 use hardware TCP/IP (TOE)? A: In an Arduino/lwIP setup it typically runs MACRAW (L2 NIC) with TCP/IP handled by the ESP32's software stack. Confirm in eth_manager.cpp.


  • Programming Language: C++ (Arduino, ESP32-C6) · JavaScript (Zigbee2MQTT converter) · YAML
  • Application: 태양광/PV · 배터리 저장(ESS) · Home Assistant · MQTT · Zigbee 게이트웨이
  • Tags: W5500, ESP32, ESP32-C6, Victron, MQTT, Zigbee, Zigbee2MQTT, Home-Assistant, solar, PV, battery, gateway, Ethernet
Documents
Comments Write