---
title: "stm32f103_w5500"
url: "https://maker.wiznet.io/mason/projects/stm32f103-w5500-1/"
markdown_url: "https://maker.wiznet.io/mason/projects/stm32f103-w5500-1/md"
type: "UCC: User Created Content"
author: "amidg"
author_url: "https://github.com/narudoltatiyavattanachai/stm32f103_w5500"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "amidg"
original_url: "https://github.com/narudoltatiyavattanachai/stm32f103_w5500"
license: "MIT license (MIT)"
published: "2025-12-03"
language: "en"
tags: ["STM32", "W5500"]
hardware: ["STMicroelectronics STM32F103RCT6", "WIZnet W5500"]
likes: 0
views: 2472
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# stm32f103_w5500

> Smart Traffic Edge Node with STM32F103 & W5500

Original author: amidg (source: https://github.com/narudoltatiyavattanachai/stm32f103_w5500)

## Components

- **STMicroelectronics STM32F103RCT6** x 1 ([docs](https://estore.st.com/en/stm32f103rct6-cpn.html))
- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Documents and links

- [Github Code](https://github.com/narudoltatiyavattanachai/stm32f103_w5500) (code)

## Article

## 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](https://github.com/narudoltatiyavattanachai/stm32f103_w5500?utm_source=chatgpt.com)

---

## 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](https://github.com/narudoltatiyavattanachai/stm32f103_w5500/blob/main/docs/pics/Demo_Board.png?raw=true)

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
>
> ![](https://maker.wiznet.io/upload/ckeditor5/1066383715%5F1764863762%2Epng)

### 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.

![](https://maker.wiznet.io/upload/ckeditor5/1066383715%5F1764863684%2Epng)

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.

---

Source: https://maker.wiznet.io/mason/projects/stm32f103-w5500-1/
