Wiznet makers

irina

Published May 27, 2025 ©

100 UCC

5 WCC

88 VAR

0 Contests

0 Followers

0 Following

Original Link

HW_10-In-Rack_PDU

Open-source 10-outlet rack PDU with ESP32 and W5500 Ethernet module, featuring OLED display, MQTT/web UI support, and per-outlet relay control.

COMPONENTS
PROJECT DESCRIPTION

🧩 Project Overview

The HW_10-In-Rack_PDUd is an open-source 10-channel smart PDU (Power Distribution Unit) built around the ESP32 microcontroller and WIZnet’s W5500 Ethernet controller. Designed for use in server or network racks, it allows individual control of each outlet via a sleek web interface or MQTT messages.

This project demonstrates how to build reliable, deterministic network control for power systems using simple and robust embedded hardware.


🌐 Why W5500 Matters

WIZnet’s W5500 provides a full hardware TCP/IP stack, freeing the ESP32 from processing complex Ethernet protocols. In this project, W5500 offers:

Deterministic Ethernet connectivity via SPI

Stable MQTT and WebSocket communication

Low-overhead OTA firmware updates

Static and dynamic IP support with fallback logic

💡 Ethernet is preferred over Wi-Fi in power systems due to its lower jitter, interference immunity, and predictable behavior under load.


🔧 Hardware Components

ComponentDescription
ESP32-WROOMMain microcontroller (Wi-Fi + UART/SPI)
W5500 ModuleEthernet communication via SPI
Relay Board10 relays for outlet switching
0.91" OLEDStatus display (via I²C)
Custom PCBDesigned for EMI reduction & modularity

🔌 System Architecture

[User/Web/MQTT] ⇄ [W5500 Ethernet] ⇄ [ESP32] ⇄ [Relays]
                                          ⇓
                                     [OLED Display]
 
  1. W5500 establishes an Ethernet link using SPI with ESP32.
  2. The ESP32 manages socket data, relay states, and system logic.
  3. Status is displayed via OLED in real time.
  4. Users can control the PDU through a browser, MQTT app, or backend server.

⚙️ Firmware Highlights with W5500 Integration

The firmware is written using ESP-IDF and PlatformIO, and utilizes WIZnet’s W5500 to handle all network communication, including web services and MQTT.

🔌 W5500-Specific Software Features

  • SPI Initialization
    Configured for 20 MHz full-duplex operation. GPIOs for CS, RESET, and INT are mapped via config headers.
  • IP Addressing
    • Defaults to DHCP, with optional static fallback.
    • Lease information is stored in NVS for persistence.
    • Web UI or MQTT commands can override IP settings.
  • Socket Handling
    • W5500 provides 8 independent sockets.
    • Used for:
    • Web UI HTTP server
    • MQTT connection
    • OTA service
    • Sockets are polled and state-managed manually for robustness.
  • MQTT Client over W5500
    • ESP32 communicates directly via W5500 to publish/subscribe to topics.
    • Compatible with brokers like Mosquitto, HiveMQ, Home Assistant.
    • Keep-alive and reconnect logic implemented for link recovery.
  • Web UI Hosting
    • W5500 serves lightweight HTML/CSS frontend from SPIFFS.
    • Relay toggles and system config available via REST API.
  • Ethernet Link Monitoring
    • Uses W5500’s INTn pin to detect link loss or DHCP timeout.
    • Fallback to static IP with retry logic and UI notification.

🧠 The W5500 acts as a true offload engine, minimizing CPU load and ensuring the ESP32 focuses on real-time relay control and display.


🎯 Use Cases

Remote server power management

Sequential startup/shutdown in rack setups

Lab automation and timed control

Secure, wired smart home integration


🧠 From a Chip Engineer’s Perspective

The beauty of this project lies in its clean separation of concerns. The W5500 handles all Ethernet logic in hardware, offering a deterministic and EMI-resistant network layer. This frees the ESP32 to manage IO, GPIO, and peripheral logic without juggling Wi-Fi stacks or software-based TCP.

It’s a textbook example of how embedded Ethernet controllers like W5500 bring industrial-grade robustness to DIY and professional projects alike.


📎 Resources

GitHub: HW_10-In-Rack_PDUd

WIZnet: W5500 Datasheet

MQTT: Mosquitto Broker, Home Assistant MQTT

ESP-IDF Docs: Networking


✍️ Final Thoughts

This smart PDU project proves that Ethernet-powered control is not just possible—it's ideal for reliable, low-latency, secure system integration. The W5500 shines as the backbone of robust communication, and the result is a power control unit ready for both home labs and enterprise racks.

If you're considering building your own smart PDU or exploring W5500 in embedded systems, this is an excellent foundation to start from.

Documents
Comments Write