Wiznet makers

mason

Published December 03, 2025 © MIT license (MIT)

105 UCC

21 WCC

30 VAR

0 Contests

0 Followers

0 Following

Original Link

stm32f103_w5500

Smart Traffic Edge Node with STM32F103 & W5500

COMPONENTS Hardware components

STMicroelectronics - STM32F103RCT6

x 1


WIZnet - W5500

x 1


PROJECT DESCRIPTION

프로젝트 목적 – 스마트 교통을 위한 엣지 컴퓨팅

실시간 교통 모니터링 및 제어
신호등, 교차로, 횡단보도 등의 데이터를 빠르게 수집하고, 로컬에서 바로 제어.

로컬 처리로 지연(Latency) 최소화
모든 데이터를 클라우드로 보내지 않고, 엣지 MCU에서 1차 판단 후 필요한 정보만 상위 시스템으로 전송.

스마트 시티 인프라와 자연스러운 연동
micro-ROS를 통해 ROS 2 기반 중앙 교통 관리 시스템, 클라우드 분석 플랫폼과 쉽게 연동.

원본링크 : https://github.com/narudoltatiyavattanachai/stm32f103_w5500


하드웨어 구성 – STM32F103C8T6 + W5500 이더넷

프로젝트는 다음과 같은 하드웨어 조합을 사용합니다.

MCU
STM32F103C8T6 (72MHz, Cortex-M3)

네트워크
WIZnet W5500 이더넷 컨트롤러 : 하드웨어 TCP/IP 스택 내장으로 MCU 부하 감소

기타 특징
센서(차량 검지, 보행자 감지 등)와의 연동을 전제로 한 IO 구성

Demo_Board.png

이미지 출처 : https://github.com/narudoltatiyavattanachai/stm32f103_w5500


소프트웨어 스택 – FreeRTOS + micro-ROS + W5500

FreeRTOS
태스크 기반 실시간 운영
센서 읽기, 통신, 제어 로직을 태스크로 분리

micro-ROS
리소스 제약 MCU에서 ROS 2 환경에 참여하기 위한 프레임워크
W5500용 커스텀 트랜스포트 계층을 통해 ROS 2 에이전트와 통신

네트워크 스택
정적 IP & DHCP 모두 지원
TCP/UDP 프로토콜을 활용한 통신
“Secure communication channels”를 고려한 구조(추후 TLS 확장에도 참고 가능)

안전성 기능
Watchdog
Fail-safe 메커니즘으로 비정상 동작 시 자동 복구를 지향


시스템 아키텍처 – 중앙 관리와 엣지 노드의 역할 분담

Central Traffic Management (Cloud / Server)
도시 전체의 교통 데이터를 수집·분석
정책/전략 수준의 제어 명령 전송

Edge Router & Local Network
현장(교차로, 구간)에 설치된 여러 엣지 노드들을 묶는 네트워크

Smart Traffic Node (본 프로젝트)
센서(차량/보행자) 입력 수집
STM32F103 + FreeRTOS + micro-ROS에서 로컬 의사결정
W5500 이더넷으로 중앙 시스템과 ROS 2 메시지 교환
이 구조는 “클라우드는 두뇌, 엣지는 반사신경” 같은 역할 분리를 원하는 스마트 시티 아키텍처에 잘 맞습니다.


프로젝트 구조 – STM32Cube 기반 설계

GitHub 저장소는 STM32CubeIDE 프로젝트 구조를 그대로 사용하고 있어, 바로 IDE에 임포트해서 빌드할 수 있습니다.

이미지 출처 : https://github.com/micro-ROS/micro_ros_stm32cubemx_utils


micro-ROS & ROS 2 연동 방법

이 프로젝트의 가장 큰 특징은 micro-ROS를 통해 ROS 2 환경과 직접 통신한다는 점입니다.
호스트 PC에 ROS 2 환경 준비
Ubuntu + ROS 2 (Humble, Foxy 등) 설치
micro-ROS Agent 실행 예시
ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888

STM32 엣지 노드 동작
보드가 부팅되면, 설정된 IP/포트로 micro-ROS Agent에 자동 접속
이후 토픽 Publish/Subscribe, 서비스 호출 등 ROS 2 생태계와 연동 가능
이를 통해 센서 데이터(교통량, 보행자 감지, 이벤트 정보)를 ROS 2 토픽으로 전송하거나,
중앙 시스템으로부터 신호 제어 명령을 수신할 수 있습니다.


왜 스마트 교통 시스템에 ROS2를 사용 했을까?

스마트 교통 인프라를 하나의 ROS 시스템처럼 다루기 위해
– 중앙 서버(클라우드)와 교차로 엣지 노드를 모두 ROS 2 노드로 취급해서 토픽/서비스로 쉽게 연동.

실시간·신뢰성 있는 통신을 쉽게 구현하기 위해
– DDS 기반 QoS 설정(신뢰성, 지연, 히스토리 등)으로 안전 메시지와 로그 데이터를 성격에 맞게 전송 가능.

MCU까지 ROS 2 네트워크에 편입하기 위해
– micro-ROS + FreeRTOS로 STM32F103 같은 소형 MCU도 ROS 2 그래프에 참여하게 만들 수 있음.

확장성과 생태계를 활용하기 위해
– ros2 툴, 시뮬레이션, 데이터 로깅, 다른 로봇·자율주행 시스템과의 통합을 그대로 활용 가능.

 

Project Goal – Edge Computing for Smart Traffic

Real-time traffic monitoring and control
Quickly collect data from traffic lights, intersections, and crosswalks, and perform control actions locally at the edge.

Minimizing latency through local processing
Instead of sending all data to the cloud, the edge MCU makes the first decision and forwards only the necessary information to the upper-level system.

Seamless integration with smart city infrastructure
Using micro-ROS, the node can easily integrate with ROS 2–based central traffic management systems and cloud analytics platforms.

Original link: https://github.com/narudoltatiyavattanachai/stm32f103_w5500


Hardware Configuration – STM32F103C8T6 + W5500 Ethernet

This project uses the following hardware combination:

MCU

STM32F103C8T6 (72 MHz, Cortex-M3)

Network

WIZnet W5500 Ethernet controller:
Built-in hardware TCP/IP stack to offload networking from the MCU

Other Characteristics

I/O layout designed with external sensors in mind
(vehicle detection, pedestrian detection, etc.)

Demo_Board.png

Image source : https://github.com/narudoltatiyavattanachai/stm32f103_w5500


Software Stack – FreeRTOS + micro-ROS + W5500

FreeRTOS

Task-based real-time operation

Separate tasks for sensor reading, communication, and control logic

micro-ROS

Framework that lets resource-constrained MCUs participate in a ROS 2 environment

Communicates with the ROS 2 agent through a custom W5500 transport layer

Network Stack

Supports both static IP and DHCP

Communication over TCP/UDP protocols

Designed with secure communication channels in mind
(can be extended with TLS in the future)

Safety Features

Watchdog

Fail-safe mechanisms aimed at automatic recovery from abnormal states


System Architecture – Role Split Between Central Control and Edge Nodes

Central traffic management system → Edge router → Local network → Smart traffic node

Central Traffic Management (Cloud / Server)

Collects and analyzes traffic data from the entire city

Sends high-level policy and strategy commands

Edge Router & Local Network

Network that connects multiple edge nodes installed at sites such as intersections and road segments

Smart Traffic Node (this project)

Collects sensor inputs (vehicles, pedestrians, etc.)

Performs local decision-making on STM32F103 + FreeRTOS + micro-ROS

Exchanges ROS 2 messages with the central system via the W5500 Ethernet interface

This architecture fits well with smart city designs that treat the cloud as the “brain” and the edge as the “reflex” system.


Project Structure – STM32Cube-Based Design

The GitHub repository follows the STM32CubeIDE project structure,
so you can import it directly into the IDE and build it without additional setup.

Image source : https://github.com/micro-ROS/micro_ros_stm32cubemx_utils


micro-ROS & ROS 2 Integration

The most notable feature of this project is that it communicates directly with a ROS 2 environment via micro-ROS.

Prepare a ROS 2 Environment on the Host PC

Install Ubuntu + ROS 2 (Humble, Foxy, etc.)

Example: Running the micro-ROS Agent

 
ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888

STM32 Edge Node Operation

When the board boots, it automatically connects to the micro-ROS agent using the configured IP and port.

After that, it can integrate with the ROS 2 ecosystem through topic publish/subscribe, service calls, and more.

Through this, the node can:

Publish sensor data (traffic volume, pedestrian detection, event information) to ROS 2 topics

Receive traffic signal control commands from the central system


Why Use ROS 2 for a Smart Traffic System?

Treating the Smart Traffic Infrastructure as One ROS System

Both the central server (cloud) and intersection edge nodes are treated as ROS 2 nodes,
making it easy to connect them via topics and services.

Easy Implementation of Real-Time and Reliable Communication

DDS-based QoS settings (reliability, latency, history, etc.)
allow safety-critical messages and logging data to be transmitted according to their requirements.

Bringing MCUs into the ROS 2 Network

With micro-ROS + FreeRTOS, small MCUs like the STM32F103 can participate directly in the ROS 2 graph.

Leveraging ROS 2 Scalability and Ecosystem

Can fully use ros2 tools, simulations, data logging, and integration with other robots
or autonomous driving systems without reinventing the wheel.

 

Documents
  • Github Code

Comments Write