MQTT – Message Queuing Telemetry Transport. This is a light weight,simple message protocol that above TCP/IP protocol. This kind of protocol is good for using IOT related application development. By handling simple structure data, it allows user to monitor their devices easily. 

This article will show you how to use a hardwired TCP/IP solution chip W5500 to communicate with MQTT broker. For giving a better understanding on this article, it presents as a tutorial to allow user to use this solution in a easy way.

Required equipment:

1. W5500 Evaluation Board (EVB)

2. MQTT broker – The server that accept MQTT protocol and delivery messages to other MQTT clients

3. MQTT library from Paho

First of all, we need to have a device and platform for implementing MQTT to operate with W5500 chip. For the device, I had chosen W5500 EVB as the main platform. This board included STM32F103RCT6 that has the ability to handle this simple implementation.   



MQTT is a application protocol that is above TCP/IP protocol. This kind of protocol is light weight binary protocol. This kind of protocol structure is a lot simple than using HTTP request format.

For MQTT protocol, it is required to have a Server to understand this protocol and deliver these message for monitoring purpose to the users. 

MQTT protocol has used Publish and Subscribe method to delivery message. This means each devices are required to communicate with a MQTT server called MQTT broker. This broker is a agent for managing these information to allow more than 2 devices to exchange information. 

The following figure shows the simple block diagram that explains the communication method in MQTT. 

Thus, the MQTT broker that I’m going to use is trying to develop with CloudMQTT. This broker is easy to register and use, you just need to go to control pannel to register a account will be fine. Please refer the following figure and link to register your account. 


After you had register your account and create your broker, you could start to use this MQTT broker by using publish and subscribe method to manage your devices. 

Before we head into coding, we need to gather some information from this broker. 

Adding MQTT into your source code

As this protocol is a application layer protocol, therefore we could just add this library on your source code without any effect to your setting on TCP/IP protocol layer. 

For my case, I had used Hardwired TCP/IP protocol chip reduces workload on developing TCP/IP protocol. Thus, I just need to add the library directly to my TCP client source code with some extra setting will be fine. 

For the MQTT library, I had used Paho’s C library for this development. 

Please refer the following link for getting the library.

Paho website:

Paho c library:

The file that you required for this protocol is 

A. Folder: c:your downdload pathorg.eclipse.paho.mqtt.embedded-c-1.0.0MQTTPacketsrc

B. Files: c:your downdload pathorg.eclipse.paho.mqtt.embedded-c-1.0.0MQTTClient-Csrc MQTTClient.c & .h files.

After we had implemented library into the source code, we need to add a interface to allow both our codes could combine together. 

For more information you may download my source code.

The file that I had add are the MQTT_interface.c & MQTT_interface.h as the follow figure.


If you wanted to make your own library or using another solution that you directly send MQTT data to the broker, I suggest that you to refer the following link.

Testing MQTT server: 

Before we use the broker’s information for testing MQTT, we need to have identify and create two devices for Publisher and Subscriber with MQTT broker. 

In this test, I used a MQTT testing program (MQTT Fx) as the Publisher.

MQTT fx :

The W5500 EVB will be the subscriber that received information from the Publisher.  

Please add the IP address, port number, user name, password for connect to MQTT. 

char *post[] =[postT];
uint8 yeelink_server_ip[4] = { 54.92 .237 .174 }:	// MQTT ip address
	uint16 yeelink_server_port = 17341;	// MQTT port number
uint8 t = 0;
struct opts_struct	//structure for communicating MQTT cloud servers
	char *clientid:
		int nodelimiter:
		char *delimiter:
		enum QoS qos:
		char *username;
	char *password;
	char *host:
		int port;
	int showtopics:
		opts = { (char*)“ WIZnetHK_RON”, 0, (char*)”\ n”, QOSO, “mvupsons”, “SOhS5SXo_aXz”, (char*)” localhost”, 1883, 0
		}:	//create variables for log in Cloud MQTT Console

Finally, create the same topic for subscriber and publisher for communication purpose. 

It will the result as follow.