Wiznet makers

Lihan__

Published February 08, 2026 ©

30 UCC

8 WCC

3 VAR

0 Contests

0 Followers

0 Following

Original Link

ESP32-Based 8-Channel Relay Control System with W5500 Ethernet LAN

An ESP32 relay controller combining WiFi and W5500 wired Ethernet on a single-layer PCB.

COMPONENTS
PROJECT DESCRIPTION
ESP32-Based 8-Channel Relay Control System with W5500 Ethernet LAN

An ESP32 relay controller combining WiFi and W5500 wired Ethernet on a single-layer PCB. The 74HC595 shift register drives 8 relays using only 3 GPIO pins, while W5500 provides reliable LAN-based industrial control.


PROJECT DESCRIPTION

1. Project Background and Technical Goals

 

This project was initiated to address a common need in IoT and industrial automation: reliable remote relay control over both wireless and wired networks. Many existing ESP32-based relay modules offer only WiFi connectivity, which presents reliability issues in electrically noisy industrial environments or locations with poor wireless coverage. This project combines the ESP32-WROOM module with the W5500 Ethernet controller on a single-layer PCB to provide dual-network relay control. The primary goal is to create a cost-effective, manufacturable relay module that can be produced anywhere in the world using basic single-layer PCB fabrication — a capability available even in regions without access to advanced multi-layer PCB manufacturing facilities. By using a 74HC595 shift register to drive 8 relays through only 3 GPIO pins, the design maximizes the ESP32's available I/O for other functions while maintaining clean signal routing on the single-layer board.

2. Key Technical Elements and Selection Reasons (Methodology)

Components were selected to balance functionality, manufacturability, and global availability.

Main Controller (ESP32-WROOM): Selected for its dual-core processor, built-in WiFi and Bluetooth, and extensive community support. The ESP32 provides the processing power for web server hosting, MQTT client operation, and protocol handling while maintaining low power consumption.

Ethernet Controller (WIZnet W5500): The W5500 module provides hardwired TCP/IP Ethernet connectivity independent of the ESP32's WiFi. Its hardware TCP/IP stack processes network packets without consuming ESP32 CPU cycles, ensuring that relay switching commands are never delayed by network processing overhead. This is critical for industrial applications where response time and reliability are paramount.

Shift Register (74HC595): This 8-bit serial-to-parallel shift register enables control of all 8 relay channels using only 3 GPIO pins (Data, Clock, Latch). This dramatically reduces PCB routing complexity — a key factor enabling the single-layer board design — while also freeing ESP32 GPIO pins for the W5500 SPI interface and status LEDs.

Power Supply (5V to 3.3V Regulator): A dedicated voltage regulator provides clean 3.3V power to the W5500 module, isolated from the 5V relay driver circuit. This prevents voltage fluctuations caused by relay switching from affecting the Ethernet controller's stability.

Relay Array (8-Channel): Eight standard electromagnetic relays provide electrically isolated switching for AC or DC loads. Each relay is driven through the 74HC595 outputs via transistor driver circuits.

3. In-depth Analysis of Hardware Operating Principles (Hardware Mechanics)

The system is designed around three main functional blocks: network communication, serial relay control, and power management.

Dual-Network Architecture: The ESP32 simultaneously maintains two independent network interfaces. WiFi is handled natively by the ESP32's internal radio, while Ethernet is managed by the external W5500 module connected via SPI bus. Both interfaces can operate concurrently, allowing the module to be controlled through either network path. If WiFi connectivity is lost, Ethernet control remains fully operational, and vice versa — providing built-in network redundancy.

Serial Relay Control Chain: The 74HC595 shift register receives 8 bits of relay state data serially from the ESP32 through three signal lines:

DATA (GPIO 32): The ESP32 sets each bit of the desired relay pattern on this pin sequentially, starting from the most significant bit.

CLOCK (GPIO 25): A rising edge on this pin shifts the current DATA bit into the register. Eight clock pulses load the complete relay state.

LATCH (GPIO 33): After all 8 bits are clocked in, a rising edge on the LATCH pin transfers the shift register contents to the output pins simultaneously. This ensures all 8 relays update at the exact same moment, preventing transient states.

Physical Layout: The DC jack provides 5V power input, which directly supplies the relay driver circuits and feeds through the 3.3V regulator to the W5500 and ESP32. Two status LEDs provide visual indication of system operation and network connectivity.

4. Communication Interface: The Role and Necessity of W5500 Ethernet

The inclusion of wired Ethernet alongside WiFi is a deliberate design decision driven by real-world deployment requirements.

W5500 SPI Communication: The W5500 connects to the ESP32 via the SPI bus. Despite sharing the bus, the hardware TCP/IP stack within the W5500 handles all Ethernet frame processing, IP routing, TCP/UDP management, and checksum verification internally. The ESP32 only needs to read and write socket data through simple SPI register operations, resulting in minimal CPU overhead.

Industrial Reliability: In factory or workshop environments, electromagnetic interference from motors, welding equipment, and high-voltage switching gear can disrupt WiFi signals. The W5500's wired Ethernet connection is inherently immune to RF interference, providing consistent sub-millisecond response times regardless of the electromagnetic environment. This makes the module suitable for controlling machinery, lighting systems, HVAC equipment, and other industrial loads.

Network Integration: Wired Ethernet enables direct integration into existing industrial network infrastructure. The module can be assigned a static IP address and connected to managed switches, VLANs, and firewalled network segments — capabilities that are difficult or impossible to achieve reliably with WiFi in industrial settings.

Dual-Stack Flexibility: The firmware can be configured to accept relay control commands over either interface using standard protocols (HTTP REST API, MQTT, raw TCP/UDP, or Modbus TCP). The W5500 handles the Ethernet protocol stack independently, so both network interfaces can process commands simultaneously without resource conflicts.

5. PCB Design Philosophy and Manufacturing Accessibility (Hardware Design)

A key innovation of this project is its commitment to single-layer PCB design.

Single-Layer Constraint: The entire circuit — including the ESP32 module, W5500 Ethernet module, 74HC595 shift register, 8 relay driver circuits, power regulation, and all interconnections — is routed on a single copper layer. This is achieved through careful component placement and the GPIO-minimizing shift register approach.

Global Manufacturability: Single-layer PCB fabrication is available in virtually every country with basic electronics manufacturing capability. Unlike multi-layer boards that require specialized equipment and lamination processes, single-layer boards can be produced by small local PCB shops, significantly reducing lead times and shipping costs for makers worldwide.

Modular Design: The W5500 is implemented as a plug-in module rather than a soldered chip, simplifying assembly and allowing easy replacement or upgrade. The ESP32-WROOM is similarly mounted as a module, enabling the board to serve as a carrier/breakout platform.

6. Project Result and Conclusion

This project demonstrates that reliable dual-network relay control can be achieved on a simple, globally manufacturable single-layer PCB using the W5500 Ethernet controller.

Technical Achievement: The combination of ESP32 WiFi and W5500 wired Ethernet provides redundant network connectivity for 8-channel relay control. The 74HC595 shift register enables clean single-layer routing while preserving GPIO resources for the W5500 SPI interface.

Scalability: Multiple modules can be deployed across a facility, each with a unique IP address on the wired Ethernet network. The W5500 hardware stack ensures that even dozens of modules operating simultaneously maintain consistent response times without network processing bottlenecks.

Accessibility: The single-layer PCB design and use of globally available components mean this module can be manufactured and assembled anywhere in the world, making it an ideal solution for makers and small manufacturers in regions with limited access to advanced PCB fabrication.

Conclusion: By integrating the W5500 hardware Ethernet controller with an ESP32 and shift-register relay driver on a single-layer PCB, this project provides an economical, reliable, and universally manufacturable IoT relay control solution suitable for both home automation and industrial applications.


1. 프로젝트 배경 및 기술적 목표

이 프로젝트는 IoT 및 산업 자동화에서 흔히 요구되는 과제, 즉 무선과 유선 네트워크 모두를 통한 안정적인 원격 릴레이 제어를 해결하기 위해 시작되었습니다. 기존의 많은 ESP32 기반 릴레이 모듈은 WiFi 연결만 제공하여, 전기적 노이즈가 많은 산업 환경이나 무선 수신이 불량한 장소에서 안정성 문제가 발생합니다. 이 프로젝트는 ESP32-WROOM 모듈과 W5500 이더넷 컨트롤러를 단일 레이어 PCB 위에 결합하여 이중 네트워크 릴레이 제어를 구현합니다. 핵심 목표는 세계 어디에서나 기본적인 단일 레이어 PCB 제조만으로 생산 가능한 비용 효율적 릴레이 모듈을 만드는 것입니다 — 이는 고급 다층 PCB 제조 시설이 없는 지역에서도 가능한 역량입니다. 74HC595 시프트 레지스터를 사용하여 단 3개의 GPIO 핀으로 8개의 릴레이를 구동함으로써, ESP32의 가용 I/O를 다른 기능에 최대한 활용하면서 단일 레이어 보드에서의 깔끔한 신호 라우팅을 유지합니다.

 

2. 핵심 기술 요소 및 선정 이유 (Methodology)

기능성, 제조 용이성, 글로벌 가용성의 균형을 고려하여 부품을 선정하였습니다.

메인 컨트롤러 (ESP32-WROOM): 듀얼 코어 프로세서, 내장 WiFi 및 Bluetooth, 광범위한 커뮤니티 지원을 갖추고 있어 선정되었습니다. ESP32는 웹 서버 호스팅, MQTT 클라이언트 운영, 프로토콜 처리를 위한 충분한 처리 능력을 제공하면서 낮은 전력 소모를 유지합니다.

이더넷 컨트롤러 (WIZnet W5500): W5500 모듈은 ESP32의 WiFi와 독립적인 하드웨어 TCP/IP 이더넷 연결을 제공합니다. 하드웨어 TCP/IP 스택이 ESP32 CPU 사이클을 소모하지 않고 네트워크 패킷을 처리하여, 릴레이 스위칭 명령이 네트워크 처리 오버헤드로 인해 지연되지 않도록 보장합니다. 이는 응답 시간과 안정성이 최우선인 산업용 응용 분야에서 매우 중요합니다.

시프트 레지스터 (74HC595): 이 8비트 직렬-병렬 시프트 레지스터는 단 3개의 GPIO 핀(Data, Clock, Latch)만으로 8개 릴레이 채널 전체를 제어할 수 있게 합니다. 이는 PCB 라우팅 복잡성을 획기적으로 줄여 — 단일 레이어 보드 설계를 가능하게 하는 핵심 요소이며 — 동시에 W5500 SPI 인터페이스와 상태 LED를 위한 ESP32 GPIO 핀을 확보합니다.

전원 공급 (5V → 3.3V 레귤레이터): 전용 전압 레귤레이터가 W5500 모듈에 5V 릴레이 구동 회로와 분리된 깨끗한 3.3V 전원을 공급합니다. 이는 릴레이 스위칭으로 인한 전압 변동이 이더넷 컨트롤러의 안정성에 영향을 미치는 것을 방지합니다.

릴레이 어레이 (8채널): 8개의 표준 전자기 릴레이가 AC 또는 DC 부하에 대한 전기적으로 절연된 스위칭을 제공합니다. 각 릴레이는 트랜지스터 구동 회로를 통해 74HC595 출력으로 구동됩니다.

3. 하드웨어 작동 원리에 대한 심층 분석 (Hardware Mechanics)

시스템은 네트워크 통신, 직렬 릴레이 제어, 전원 관리의 세 가지 주요 기능 블록으로 설계되었습니다.

이중 네트워크 아키텍처: ESP32는 두 개의 독립적인 네트워크 인터페이스를 동시에 유지합니다. WiFi는 ESP32 내부 무선 모듈이 기본 처리하고, 이더넷은 SPI 버스로 연결된 외부 W5500 모듈이 관리합니다. 두 인터페이스가 동시에 작동할 수 있어, 어느 네트워크 경로로든 모듈을 제어할 수 있습니다. WiFi 연결이 끊어져도 이더넷 제어는 완전히 작동하며, 그 반대도 마찬가지입니다 — 내장형 네트워크 이중화를 제공합니다.

직렬 릴레이 제어 체인: 74HC595 시프트 레지스터는 세 개의 신호선을 통해 ESP32로부터 8비트의 릴레이 상태 데이터를 직렬로 수신합니다:

DATA (GPIO 32): ESP32가 원하는 릴레이 패턴의 각 비트를 최상위 비트부터 순차적으로 이 핀에 설정합니다.

CLOCK (GPIO 25): 이 핀의 상승 에지가 현재 DATA 비트를 레지스터에 시프트합니다. 8번의 클록 펄스로 완전한 릴레이 상태가 로드됩니다.

LATCH (GPIO 33): 8비트 모두 클록 입력된 후, LATCH 핀의 상승 에지가 시프트 레지스터 내용을 출력 핀으로 동시에 전달합니다. 이는 8개 릴레이 모두가 정확히 같은 순간에 업데이트되어 과도 상태를 방지합니다.

물리적 레이아웃: DC 잭이 5V 전원을 입력받아 릴레이 구동 회로에 직접 공급하고, 3.3V 레귤레이터를 거쳐 W5500과 ESP32에 전원을 공급합니다. 2개의 상태 LED가 시스템 작동 및 네트워크 연결 상태를 시각적으로 표시합니다.

4. 통신 인터페이스: W5500 이더넷의 역할과 필요성

WiFi와 함께 유선 이더넷을 포함시킨 것은 실제 운영 환경의 요구사항에 의한 의도적 설계 결정입니다.

W5500 SPI 통신: W5500은 SPI 버스를 통해 ESP32에 연결됩니다. 버스를 공유함에도, W5500 내부의 하드웨어 TCP/IP 스택이 모든 이더넷 프레임 처리, IP 라우팅, TCP/UDP 관리, 체크섬 검증을 내부적으로 처리합니다. ESP32는 간단한 SPI 레지스터 조작을 통해 소켓 데이터를 읽고 쓰기만 하면 되어, CPU 오버헤드가 최소화됩니다.

산업용 안정성: 공장이나 작업장 환경에서는 모터, 용접 장비, 고전압 스위칭 장치의 전자기 간섭이 WiFi 신호를 교란할 수 있습니다. W5500의 유선 이더넷 연결은 RF 간섭에 본질적으로 면역이 있어, 전자기 환경에 관계없이 일관된 밀리초 미만의 응답 시간을 제공합니다. 이는 기계, 조명 시스템, HVAC 장비 및 기타 산업 부하 제어에 적합합니다.

네트워크 통합: 유선 이더넷은 기존 산업 네트워크 인프라에 직접 통합할 수 있게 합니다. 모듈에 고정 IP 주소를 할당하고 관리형 스위치, VLAN, 방화벽이 적용된 네트워크 세그먼트에 연결할 수 있습니다 — 이는 산업 환경에서 WiFi로는 안정적으로 달성하기 어렵거나 불가능한 기능입니다.

듀얼 스택 유연성: 펌웨어는 표준 프로토콜(HTTP REST API, MQTT, 원시 TCP/UDP 또는 Modbus TCP)을 통해 어느 인터페이스로든 릴레이 제어 명령을 수용하도록 설정할 수 있습니다. W5500이 이더넷 프로토콜 스택을 독립적으로 처리하므로, 두 네트워크 인터페이스가 자원 충돌 없이 동시에 명령을 처리할 수 있습니다.

5. PCB 설계 철학 및 제조 접근성 (Hardware Design)

이 프로젝트의 핵심 혁신은 단일 레이어 PCB 설계에 대한 철저한 지향입니다.

단일 레이어 제약: ESP32 모듈, W5500 이더넷 모듈, 74HC595 시프트 레지스터, 8개 릴레이 구동 회로, 전원 레귤레이션, 모든 배선을 포함한 전체 회로가 단일 구리 레이어 위에 라우팅되었습니다. 이는 신중한 부품 배치와 GPIO를 최소화하는 시프트 레지스터 방식을 통해 달성되었습니다.

글로벌 제조 가능성: 단일 레이어 PCB 제작은 기본적인 전자 제조 역량을 갖춘 사실상 모든 국가에서 가능합니다. 전문 장비와 적층 공정이 필요한 다층 보드와 달리, 단일 레이어 보드는 소규모 지역 PCB 업체에서 생산할 수 있어 전 세계 메이커들의 리드 타임과 배송 비용을 크게 줄여줍니다.

모듈형 설계: W5500은 납땜 칩이 아닌 플러그인 모듈로 구현되어 조립이 간편하고 쉽게 교체하거나 업그레이드할 수 있습니다. ESP32-WROOM 역시 모듈 형태로 장착되어, 보드가 캐리어/브레이크아웃 플랫폼 역할을 할 수 있습니다.

6. 프로젝트 결과 및 결론

이 프로젝트는 W5500 이더넷 컨트롤러를 사용하여 간단하고 전 세계에서 제조 가능한 단일 레이어 PCB 위에서 안정적인 이중 네트워크 릴레이 제어를 달성할 수 있음을 증명합니다.

기술적 성과: ESP32 WiFi와 W5500 유선 이더넷의 결합이 8채널 릴레이 제어를 위한 이중화 네트워크 연결을 제공합니다. 74HC595 시프트 레지스터가 W5500 SPI 인터페이스를 위한 GPIO 자원을 보존하면서 깔끔한 단일 레이어 라우팅을 가능하게 합니다.

확장성: 유선 이더넷 네트워크에서 각각 고유한 IP 주소를 가진 다수의 모듈을 시설 전체에 배치할 수 있습니다. W5500 하드웨어 스택이 수십 개의 모듈이 동시 운영되어도 네트워크 처리 병목 없이 일관된 응답 시간을 보장합니다.

접근성: 단일 레이어 PCB 설계와 전 세계적으로 구할 수 있는 부품의 사용은 이 모듈이 세계 어디에서나 제조 및 조립 가능함을 의미하며, 고급 PCB 제작에 대한 접근이 제한된 지역의 메이커와 소규모 제조업체에 이상적인 솔루션을 제공합니다.

결론: W5500 하드웨어 이더넷 컨트롤러를 ESP32 및 시프트 레지스터 릴레이 드라이버와 단일 레이어 PCB 위에 통합하여, 가정 자동화와 산업용 응용 모두에 적합한 경제적이고 안정적이며 전 세계에서 제조 가능한 IoT 릴레이 제어 솔루션을 완성하였습니다.

Documents
Comments Write