---
title: "WIZ200WEB_Project_Mqtt"
url: "https://maker.wiznet.io/irina/projects/wiz200web-project-mqtt/"
markdown_url: "https://maker.wiznet.io/irina/projects/wiz200web-project-mqtt/md"
type: "UCC: User Created Content"
author: "Nestor-kolela"
author_url: "https://github.com/Nestor-kolela/WIZ200WEB_Project_Mqtt"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Nestor-kolela"
original_url: "https://github.com/Nestor-kolela/WIZ200WEB_Project_Mqtt"
published: "2026-03-13"
language: "en"
likes: 0
views: 573
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# WIZ200WEB_Project_Mqtt

> WIZ200WEB MQTT: Upgrading classic ATmega128+W5300 firmware from a legacy HTTP web server to a modern, high-performance MQTT IIoT client for stable connectivity

Original author: Nestor-kolela (source: https://github.com/Nestor-kolela/WIZ200WEB_Project_Mqtt)

## Article

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

## 1. 개요 (Summary)

본 프로젝트는 WIZnet의 고전적인 WIZ200WEB 보드를 현대적인 MQTT 기반 IIoT(산업용 사물인터넷) 클라이언트로 탈바꿈시키는 작업입니다. 8비트 MCU인 ATmega128 환경에서 WIZnet W5300의 하드웨어 TCP/IP 스택을 활용하여, 클라우드 브로커와 안정적으로 데이터를 주고받도록 설계되었습니다. 단순한 웹 서버 구조를 탈피하여 능동적인 IoT 노드로 전환하는 것이 핵심입니다.

## 2. 프로젝트의 역할 및 동작 (What the Project Does)

기존 WIZ200WEB의 수동적인 HTTP 웹 서버 펌웨어를 능동적인 MQTT 클라이언트 구조로 재설계했습니다.

### 핵심 변화 포인트

- 기존 방식 (HTTP Server): 사용자의 요청이 올 때까지 기다리는 구조이며, 상태 확인을 위해 지속적인 폴링(Polling)이 필요합니다.

- 변경 방식 (MQTT Client): 장치가 브로커에 능동적으로 접속하여 데이터를 **Publish(게시)**하고 제어 명령을 **Subscribe(구독)**합니다.

### 데이터 흐름

- 데이터 생성: ATmega128이 센서 값이나 장치 상태 정보를 생성합니다.

- 게시 (Publish): MQTT 클라이언트가 이 데이터를 이더넷을 통해 브로커로 전송합니다.

- 수신: 클라우드나 대시보드에서 실시간으로 데이터를 수신합니다.

- 제어 (Subscribe): 사용자의 명령이 브로커를 통해 다시 장치로 전달되어 실시간 제어가 이루어집니다.

### 주요 차이점 비교

| **비교 항목** | **WIZnet 순정 펌웨어** | **Nestor-kolela 프로젝트 (MQTT)** |
| --- | --- | --- |
| 핵심 프로토콜 | HTTP (웹 서버) | MQTT (IoT 메시징) |
| 주요 용도 | 브라우저로 접속해 기기 상태 확인 및 제어 | 브로커(Broker)와 연결하여 센서 데이터 전송 및 원격 제어 |
| UI/UX | 웹 페이지(HTML/CSS) 제공 | UI 없음 (데이터 중심의 백엔드 통신) |
| 네트워크 역할 | 웹 서버 (Server) | MQTT 클라이언트 (Client) |
| 통신 방식 | 요청이 올 때 응답 (Request-Response) | 실시간 게시 및 구독 (Publish-Subscribe) |

## 3. 왜 WIZnet W5300인가? (Where WIZnet Fits)

이 프로젝트의 안정성은 WIZnet W5300 이더넷 컨트롤러에 의존합니다.

- 하드웨어 TCP/IP 스택: 리소스가 극히 제한적인 8비트 ATmega128의 네트워크 처리 부담을 완전히 제거합니다.

- 지속적 연결 유지: MQTT는 세션을 유지하는 'Keep-alive'가 필수적인데, W5300은 하드웨어 소켓을 통해 이를 견고하게 관리합니다.

- 고속 처리: 병렬 버스 인터페이스를 사용하여 SPI 방식보다 높은 데이터 처리량을 보장하며, 산업 환경의 노이즈 속에서도 안정적인 통신을 제공합니다.

---

## 4. 구현 및 코드 하이라이트 (Implementation Notes)

본 프로젝트는 W5300을 통해 TCP 소켓을 생성하고 그 위에서 MQTT 프로토콜 패킷을 처리합니다.

구현 로직 흐름:

```plaintext
socket(): MQTT 표준 포트(1883)를 사용하는 TCP 소켓 생성

connect(): 지정된 MQTT 브로커 IP로 연결 수행

MQTT Packet Process: CONNECT, PUBLISH, SUBSCRIBE 패킷 처리 루틴 실행
```

이 구조 덕분에 MCU는 복잡한 네트워크 하부 계층 처리에 신경 쓰지 않고, 오직 MQTT 메시지 처리에만 집중할 수 있습니다.

## 5. 실무 팁 및 주의사항 (Practical Tips / Pitfalls)

실제 현장에 적용할 때 고려해야 할 핵심 사항들입니다.

- 연결 감지: Keep-alive 설정을 너무 길게 잡으면 네트워크 단절 감지가 늦어질 수 있으니 적절한 값(예: 60초)을 설정하세요.

- 상태 확인: W5300의 소켓 상태 레지스터를 주기적으로 모니터링하여 예기치 못한 연결 종료에 대비해야 합니다.

- 메모리 관리: 8비트 MCU의 SRAM 용량을 고려하여 MQTT 메시지 버퍼 크기를 최적화하세요.

- 재연결 로직: 일시적인 네트워크 장애 후 자동으로 브로커에 다시 붙는 Auto-reconnect 로직은 필수입니다.

## 6. FAQ

Q: 왜 W5300을 고집하나요?

A: ATmega128 같은 저사양 MCU에서 소프트웨어로 TCP/IP와 MQTT를 동시에 돌리면 시스템이 매우 불안정해집니다. W5300은 이 짐을 대신 져주는 최적의 파트너입니다.

Q: HTTP보다 MQTT가 좋은 점은?

A: 오버헤드가 매우 적어 데이터 사용량이 낮고, 무엇보다 서버가 클라이언트에 명령을 즉시 내릴 수 있는 실시간성이 압도적입니다.

Q: 초보자도 할 수 있을까요?

A: C언어와 AVR 개발 경험이 있는 중급 개발자에게 적합한 프로젝트입니다.

---

### 1. Project Introduction (Summary)

This project is a transformative effort to repurpose WIZnet's classic WIZ200WEB board into a modern MQTT-based Industrial IoT (IIoT) client. Built around the 8-bit ATmega128 microcontroller, it utilizes the hardware TCP/IP stack of the WIZnet W5300 to ensure stable, high-performance data exchange with a cloud broker. The core objective is to move away from a simple, passive web server architecture to a modern, active IoT node.

### 2. What the Project Does (Architecture & Operation)

The existing, passive HTTP web server firmware of the WIZ200WEB has been completely redesigned into an active MQTT client architecture.

#### Key Paradigm Shift

- Legacy Approach (HTTP Server): A structure that waits for a user's request, requiring continuous Polling from the client side to check the device status.

- New Approach (MQTT Client): The device actively connects to a Broker, Publishes (broadcasts) its data, and Subscribes (listens) for control commands.

#### Data Flow

- Data Generation: The ATmega128 microcontroller generates sensor values or device status information.

- Publish: The MQTT client transmits this data via Ethernet (W5300) to the designated Broker.

- Reception: External systems, such as a cloud dashboard or an app, receive this data in real-time.

- Subscribe: User control commands are sent back through the Broker to the device via MQTT Subscription, enabling immediate, real-time control.

#### Comparison of Key Differences

| **Comparison Item** | **Original WIZnet Firmware** | **Nestor-kolela Project (MQTT)** |
| --- | --- | --- |
| Core Protocol | HTTP (Web Server) | MQTT (IoT Messaging) |
| Primary Use Case | Access via browser to check device status and control | Connect to Broker to transmit sensor data and for remote control |
| UI/UX | Provides Web Page (HTML/CSS) | No UI (Data-centric backend communication) |
| Network Role | Web Server (Passive) | MQTT Client (Active) |
| Communication Style | Respond when requested (Request-Response) | Real-time Publish and Subscribe (Pub-Sub) |

### 3. Why WIZnet W5300? (Where WIZnet Fits)

The stability of this entire project hinges on the capabilities of the WIZnet W5300 Ethernet controller.

- Hardware TCP/IP Stack: It completely eliminates the network processing burden from the 8-bit ATmega128, whose resources are extremely limited.

- Persistent Connection Management: MQTT requires maintaining a session ('Keep-alive'). The W5300 manages this session robustly through its hardware-based sockets.

- High-Speed Processing: Utilizing a parallel bus interface ensures much higher data throughput than SPI-based alternatives, providing stable communication even in electronically noisy industrial environments.

### 4. Implementation and Code Highlights (Implementation Notes)

The project creates a TCP socket via the W5300 and processes the MQTT protocol packets layered above it.

Implementation Logic Flow:

```plaintext
socket(): Create a TCP socket using the standard MQTT port (1883).

connect(): Perform a connection attempt to the specified MQTT broker's IP address.

MQTT Packet Process: Execute routines to process standard packets like CONNECT, PUBLISH, and SUBSCRIBE.
```

Thanks to this hardware-offloaded architecture, the MCU does not need to manage complex lower-layer network handling and can focus exclusively on MQTT message processing logic.

### 5. Practical Tips and Pitfalls (Practical Tips / Pitfalls)

Here are key considerations when applying this solution in a real-world, industrial field scenario.

- Connection Detection: Setting the Keep-alive interval too long will delay the detection of a network disconnection. We recommend a balanced value (e.g., 60 seconds).

- Status Check: You must periodically monitor the W5300’s socket status register to detect and respond to unexpected connection terminations.

- Memory Management: Always optimize your MQTT message buffer sizes to fit within the limited SRAM capacity of the 8-bit MCU.

- Reconnection Logic: Implementing a robust Auto-reconnect logic is mandatory; the device must automatically reconnect to the Broker after temporary network outages.

### 6. FAQ

Q: Why insist on using the W5300?

A: Running both a software TCP/IP stack and an MQTT client simultaneously on a low-resource MCU like the ATmega128 would make the system highly unstable. The W5300 is the ideal partner to offload this heavy burden.

Q: What makes MQTT better than HTTP?

A: It has extremely low overhead, resulting in low data usage. Most importantly, it offers superior real-time performance, allowing the server to push commands to the client immediately.

Q: Can a beginner implement this?

A: This project is best suited for intermediate developers with experience in the C language and AVR development.

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

---

Source: https://maker.wiznet.io/irina/projects/wiz200web-project-mqtt/
