Wiznet makers

Grace_Koo

Published May 29, 2026 ©

64 UCC

25 WCC

9 VAR

0 Contests

0 Followers

0 Following

Original Link

ESP32_PWM_Network_Node

A compact ESP32 node that receives commands over the network and drives servo motors or relays.

COMPONENTS Hardware components

WIZnet - W5500

x 1


Espressif - ESP32

x 1


PROJECT DESCRIPTION

Driving 700 Servos Simultaneously Over One Network — ESP32_PWM_Network_Node

Summary

"An ESP32 + WIZnet W5500 network node that receives UDP broadcast packets to control servos and relays — supporting up to 32,765 nodes simultaneously, designed for large-scale animatronics installations."

When animatronics or stage installations require hundreds of servo motors running in sync, conventional wiring approaches become impractical fast. ESP32_PWM_Network_Node solves this by sending a single UDP broadcast packet over Ethernet that all nodes receive at once — each node extracts only the data words assigned to it and drives its outputs accordingly.

Rolf Jethon (Germany) designed this hardware to work with his bechele host software (https://github.com/bechele/bechele). PCB files are published in two versions — SMD and through-hole — along with KiCad source files and Gerber files ready for any PCB manufacturer.


System Architecture

[Host PC / Raspberry Pi]
  bechele software
        │
        │  UDP broadcast (port 7625)
        │  one packet → all nodes receive simultaneously
        ▼
[Network Switch]
        │
        ├── [Node 1] ESP32 + W5500
        ├── [Node 2] ESP32 + W5500
        ├── ...
        └── [Node N] ESP32 + W5500 (up to 32,765)
        │
        each node: up to 16 servo channels + up to 16 relay channels
ComponentDetails
MCUESP32 Wroom 32
EthernetWIZnet W5500 (SPI, GPIO18/23/36/5/16)
OutputsUp to 16 servo channels + up to 16 relay channels (mixed)
ProtocolUDP broadcast, port 7625
Refresh rate50ms (20Hz)
Max nodes per packet700 (1432-byte packet limit)
Max node address space32,765
PCBSMD version + through-hole version, KiCad source published
Enclosure4 STL files for 3D printing

Broadcast Architecture Is the Key

In a typical networked control system, the host sends individual packets to each node. 100 nodes means 100 packets. ESP32_PWM_Network_Node works differently. The host sends one broadcast packet, and every node on the network receives it simultaneously. Each node reads only the data words assigned to it in the payload and drives its outputs.

This structure allows new data to reach 700 nodes (11,200 servos) every 50ms. The author reports running a 700-servo test over Ethernet at a 50ms refresh rate for an extended period with zero packet loss.


WIZnet W5500's Role

The W5500 handles all Ethernet communication. On boot, if W5500 is detected, the node switches to Ethernet mode and disables Wi-Fi. If the W5500 is absent or fails to initialize, the node falls back to Wi-Fi — there is no automatic fallback from Ethernet to Wi-Fi once Ethernet mode is active.

A notable implementation detail: the firmware bypasses the Ethernet2 library entirely and drives the W5500 via raw SPI register access. The reason is that the Ethernet2 library does not support receiving UDP broadcasts, which is the core communication mechanism of this project.

// Detect W5500 by reading version register directly
byte version = SPIe.transfer(0x00); // read register 0x0039
if (version == 0x04) {
    useEthernet = true;  // W5500 found → Ethernet mode
} else {
    useEthernet = false; // W5500 not found → Wi-Fi mode
}
// Initialize UDP socket via raw SPI
writeW5500(S0_MR, CB_WRITE_SR0, 0x02);          // set UDP mode
writeW5500(S0_PORT, CB_WRITE_SR0, 0x1D);        // port 7625 high byte
writeW5500(S0_PORT + 1, CB_WRITE_SR0, 0xC9);    // port 7625 low byte
writeW5500(S0_CR, CB_WRITE_SR0, 0x01);          // OPEN socket

Why Ethernet Over Wi-Fi

The author explicitly discourages Wi-Fi use. Wi-Fi is not designed for real-time device control, and packet loss in a dense wireless environment will cause servo movement to stutter. Conditions required for reliable Wi-Fi operation — RSSI below -70dBm, minimal nearby wireless sources — are difficult to guarantee in a live installation environment. In contrast, the W5500 Ethernet configuration showed no packet loss across extended testing at 700 servos and 50ms refresh rate.


Node Configuration

Each node stores its MAC address, node number, PWM output count, and data stream start word position in EEPROM. All configuration is done remotely over the network using the nodeconfig.pl host tool — no physical access to each node is needed after initial setup.

RegisterContent
0–5MAC address
6Node address
7Number of PWM outputs (0–16)
8Start word position in the data stream for this node's PWM data
9First PWM output pin number
10Number of relay outputs (0–16)
11Data word position containing relay bit data
12First relay pin number

Tech Stack

ComponentDetails
MCUESP32 Wroom 32
EthernetWIZnet W5500 (Hardwired TCP/IP, SPI)
Firmware languageC++ (Arduino IDE)
NetworkUDP broadcast, raw W5500 SPI register access
OutputsServo PWM (50Hz, 12-bit) + digital relay
Configuration toolnodeconfig.pl (host side)
PCB designKiCad, Gerber files published
EnclosureSTL / OBJ files published (3D print)

FAQ

Q. Can servos and relays be mixed on a single node? A. Yes. The 16 output pins can be split between servo and relay outputs in any combination. The data word ranges for servos and relays must not overlap in the broadcast packet.

Q. Does it work on Wi-Fi without the W5500? A. It works, but the author explicitly advises against it. Wi-Fi is not suited for real-time control — packet loss in a crowded wireless environment will cause servo movement to stutter. The W5500 Ethernet module is strongly recommended for reliable operation.

Q. How do you control more than 700 nodes? A. The current 1432-byte UDP packet limit allows up to 700 nodes per packet. The author notes that splitting the data across multiple packets with a software modification would extend this further.

Q. Why raw SPI instead of the Ethernet2 library? A. The Ethernet2 library does not support receiving UDP broadcast packets. Since broadcast reception is the foundation of this project's communication model, the firmware drives the W5500 directly via raw SPI register access.


Project Links

Documents
Comments Write