Skip to main content

WizFi310 MQTT Example


MQTT is a light weight messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited.
It is a communication protocol which almost can link all networked objects with the external, and it is used as a sensor.

How to use MQTT in WizFi310

MQTT AT Command Set

There are the necessary Commands for MQTT protocol in the WizFi310.


You can find the detailed description about the AT Commands for MQTT at the link below.
AT Commands list for MQTT

Example AT Command


  • Connect to Broker with non SSL
Already Joined AP.


  • Connect to Broker with SSL
Already Joined AP.



Subscribe & Unsubscribe

  • Subscribe & Receive Message
Already Connected with MQTT broker.

when the message received.
  • Unsubscribe
Already Connected with MQTT broker.



Already Connected with MQTT broker.

Input 3bytes to Serial interface.

MQTT Example

Setup the Broker

Adafruit Broker would be used at this Example. Adafruit MQTT broker can support non SSL and SSL Connection and the Adafruit shows the collected data as the Dashboard.

Adafruit MQTT API Guide

Make Topic

Create the Feeds in Adafruit. it is equal to Topic in MQTT.

Then, You can see the graph that was made up of raw data.

Connect to Adafruit Broker

Before connection, you have to know the information below.

  • Username
  • Adafruit AIO Key
  • Adafruit IP & Port

Adafruit Username

It is a username registered in Adafruit.

Adafruit AIO Key

It is an authentication key for connection to broker. It can be found in "VIEW AIO KEYS" button.

Adafruit IP & Port

It is a information about Connection.

  • You can see the IP address using ** ** Command.
  • non SSL Port is ** 1883 **, or SSL Port is ** 8883 **.

** There are AT Commands for setting up the WizFi310. That is used when using above information and non SSL connection. **,3000


** Client ID(wiznet_1) is identifier of each MQTT Client and it should be unique per broker. **
** KeepAlive time(60 seconds)**

Publish the message

Adafruit IO's MQTT API exposes feed data using special topics. You can publish a new value for a feed to its topic, or you can subscribe to a feed's topic to be notified when the feed has a new value. Any one of the following topic forms is valid for a feed
For Examples.

  • wiznet/feeds/WizFi310
  • wiznet/f/WizFi310
Input 4bytes to Serial interface.

** 2nd parameter of AT+MQTTPUB command is '4'. it means that you can publish the 4 byte. **

Display the message in

You can see the published data in