Wiznet makers

josephsr

Published July 12, 2026 ©

137 UCC

13 WCC

13 VAR

0 Contests

0 Followers

0 Following

Original Link

STM32H743 micro-ROS IMU Node over W5500 Ethernet

A PlatformIO-based STM32H743 IMU node publishes micro-ROS data over UDP through a W5500 hardware Ethernet socket path.

COMPONENTS
PROJECT DESCRIPTION

Project Overview

microros-h7-pio is an embedded robotics reference implementation that connects an STM32H743-based sensor node to a ROS 2 system through wired Ethernet. The firmware samples inertial and magnetic sensors, calculates orientation data, and publishes the results as micro-ROS topics through a W5500 Ethernet controller. The repository targets ROS 2 Humble and uses PlatformIO with the Arduino framework.

ItemImplementation
Project TypeEmbedded micro-ROS IMU and orientation sensor node
Main MCUSTM32H743, configured as devebox_h743vitx
Build EnvironmentPlatformIO, STM32 Arduino framework
ROS EnvironmentROS 2 Humble with micro_ros_platformio
Ethernet ControllerWIZnet W5500
Network ProtocolUDP over IPv4 and wired Ethernet
SensorsMPU6050 inertial sensor and QMC5883L magnetometer
ROS 2 Topics/imu/data, /imu/euler
Agent EndpointConfigured as UDP port 8888
Host-Side Toolsmicro-ROS Agent, rqt_plot, RViz2, and PyQtGraph-based visualization

The active PlatformIO environment enables W5500_USE_SPI2, ROS_DISTRO_HUMBLE, and UROS_TRANSPORT_NATIVE_ETHERNET. Its source filter selects main.cpp, while separate IMU and Ethernet validation sources remain auxiliary implementations rather than part of the default firmware build.

Hardware and Software Structure

Hardware Components

  • STM32H743 MCU
    Executes sensor acquisition, calibration, attitude estimation, micro-ROS publishing, and Ethernet transport control.
  • MPU6050
    Supplies three-axis acceleration and angular velocity data through I²C. The driver configures the accelerometer for ±8 g and the gyroscope for ±2000 degrees per second. 
  • QMC5883L
    Supplies three-axis magnetic-field data through a separate I²C interface. The source includes hard-iron offsets and a calibration matrix. 
  • WIZnet W5500
    Connects to the STM32H743 through SPI and provides the wired Ethernet and hardware TCP/IP socket interface. The W5500 integrates Ethernet MAC/PHY, a hardwired TCP/IP stack, eight hardware sockets, and internal packet memory. 

Software Components

LayerFunction
Sensor DriversMPU6050 and QMC5883L acquisition and calibration
Orientation ProcessingMahony AHRS quaternion and Euler-angle calculation
ROS Client Layerrcl, rclc, and generated ROS 2 message types
micro-ROS TransportCustom/native W5500 Ethernet UDP transport
Ethernet LibraryArduino Ethernet and EthernetUDP
Hardware Network LayerW5500 hardware UDP/IPv4 socket
ROS 2 Host Layermicro-ROS Agent and visualization nodes

The firmware uses the standard sensor_msgs/msg/Imu message for quaternion, angular velocity, and linear acceleration. A custom ImuInfo message carries roll, pitch, and yaw values in radians.

System Architecture

 
MPU6050                         QMC5883L
Acceleration / Gyroscope        Magnetic Field
          │                           │
          └────────── I²C ────────────┘
                      │
              STM32H743 Firmware
        ┌───────────────────────────────┐
        │ Sensor acquisition            │
        │ Offset and matrix calibration │
        │ Mahony AHRS processing        │
        │ Quaternion / Euler conversion │
        │ rclc publishers               │
        └───────────────────────────────┘
                      │
                     SPI
                      │
               WIZnet W5500
        Hardware UDP / IPv4 socket
                      │
              Wired Ethernet LAN
                      │
       micro-ROS Agent: UDP4 port 8888
                      │
                ROS 2 Graph
            ┌─────────┴──────────┐
            │                    │
       /imu/data            /imu/euler
            │                    │
      RViz2 / rqt_plot / PyQtGraph tools
 

This path is implemented by initializing the Arduino Ethernet layer with a static MAC and IPv4 address, configuring the micro-ROS W5500 UDP transport, creating an rclc node, and registering two publishers with a periodic executor timer.

Operation Flow

  1. Peripheral initialization
    The firmware starts the serial interface, MPU6050, QMC5883L, and I²C buses.
  2. Ethernet initialization
    The W5500 chip-select pin and static network parameters are configured through the Arduino Ethernet library.
  3. micro-ROS transport registration
    set_microros_w5500_ethernet_udp_transports() connects the micro-ROS client transport to the W5500 UDP implementation.
  4. ROS entity creation
    The firmware creates the imu_ethernet_node, the /imu/data publisher, the /imu/euler publisher, and an executor timer.
  5. Periodic sensor processing
    The timer callback reads the sensors, applies calibration, updates the AHRS state, and generates quaternion, Euler-angle, angular-velocity, and linear-acceleration values.
  6. Topic publication
    The generated messages are transmitted through UDP to the micro-ROS Agent.
  7. ROS 2 integration
    The Agent exposes the embedded publishers to the ROS 2 graph, where RViz2, rqt_plot, or the included PyQtGraph node can consume the data. 

The timer period is configured to 20 ms, corresponding to a nominal 50 Hz update rate. The repository does not provide measured end-to-end timing or packet-loss results.

WIZnet Product and Network Assessment

Assessment ItemResult
WIZnet ProductW5500 Ethernet Controller
Product UsageConfirmed in source code and PlatformIO configuration
System RoleSPI-based wired Ethernet interface and hardware UDP/IPv4 socket provider
Communication PathSTM32H743 → SPI → W5500 → Ethernet → micro-ROS Agent
Transport Typemicro-ROS custom/native Ethernet transport using UDP
Direct Register ControlNot implemented directly in the application source
Framework Pathmicro-ROS transport → EthernetUDP → Arduino Ethernet driver → W5500 sockets

The repository does not implement an MCU-side software TCP/IP stack such as lwIP for this transport. Instead, EthernetUDP opens and operates the W5500 socket through the Arduino Ethernet driver.

TOE Usage

TOE Usage: Yes

The project uses the W5500 hardwired TCP/IP and hardware socket architecture for UDP communication. TOE functionality is therefore used at the W5500 hardware level.

The application does not manipulate the W5500 socket registers directly. Access is mediated through the following software path:

 
micro-ROS publisher
    → W5500 Ethernet UDP transport
    → Arduino EthernetUDP
    → Arduino Ethernet W5500 driver
    → W5500 hardware UDP socket
 

This is a library-mediated TOE implementation, not a direct socket-register implementation and not an lwIP-based MACRAW implementation.

Hybrid Network Assessment

Hybrid Network: No

The active firmware uses wired Ethernet through the W5500. No Wi-Fi interface, wireless network dependency, or simultaneous wired/wireless routing path is present in the active PlatformIO environment or main.cpp.

The serial interface is used for debugging and status output and does not constitute a second network path. Therefore, the repository does not implement a Hybrid Network architecture.

Technical Strengths

  • Deterministic wired transport foundation
    The W5500 separates hardware socket and packet-buffer processing from the STM32 application.
  • Direct ROS 2 interoperability
    Standard sensor_msgs/Imu data can be consumed by existing ROS 2 tools and nodes.
  • Clearly separated processing stages
    Sensor acquisition, AHRS processing, ROS publication, and network transport are identifiable in the source structure.
  • Independent Ethernet validation source
    main_ethernet_test.cpp configures SPI2 and runs a basic W5500 TCP server, allowing Ethernet bring-up to be tested separately from micro-ROS. It is not selected by the default source filter. 
  • Host visualization support
    The repository includes a ROS 2 Python subscriber using PyQtGraph and an additional visualization package under imu_ws

Limitations

  • Hard-coded network configuration
    The MAC address, device IP address, Agent IP address, and UDP port are defined in source code. Deployment to another network requires modification or rebuilding. 
  • Hardware-specific calibration values
    MPU6050 offsets and QMC5883L hard-iron and matrix calibration values are embedded in the firmware. These values are not generally transferable to another assembled unit. 
  • Magnetometer integration requires review
    Code-level inference: use_mag is defined as true, but the active conditional expression selects MahonyAHRSupdateIMU(), which excludes magnetometer input. The QMC5883L is read and calibrated, but its values appear not to enter the active AHRS branch under the current definition. 
  • No published network-performance validation
    Repository documentation does not provide measured latency, jitter, packet-loss behavior, maximum publishing rate, or long-duration stability results.
  • Prototype-oriented failure handling
    Several initialization failures stop execution in an infinite loop rather than providing recovery, reconnection, or degraded-operation logic. 

Application Value

This repository provides a practical starting point for:

  • Wired IMU nodes for mobile robots and autonomous platforms
  • Distributed ROS 2 sensor modules
  • Ethernet-connected attitude and motion monitoring
  • micro-ROS transport development on high-performance STM32 devices
  • W5500-based replacement of serial micro-ROS links
  • Sensor nodes operating in environments where Wi-Fi reliability or radio use is undesirable

The implementation is most valuable as an integration reference combining STM32H7, sensor fusion, micro-ROS, and a W5500 hardware Ethernet path. Production deployment would require configurable network provisioning, calibration procedures, transport recovery, and measured real-time performance.

Author Information

Luthfi Harwidjaya (harwHarw03)

The GitHub profile describes the author as an embedded developer and system engineer and lists an affiliation with 株式会社ナレッジクリエーションテクノロジー.


W5500 Ethernet 기반 STM32H743 micro-ROS IMU 노드

프로젝트 개요

microros-h7-pio는 STM32H743 기반 센서 노드를 유선 Ethernet으로 ROS 2 환경에 연결하는 임베디드 로보틱스 참조 구현이다. 펌웨어는 관성·지자기 센서 데이터를 취득하고 자세 정보를 계산한 뒤, W5500 Ethernet Controller를 통해 micro-ROS 토픽으로 발행한다. 개발 환경은 PlatformIO와 Arduino Framework이며 ROS 2 Humble을 대상으로 한다.

구분구현 내용
프로젝트 유형임베디드 micro-ROS IMU·자세 센서 노드
메인 MCUSTM32H743, devebox_h743vitx 보드 설정
빌드 환경PlatformIO, STM32 Arduino Framework
ROS 환경ROS 2 Humble, micro_ros_platformio
Ethernet ControllerWIZnet W5500
네트워크 프로토콜유선 Ethernet 기반 UDP/IPv4
센서MPU6050 관성 센서, QMC5883L 지자기 센서
ROS 2 토픽/imu/data, /imu/euler
Agent 연결UDP 포트 8888
호스트 도구micro-ROS Agent, rqt_plot, RViz2, PyQtGraph 시각화

활성 PlatformIO 환경에는 W5500_USE_SPI2, ROS_DISTRO_HUMBLE, UROS_TRANSPORT_NATIVE_ETHERNET 빌드 옵션이 설정되어 있다. 기본 소스 필터는 main.cpp를 선택하며, 별도의 IMU·Ethernet 테스트 소스는 기본 펌웨어에 포함되지 않는 보조 구현이다.

하드웨어 및 소프트웨어 구성

하드웨어 구성

  • STM32H743 MCU
    센서 데이터 취득, 보정, 자세 계산, micro-ROS 메시지 발행, Ethernet 전송 제어를 수행한다.
  • MPU6050
    I²C를 통해 3축 가속도와 각속도를 제공한다. 드라이버는 가속도 범위를 ±8 g, 자이로스코프 범위를 ±2000°/s로 설정한다. 
  • QMC5883L
    별도의 I²C 인터페이스를 통해 3축 자기장 데이터를 제공한다. 소스에는 hard-iron offset과 보정 행렬이 포함되어 있다. 
  • WIZnet W5500
    STM32H743과 SPI로 연결되며 유선 Ethernet과 하드웨어 TCP/IP 소켓 기능을 제공한다. W5500에는 Ethernet MAC/PHY, 하드웨어 TCP/IP 스택, 8개 하드웨어 소켓과 내부 패킷 메모리가 통합되어 있다. 

소프트웨어 구성

계층기능
센서 드라이버MPU6050·QMC5883L 데이터 취득 및 보정
자세 계산Mahony AHRS 기반 Quaternion·Euler angle 계산
ROS Clientrcl, rclc, ROS 2 메시지 타입
micro-ROS TransportW5500 전용 Native Ethernet UDP Transport
Ethernet LibraryArduino Ethernet 및 EthernetUDP
하드웨어 네트워크W5500 하드웨어 UDP/IPv4 소켓
ROS 2 호스트micro-ROS Agent 및 시각화 노드

표준 sensor_msgs/msg/Imu 메시지에는 Quaternion, 각속도, 선형 가속도가 저장된다. 별도의 사용자 정의 ImuInfo 메시지는 radian 단위의 roll, pitch, yaw 값을 전달한다.

시스템 구조

 
MPU6050                         QMC5883L
가속도 / 각속도                 자기장
          │                       │
          └──────── I²C ──────────┘
                    │
             STM32H743 펌웨어
      ┌──────────────────────────────┐
      │ 센서 데이터 취득             │
      │ Offset·행렬 보정             │
      │ Mahony AHRS 자세 계산        │
      │ Quaternion·Euler angle 변환  │
      │ rclc Publisher               │
      └──────────────────────────────┘
                    │
                   SPI
                    │
              WIZnet W5500
         하드웨어 UDP / IPv4 소켓
                    │
              유선 Ethernet
                    │
     micro-ROS Agent: UDP4 포트 8888
                    │
                ROS 2 Graph
          ┌─────────┴─────────┐
          │                   │
     /imu/data           /imu/euler
          │                   │
    RViz2 / rqt_plot / PyQtGraph
 

펌웨어는 Arduino Ethernet 계층에 고정 MAC·IPv4 주소를 설정하고, micro-ROS W5500 UDP Transport를 등록한 다음 rclc 노드와 두 개의 Publisher, 주기 실행 Timer를 생성한다.

동작 흐름

  1. 주변장치 초기화
    Serial, MPU6050, QMC5883L 및 I²C 인터페이스를 초기화한다.
  2. Ethernet 초기화
    W5500 Chip Select 핀과 고정 네트워크 정보를 Arduino Ethernet Library에 설정한다.
  3. micro-ROS Transport 등록
    set_microros_w5500_ethernet_udp_transports()를 호출하여 micro-ROS Client Transport를 W5500 UDP 구현과 연결한다.
  4. ROS Entity 생성
    imu_ethernet_node, /imu/data Publisher, /imu/euler Publisher와 Executor Timer를 생성한다.
  5. 센서 데이터 처리
    Timer Callback에서 센서를 읽고 보정한 뒤 AHRS 상태를 갱신한다. 이후 Quaternion, Euler angle, 각속도, 선형 가속도 값을 구성한다.
  6. 토픽 발행
    생성된 메시지는 UDP를 통해 micro-ROS Agent로 전송된다.
  7. ROS 2 연동
    Agent가 임베디드 Publisher를 ROS 2 Graph에 노출하며, RViz2, rqt_plot, 포함된 PyQtGraph 노드 등이 데이터를 구독한다. 

Timer 주기는 20 ms로 설정되어 있어 명목상 50 Hz 갱신 주기를 갖는다. 실제 종단 간 지연이나 패킷 손실 측정 결과는 저장소에 제시되어 있지 않다.

WIZnet 제품 및 네트워크 판단

판단 항목결과
WIZnet 제품W5500 Ethernet Controller
제품 사용 여부소스 코드와 PlatformIO 설정에서 확인됨
시스템 내 역할SPI 기반 유선 Ethernet 인터페이스 및 하드웨어 UDP/IPv4 소켓 제공
통신 경로STM32H743 → SPI → W5500 → Ethernet → micro-ROS Agent
Transport 유형UDP 기반 micro-ROS Custom/Native Ethernet Transport
직접 Register 제어애플리케이션 소스에서는 직접 구현하지 않음
Framework 경로micro-ROS Transport → EthernetUDP → Arduino Ethernet Driver → W5500 Socket

이 전송 경로에는 MCU에서 실행되는 lwIP 같은 소프트웨어 TCP/IP 스택이 사용되지 않는다. EthernetUDP가 Arduino Ethernet Driver를 통해 W5500 하드웨어 소켓을 열고 송수신을 수행한다.

TOE 사용 여부

TOE 사용: 해당됨

이 프로젝트는 UDP 통신에 W5500의 Hardwired TCP/IP Stack과 하드웨어 Socket 구조를 사용한다. 따라서 W5500 하드웨어 계층에서 TOE 기능이 적용된다.

애플리케이션이 W5500 Socket Register를 직접 제어하지는 않으며, 다음 계층을 거쳐 접근한다.

 
micro-ROS Publisher
    → W5500 Ethernet UDP Transport
    → Arduino EthernetUDP
    → Arduino Ethernet W5500 Driver
    → W5500 하드웨어 UDP Socket
 

분류상 Library 경유 TOE 구현에 해당한다. W5500 Socket Register 직접 제어 방식이나 lwIP 기반 MACRAW 방식은 아니다.

Hybrid Network 여부

Hybrid Network: 해당 없음

활성 펌웨어의 네트워크 경로는 W5500을 사용하는 유선 Ethernet 하나이다. PlatformIO 환경과 main.cpp에는 Wi-Fi 인터페이스, 무선 네트워크 라이브러리, 유무선 동시 통신 또는 경로 전환 구현이 없다.

Serial 인터페이스는 디버깅과 상태 출력에 사용되며 두 번째 네트워크 경로로 분류되지 않는다. 따라서 이 저장소는 Hybrid Network 구조를 구현하지 않는다.

장점

  • 하드웨어 Socket 기반 유선 전송
    W5500이 TCP/IP Socket과 패킷 버퍼 처리를 담당하여 STM32 애플리케이션의 네트워크 처리 부담을 분리한다.
  • 기존 ROS 2 생태계와의 호환성
    표준 sensor_msgs/Imu 메시지를 사용하므로 기존 ROS 2 노드와 도구에서 직접 구독할 수 있다.
  • 처리 계층이 명확한 구조
    센서 취득, 자세 계산, ROS 메시지 발행, 네트워크 전송 단계가 소스 구조에서 구분된다.
  • 독립적인 Ethernet 검증 코드
    main_ethernet_test.cpp는 SPI2와 W5500을 설정하고 간단한 TCP Server를 실행한다. micro-ROS를 제외하고 Ethernet Bring-up을 검증할 수 있지만 기본 소스 필터에는 포함되지 않는다. 
  • 호스트 시각화 기능 제공
    PyQtGraph 기반 ROS 2 Subscriber와 imu_ws 내부 시각화 패키지가 포함되어 있다. 

한계

  • 고정된 네트워크 설정
    MAC 주소, 장치 IP, Agent IP와 UDP 포트가 소스에 직접 정의되어 있다. 다른 네트워크에 배치하려면 소스 수정 또는 재빌드가 필요하다. 
  • 장치별 센서 보정값 사용
    MPU6050 Offset과 QMC5883L의 hard-iron offset·보정 행렬이 펌웨어에 고정되어 있다. 다른 조립 장치에 동일한 값을 그대로 적용하기 어렵다. 
  • 지자기 센서의 AHRS 반영 경로 검토 필요
    코드상 추론: use_magtrue로 정의되어 있지만 조건식에서는 Magnetometer 입력을 사용하지 않는 MahonyAHRSupdateIMU()가 선택된다. QMC5883L 데이터는 읽고 보정하지만 현재 조건에서는 AHRS 계산에 전달되지 않는 것으로 해석된다. 
  • 네트워크 성능 검증 자료 부재
    지연, Jitter, 패킷 손실, 최대 발행 주기, 장시간 안정성에 대한 측정 결과는 저장소 내 명시 없음.
  • Prototype 중심의 오류 처리
    일부 초기화 실패는 복구·재접속 절차 없이 무한 루프로 실행을 정지한다. 

적용 가치

이 프로젝트는 다음 구현의 기초 자료로 활용할 수 있다.

  • 이동 로봇 및 자율 시스템용 유선 IMU 노드
  • 분산형 ROS 2 센서 모듈
  • Ethernet 기반 자세·동작 모니터링 장치
  • STM32H7용 micro-ROS Transport 개발
  • Serial micro-ROS 연결을 W5500 유선망으로 전환하는 구현
  • Wi-Fi 신뢰성이 낮거나 무선 통신이 제한된 환경의 센서 노드

STM32H7, 센서 융합, micro-ROS, W5500 하드웨어 Ethernet 경로를 하나의 펌웨어에서 결합했다는 점에서 통합 참조 가치가 있다. 실제 제품 적용에는 네트워크 설정 기능, 장치별 Calibration 절차, 연결 복구 로직과 실시간 성능 검증이 추가로 필요하다.

저자 정보

Luthfi Harwidjaya (harwHarw03)

GitHub 프로필에는 Embedded Developer 및 System Engineer로 소개되어 있으며, 소속 정보로 株式会社ナレッジクリエーションテクノロジー가 기재되어 있다.

Documents
  • microros-h7-pio

Comments Write