MQTT for the Maker: A Basic Introduction

A Very Simple Overview for the DIY Thing Maker

The neat thing about IoT (the Internet of Things) is that its possible for hobbyist to create a high tech solution using readily available low cost devices and services.   In fact, for under twenty dollars you can create all kinds of things that provide data to or can be controlled from the internet.

One of the enabling technologies is MQTT ( Message Queuing Telemetry Transport).   This article focuses on describing MQTT in a manner that will help you to outline the steps that you will need to take to create your own Internet Thing.

A more in depth examination of MQTT will occurs in subsequent articles and tutorials.

MQTT Explained In One Simple Picture

MQTT is often referred to as a protocol that incorporates  a Pub/Sub architecture.

The genius of MQTT is its simplicity and the graphic below speaks to that simplicity.


That’s it.  That’s all MQTT really is.  Fundamentally there are two types as players in MQTT.  There is a broker and there are clients.

MQTT Broker   At the heart of the system is a server running software that receives published information and sends it to those who have subscribed to it.

MQTT Clients   Devices or services that connect to the MQTT Broker are known as clients.   Clients can publish messages, subscribe to messages or both.

Why MQTT Works for an Internet Thing

  • Simplicity.  The terminology doesn’t require a degree in computer science.
  • Uses little Bandwidth. It doesn’t require a lot of network bandwidth.  In other words,  you will be able to stream your movie while publishing information to a broker.
  • Designed for High Latency.  Some networks are faster and some are slower.  MQTT is designed for those slower networks where there can be longer delays or lower reliability.
  • Provisions for Ensuring (or not Ensuring) Quality  of Service.   Sometimes, it is important that a message is received.  A high temperature alarm might be one such provision.   Other times it is not so important.  If you’re just logging temperature every few seconds,  missing a report now and then may not be that important.  MQTT allows you define the quality that is necessary.
  • It is Used a Lot  This means that there are tons resources available to you.   In other words,  you won’t be isolated to a user group of five people when getting questions answered.
  • It is Standardized.  This means that the various devices, libraries or services you use stand a pretty good chance of actually working with one another.
  • It Provides a Level of Security.  In addition to usernames and passwords,  it provides for encryption across a network using SSL.

A Look at the MQTT Client

Remember,  a client can be both a publisher and a subscriber.  That is to say that it can send message to a broker or it can subscribe to multiple messages that are being reported to the broker by other clients.

The tough part is in describing what can be a client.  You see, it can be just about anything.   It really just limited by your imagination.

In MQTT,  when This to talks to That over the internet, the clients are This and That.

A Look at the MQTT Broker

This is where things can tend to get a little more complicated.  Just at there are several options for clients,  there are several broker options too.   Some of these options include:

  • Building your own broker using something like Raspberry Pi.
  • Using a freely available broker like what is available at or Amazon’s CloudMQTT (entry level).   Most of the tutorials here on Henry’s Bench will focus on these freely available services.
  • Installing MQTT broker software onto a server that you rent from a hosting company.

An Overview of DIY IoT Project Decisions

Given this description of MQTT,  it can be seen that an IoT project requires you to make some decisions.

  1.  DEFINE THE ‘THIS’ –  What is doing the publishing?  This could be your Arduino or ESP8266 measuring voltage or it could be a web page that sends a message when you click on a button.
  2. DEFINE THE ‘THAT’ –  What is going to respond the message you send with That?  What’s it going to do when it receives the message?
  3. DECIDE ON A BROKER What software and/or service is ensuring the That gets the message from the This?

Of course there’s some work that goes into each step, but its a lot simpler to do that work if you begin with your objective in mind.