How to Connect MIoTKit Devices to an EMQX MQTT Broker with TLS Using W5500 Ethernet?
This project demonstrates how an embedded device connects to an EMQX MQTT broker using the MIoTKit framework with a WIZnet W5500 Ethernet controller.
How to Connect MIoTKit Devices to an EMQX MQTT Broker with TLS Using W5500 Ethernet?
Summary
EN
This project demonstrates how an embedded device connects to an EMQX MQTT broker using the MIoTKit framework with a WIZnet W5500 Ethernet controller. The W5500 provides the wired TCP/IP networking interface, while MIoTKit manages MQTT communication and TLS authentication. This architecture enables secure Industrial IoT connectivity where devices reliably transmit data to an MQTT platform using wired Ethernet.
KR
이 프로젝트는 WIZnet W5500 이더넷 컨트롤러와 MIoTKit 프레임워크를 사용하여 임베디드 장치를 EMQX MQTT 브로커에 TLS 보안 연결로 접속하는 방법을 설명합니다. W5500은 유선 TCP/IP 네트워크 인터페이스를 제공하고, MIoTKit은 MQTT 메시징과 TLS 인증을 처리합니다. 이 구조는 안정적인 유선 네트워크 기반의 산업용 IoT 통신에 적합합니다.
What the Project Does
EN
The video explains how an embedded IoT device connects securely to an EMQX MQTT broker using MIoTKit and Ethernet networking.
The system architecture consists of three main layers.
Device Layer
Microcontroller-based IoT device
WIZnet W5500 Ethernet controller
Sensors or industrial device inputs
Firmware using MIoTKit SDK
Network Layer
Wired Ethernet communication
TCP/IP stack handled by the W5500 hardware
Local network router or gateway
Cloud / Server Layer
EMQX MQTT platform
MQTT over TLS for secure communication
Message routing and device management
The device workflow typically follows these steps:
The MCU initializes the W5500 Ethernet controller.
The network interface obtains an IP address via DHCP or static configuration.
The MIoTKit framework loads MQTT and TLS configuration.
The device establishes a secure MQTT connection (MQTTS) to the EMQX broker.
Sensor telemetry is published to MQTT topics while control commands are received from subscribed topics.
This architecture is commonly used in Industrial IoT gateways, remote monitoring systems, and secure device telemetry platforms.
Where WIZnet Fits
EN
The WIZnet W5500 Ethernet controller provides the network transport layer for the system.
Its role includes:
Handling hardware TCP/IP communication
Providing stable wired Ethernet connectivity
Managing multiple simultaneous socket connections
Offloading network processing from the microcontroller
Because the W5500 includes a hardware TCP/IP offload engine, the microcontroller does not need to run a full TCP/IP software stack such as LwIP. This reduces CPU load and memory usage, making the system more efficient and stable for long-running MQTT connections.
For Industrial IoT systems that must maintain secure TLS-based MQTT sessions, this hardware offload approach simplifies firmware design while improving reliability.
KR
WIZnet W5500 이더넷 컨트롤러는 시스템에서 네트워크 전송 계층 역할을 수행합니다.
주요 기능은 다음과 같습니다.
TCP/IP 통신을 하드웨어에서 처리
안정적인 유선 Ethernet 연결 제공
여러 네트워크 소켓 관리
MCU의 네트워크 처리 부하 감소
W5500은 하드웨어 TCP/IP 오프로딩 엔진을 포함하고 있기 때문에 MCU에서 LwIP와 같은 소프트웨어 네트워크 스택을 실행할 필요가 없습니다. 이로 인해 CPU 사용량과 메모리 요구량이 감소하며 장시간 MQTT 연결을 안정적으로 유지할 수 있습니다.
이러한 구조는 TLS 기반 보안 MQTT 연결이 필요한 산업용 IoT 환경에 적합합니다.
Implementation Notes
The video focuses on explaining the MIoTKit architecture and MQTT + TLS integration with EMQX, but the full firmware repository was not available for verification. The following example illustrates a conceptual integration approach based on the WIZnet ioLibrary.
Conceptual integration example based on WIZnet ioLibrary
// Register SPI communication callbacks
reg_wizchip_spi_cbfunc(spi_read, spi_write);
// Configure socket buffers
uint8_t txsize[8] = {2,2,2,2,2,2,2,2};
uint8_t rxsize[8] = {2,2,2,2,2,2,2,2};
wizchip_init(txsize, rxsize);
// Network configuration
wiz_NetInfo netinfo = {
.mac = {0x00,0x08,0xDC,0x11,0x22,0x33},
.dhcp = NETINFO_DHCP
};
// Apply network settings
wizchip_setnetinfo(&netinfo);
EN Explanation
After initializing the W5500 Ethernet interface, the MIoTKit firmware configures the MQTT client with TLS parameters. The device then connects to the EMQX broker using a secure MQTT connection and begins publishing telemetry data.
KR 설명
W5500 초기화 이후 MIoTKit 펌웨어는 MQTT 클라이언트와 TLS 인증 정보를 설정합니다. 이후 장치는 EMQX MQTT 브로커에 보안 연결(MQTTS)을 수행하고 센서 데이터를 MQTT 토픽으로 전송합니다.
Practical Tips / Pitfalls
EN
Verify SPI wiring between the MCU and W5500 (MOSI, MISO, SCK, CS).
Confirm Ethernet PHY link status before establishing MQTT connections.
Ensure TLS certificates and broker ports are correctly configured.
Industrial systems often prefer static IP configuration.
Implement MQTT reconnection logic to handle network interruptions.
Monitor socket usage to avoid exhausting W5500’s available sockets.
KR
MCU와 W5500 사이 SPI 연결(MOSI, MISO, SCK, CS)을 확인합니다.
MQTT 연결 전에 Ethernet PHY 링크 상태를 확인합니다.
TLS 인증서 및 브로커 포트 설정을 정확히 확인합니다.
산업용 네트워크에서는 고정 IP 사용이 일반적입니다.
네트워크 장애에 대비해 MQTT 재연결 로직을 구현합니다.
W5500의 소켓 수 제한을 고려하여 네트워크 연결을 관리합니다.
FAQ
Q1: Why use W5500 for MQTT IoT communication?
EN:
The W5500 integrates a hardware TCP/IP stack that reduces MCU processing load and simplifies networking. This allows embedded systems to maintain stable MQTT connections with minimal firmware complexity.
KR:
W5500은 하드웨어 TCP/IP 스택을 제공하여 MCU의 네트워크 처리 부담을 줄이고 안정적인 MQTT 통신을 구현할 수 있습니다.
Q2: How does W5500 connect to the microcontroller?
EN:
The W5500 communicates through an SPI interface using MOSI, MISO, SCK, and CS pins, with optional RESET and interrupt pins for device control.
KR:
W5500은 SPI 인터페이스(MOSI, MISO, SCK, CS)를 통해 MCU와 연결되며 RESET 및 인터럽트 핀을 추가로 사용할 수 있습니다.
Q3: What role does W5500 play in this system?
EN:
It serves as the Ethernet network interface that manages TCP sockets used by the MQTT client to communicate with the EMQX broker.
KR:
W5500은 MQTT 클라이언트가 EMQX 브로커와 통신할 때 사용하는 TCP 소켓을 관리하는 Ethernet 네트워크 인터페이스 역할을 합니다.
Q4: Can beginners implement this project?
EN:
Developers with basic embedded programming experience, SPI communication knowledge, and familiarity with MQTT can implement this system.
KR:
기본적인 임베디드 개발 경험과 SPI 통신, MQTT 개념을 이해하고 있다면 구현할 수 있습니다.
Q5: Why use TLS with MQTT in Industrial IoT?
EN:
TLS encryption protects device data and authentication credentials during transmission, preventing interception and unauthorized device access.
KR:
TLS 암호화는 데이터와 인증 정보를 보호하여 산업용 IoT 환경에서 보안 통신을 보장합니다.
Source
Original Video
https://www.bilibili.com/video/BV11WS6YpEiT/
EMQX MQTT Platform Documentation
MIoTKit Device SDK Documentation
Tags
#W5500
#MIoTKit
#MQTT
#EMQX
#IndustrialIoT
#EthernetIoT
#TLS
#EmbeddedNetworking
