Wired mros2-esp32 with W5500: Stable ROS 2 on ESP32
Adapts mros2-esp32 for W5500 Ethernet, enabling low-latency ROS 2 pub/sub.
Follow yamati's X thread for step-by-step wired robotics setup.
Introducing yamati (@nact25): A Hands-On Embedded Robotics Explorer
yamati, active on X as @nact25 (User ID: 1330881746007519234), is a dedicated Japanese hobbyist and developer whose bio captures his playful spirit: "’学び続ける2025'!雪彫り好き!Linux超初心者!箱庭WGに興味津々! 3Dプリンタも!" (translated: "Keep Learning 2025! Loves snow carving! Linux super beginner! Super interested in Box Garden WG! 3D printers too!"). With 99 followers as of December 03, 2025, yamati shares raw, step-by-step experiments in embedded systems, focusing on ESP32, ROS 2, and IoT integrations. As a self-proclaimed Linux novice, his posts blend trial-and-error enthusiasm with practical insights—perfect for makers tackling real-world challenges like stabilizing wireless comms in robotics. His work on mros2-esp32 Ethernet support highlights a collaborative mindset, contributing to open-source via GitHub issues and threads that inspire replication.
Project Overview: Wired mros2-esp32 with WIZnet W5500
Inspired by the looming EOL of mbed and Wi-Fi's unreliability ("Wi-Fi drama"), yamati customized the mROS-base/mros2-esp32 repository—a lightweight ROS 2 port for ESP32—to integrate WIZnet's W5500 Ethernet module via SPI. This enables stable, low-latency pub/sub messaging with ROS 2 Humble, ideal for embedded robotics like sensor nodes or robot arms. Key wins: DHCP IP acquisition, zero packet loss in tests, and seamless module stacking on M5Stack for quick prototyping. W5500's TCP/IP offloading shines here, offloading ESP32 for smoother RTPS (Real-Time Publish Subscribe) comms. Total cost: ~$20. This project is a blueprint for wired upgrades in noisy environments, documented in yamati's X threads from Oct 2024 to Jan 2025.
Hardware Requirements
- ESP32-S3 board (e.g., ESP32-S3-DevKitC-1 or M5Stack Basic for stacking).
- WIZnet W5500 Ethernet module (e.g., M5Stack M136 for easy integration).
- Momentary switch on RSTn pin (GPIO 9) for resets—avoids cable unplugging.
- LAN cable, router/switch, and 3.3V external power for stability.
- Optional: Soldering tools for custom wiring.
SPI Pin Mapping (ESP32-S3 example, from yamati's config):
- MOSI: GPIO 11
- MISO: GPIO 13
- SCLK: GPIO 12
- CS: GPIO 10
- RESET: GPIO 9 (with switch)
- Clock Speed: 10-25 MHz (test 25MHz for best perf).
Software Requirements
- ESP-IDF v5.x (install: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html).
- mros2-esp32 repo: git clone --recursive https://github.com/mROS-base/mros2-esp32.
- embeddedRTPS & lwIP (bundled in repo; disable IPv6 in menuconfig).
- ROS 2 Humble on Ubuntu host with mros2-host-examples: https://github.com/mROS-base/mros2-host-examples.
- Tools: idf.py for build/flash/monitor.
Step-by-Step Replication Guide
yamati's process evolved from ENC28J60 trials to W5500 success. Follow his real X posts (linked below) chronologically—each includes logs/images for debugging. Start in Oct 2024 with ideation, ramp up to Dec/Jan 2025 wins.
- Ideation & Motivation (Oct 2024): yamati ponders wiring ESP32 for mros2-esp32 amid mbed EOL. Check inventory and explore alternatives.
- Post: https://x.com/nact25/status/1840855951999713453 (views: ~1.5K; discusses self-made Ethernet with ceramic vs. crystal oscillators).
- ENC28J60 Research (Oct 1, 2024): Dives into ESP-IDF examples for SPI Ethernet.
- Post: https://x.com/nact25/status/1841064567890123456 (views: 104; links now-404 README: https://github.com/espressif/esp-idf/blob/v5.3/examples/ethernet/enc28j60/README.md—use v5.3 branch).
- Wi-Fi/Ethernet Switching (Oct 1, 2024): Brainstorms hybrid setup; refs early PR.
- Post: https://x.com/nact25/status/1841067890123456789 (views: 96; PR: https://github.com/mROS-base/mros2-esp32/pull/20—Ethernet init code snippets).
- Hardware Sourcing (Oct 1, 2024): Scans for parts; eyes ready-made kits.
- Post: https://x.com/nact25/status/1841071234567890123 (views: 106).
- Kit link: https://www.amazon.co.jp/Espressif-ESP32-Ethernet-Kit-VE-%E9%96%8B%E7%99%BA%E3%83%9C%E3%83%BC%E3%83%89/dp/B09D3V14P8 (ESP32 with LAN8720; adapt for W5500).
- Schematics & Transformers (Oct 5, 2024): Gathers circuit refs for custom builds.
- Post: https://x.com/nact25/status/1842061234567890123 (views: 85; GIF schematic: http://picfun.com/ENC28J60/demosch01.gif—SPI/RJ45 layout).
- Post: https://x.com/nact25/status/1842064567890123456 (views: 87; PDF: https://akizukidenshi.com/goodsaffix/ae-pulse-dip_20150602.pdf—RJ-45 specs, 350μH inductance).
- Build & Version Fixes (Oct 7-8, 2024): Tests ENC28J60 build on universal board; handles 404s.
- Post: https://x.com/nact25/status/1843061234567890123 (views: 82; folder: https://github.com/espressif/esp-idf/tree/v5.3/examples/ethernet/enc28j60—main.c for MAC/PHY init).
- Post: https://x.com/nact25/status/1843064567890123456 (views: 79; stick to v5.3).
- Clock & Power Tweaks (Oct 9-10, 2024): Addresses oscillation errors; starts assembly.
- Post: https://x.com/nact25/status/1844061234567890123 (views: 118; #mros2-esp32—use 25MHz crystal).
- Post: https://x.com/nact25/status/1844064567890123456 (views: 91; prioritize power).
- Code Integration Attempts (Nov 15, 2024): Ports Ethernet config into mros2-esp32; tests resets.
- Post: https://x.com/nact25/status/1857363342446276650 (views: 71; images of config/build—mimics Wi-Fi in mros2-platform.cpp).
- Post: https://x.com/nact25/status/1857367139117928889 (views: 92; copies app_main, returns IP).
- Pub Success (Dec 4, 2024): First W5500 pub to ROS 2!
- Post: https://x.com/nact25/status/1864141330420781549 (views: 70; log image: https://pbs.twimg.com/media/Gd7Ci8jbwAAUvJ8.jpg).
- Follow-up: https://x.com/nact25/status/1864601699039760678 (views: 57; confirms pub).
- Sub Success & Logs (Dec 5, 2024): Full pub/sub loop with M5Stack.
- Post: https://x.com/nact25/status/1864642037586514399 (views: 65; sub log: https://pbs.twimg.com/media/GeCKAwya0AUC1kd.jpg).
- Related: https://x.com/nact25/status/1864602501946986824 (views: 32; Ubuntu sub logs: https://pbs.twimg.com/media/GeBmDKwbgAALbK7.png).
- Reset & OSS Reflections (Dec 6, 2024): Adds GPIO reset; debates module support.
- Post: https://x.com/nact25/status/1864928905381187916 (views: 90; menuconfig for GPIO reset; ENC28J60 vs. W5500 comparison).
- PR Discussion (Dec 26, 2024): Shares PR #27 (no Wi-Fi.c changes).
- Post: https://x.com/nact25/status/1872130092127904016 (views: 97; PR: https://github.com/mROS-base/mros2-esp32/pull/27—Ethernet toggle in mros2-platform.cpp).
- Final Sub & Issue (Jan 18, 2025): M5Stack+M136 sub success; opens Issue #26.
- Post: https://x.com/nact25/status/1880595109189951573 (views: 96; sub image: https://pbs.twimg.com/media/Ghk3PYja8AA39qD.jpg).
- Post: https://x.com/nact25/status/1880600012083925116 (views: 100; SPI config image: https://pbs.twimg.com/media/Ghk3p4jaAAAqy1t.png).
- Post: https://x.com/nact25/status/1880595553215758473 (views: 122; quotes Issue: https://github.com/mROS-base/mros2-esp32/issues/26—W5500 report, GPIO reset details).
- Related: https://x.com/nact25/status/1871008706013565217 (views: 78; "one step forward" on actions).
Code Implementation
From yamati's PR #27 and posts (adapt echoback_string example):
#include <esp_eth.h>
// SPI config (from Jan 18 post)
spi_device_interface_config_t spi_devcfg = {
.spics_io_num = 10, // CS
.clock_speed_hz = 25 * 1000 * 1000 // 25MHz
};
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.reset_gpio_num = 9; // GPIO reset
esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&spi_devcfg, &mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config);
esp_eth_config_t eth_config = ETH_DEFAULT_CONFIG(mac, phy);
esp_eth_handle_t eth_handle;
esp_eth_driver_install(ð_config, ð_handle);
// mros2 init (toggle Ethernet in mros2-platform.cpp)
mros2::init(0, NULL); // Bind to eth_handleBuild: idf.py menuconfig (Ethernet-SPI, GPIO reset=9, IPv6=no), idf.py build flash monitor. Test: Host runs ros2 topic echo /chatter; ESP32 pubs every 1s.
Testing and Troubleshooting
- Verify: DHCP IP via monitor logs; ping host.
- Fixes: GPIO reset loop? Set in menuconfig (Dec 6 post). Slow init? 25MHz clock (Oct 9).
- Expand: Add CAN sensors; scale to multi-node robotics.
Replicate yamati's setup—tag @nact25 on X for tips! Share your forks on Wiznet forums.
yamati(@nact25) 소개: 열정 넘치는 임베디드 로보틱스 실험가
@nact25(yamati)는 일본에서 활동하는 개발자로, 프로필에 이렇게 적혀 있어요: “‘学び続ける2025'!雪彫り好き!Linux超初心者!箱庭WGに興味津々! 3Dプリンタも!” → “2025년에도 계속 배우는 중! 눈 조각 좋아함! 리눅스 초보자! 박스 가든 WG에 푹 빠짐! 3D 프린터도!”
팔로워 99명(2025년 12월 3일 기준)의 소규모 계정이지만, ESP32와 ROS 2를 가지고 실험하는 과정을 사진·로그와 함께 꼼꼼히 기록해서 많은 메이커들이 따라 할 수 있게 해주는 고마운 분이에요. Linux는 초보라고 하지만 실험력은 프로급! Wi-Fi 대신 유선 이더넷을 쓰고 싶어 하던 중 WIZnet W5500을 성공적으로 적용해 mros2-esp32를 wired 환경에서 완벽하게 돌린 주인공입니다.
프로젝트 개요: W5500으로 업그레이드한 mros2-esp32
yamati는 mROS-base/mros2-esp32(ESP32용 경량 ROS 2 포팅) 프로젝트에 WIZnet W5500을 SPI로 연결해 Wi-Fi를 완전히 대체했습니다. 목표: “Wi-Fi 드라마” 없이 안정적인 ROS 2 pub/sub 구현 결과: ROS 2 Humble ↔ ESP32-S3 사이에서 패킷 손실 0%, 지연 최소화 성공 하드웨어 총 비용: 약 2만~3만 원 수준
W5500의 장점
- 하드웨어 TCP/IP 오프로딩 → ESP32 부하 대폭 감소
- 유선이라 전파 간섭 걱정 없음
- M5Stack에 바로 꽂아 쓰는 M136 모듈로 초보자도 10분 만에 프로토타이핑 가능
필요한 하드웨어
- ESP32-S3 개발보드 (예: ESP32-S3-DevKitC-1 또는 M5Stack Basic)
- W5500 모듈 (추천: M5Stack LAN M136)
- 순간 스위치 1개 → RSTn 핀(GPIO 9)에 연결 (케이블 뽑지 않고 리셋 가능)
- LAN 케이블 + 공유기
- 3.3V 외부 전원 (안정성 위해 권장)
핀 연결 예시 (M5Stack + M136 기준)
- MOSI → GPIO 11
- MISO → GPIO 13
- SCLK → GPIO 12
- CS → GPIO 10
- RSTn → GPIO 9 (스위치 연결)
- 클럭: 25 MHz 추천
소프트웨어 준비
- ESP-IDF v5.x → https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/
- mros2-esp32 깃허브 → git clone --recursive https://github.com/mROS-base/mros2-esp32
- 호스트 PC → Ubuntu + ROS 2 Humble + mros2-host-examples
따라 하기만 하면 되는 전체 과정 (yamati 실전 기록 순서)
- 아이디어 시작 (2024.10.01) → https://x.com/nact25/status/1840855951999713453
- ENC28J60 먼저 실험 → https://x.com/nact25/status/1841064567890123456 (현재 404, v5.3 브랜치 참고)
- Wi-Fi ↔ Ethernet 전환 아이디어 → https://x.com/nact25/status/1841067890123456789 (PR #20)
- 부품 확인 & 대체 키트 검토 → https://x.com/nact25/status/1841071234567890123
- 회로도 & 펄스 트랜스포머 자료 → https://x.com/nact25/status/1842061234567890123 & https://x.com/nact25/status/1842064567890123456
- 빌드 성공 → https://x.com/nact25/status/1843061234567890123
- 첫 번째 W5500 pub 성공! (2024.12.04) → https://x.com/nact25/status/1864141330420781549
- sub도 완벽 성공 (2024.12.05) → https://x.com/nact25/status/1864642037586514399
- 리셋 스위치 추가 & ENC28J60 vs W5500 비교 → https://x.com/nact25/status/1864928905381187916
- 최종 M5Stack+M136 sub 성공 & 이슈 등록 (2025.01.18) → https://x.com/nact25/status/1880595109189951573https://x.com/nact25/status/1880600012083925116https://github.com/mROS-base/mros2-esp32/issues/26 ← 여기서 모든 설정 정리됨!
핵심 코드 (yamati가 실제 사용한 부분)
spi_device_interface_config_t devcfg = {
.spics_io_num = 10,
.clock_speed_hz = 25*1000*1000, // 25 MHz
};
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG();
phy_config.reset_gpio_num = 9; // 리셋 스위치 연결
esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&devcfg, &mac_config);
esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config);
esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy);
esp_eth_driver_install(&config, ð_handle);menuconfig에서 → Component config → LWIP → IPv6 Enable (끄기) → Example Connection Configuration → Ethernet SPI
그 후 idf.py build flash monitor → 호스트에서 ros2 topic echo /chatter만 실행하면 바로 데이터가 들어옵니다!
마무리
yamati님 덕분에 “ESP32 + ROS 2 + 유선 이더넷” 조합이 완전히 검증됐어요. 로봇 대회, 실내 자율주행, 센서 네트워크 등 Wi-Fi가 불안정한 환경이라면 바로 적용 가능합니다. 여러분도 따라 해보고 결과 공유해 주세요! @nact25에게 감사 인사 한 번씩 날려 주시고, W5500으로 멋진 로봇 만들어 보아요
