On the other side of the broker is the publisher. Notice the separation between Publisher and Subscriber This continues until you cancel your subscription, stop responding, or the broker goes offline. When a new reading is taken from the thermometer, the server sends you a message with the new data. You send a message to the server that you would like to subscribe to that topic. One of these topics might be the temperature in Toronto, Ontario, at the Pearson International Airport. This broker can be queried by clients looking to subscribe to the data feeds (known as topics in MQTT lingo) it has available. MQTT works in the same way, with a server running the MQTT broker software. You can choose to subscribe to those you are interested in, and from that point forward, you will receive all the subsequent releases as long as you maintain your subscription. Your local magazine supplier, or broker, has a listing of all the publications that are available. There are many different newspapers and magazines available, each containing different information that you may or may not be interested in. Think of it like a newspaper or magazine subscription. MQTT is based on a subscribe/publish model. This is one of the factors that has led to its widespread use. A huge kudos to OASIS and for making the specification freely available. In order to do this, we will need to take a look at the MQTT standard document, which is freely available. In this tutorial, we will be implementing a basic MQTT library for the ESP8266.
It is easy to understand, and it is perfectly suited for applications where data logging or remote control are required. It has found widespread use in the IoT arena. MQTT, pronounced "em-cute" and short for Message Queuing Telemetry Protocol, is a lightweight communication protocol that was specifically designed to be easy to implement in environments with limited resources, like a microcontroller. Send me a private message here on Hackaday.Post on the ESP8266 Community Forums (note it can take a while to get a response!).Join the #esp8266 channel on Freenode IRC and ping me (MrAureliusR) or ask anyone who is in there.Ask in the discussion area below the article.If you run into trouble while following these tutorials, you have a few different options: We use the simpler, more widely available HTTP protocol to log data to the cloud Using the NodeMCU MQTT module to communicate with a cloud data service Links to the other tutorials in Part 3: ESP8266 SDK TutorialĮSP8266 Lua/NodeMCU Tutorial (You are here) Using the Wire library for I2C, and AnalogWrite for fading! Looking at using the linker to get PWM, and the included I2C libraries Use the Arduino IDE to simplify development and get up to speed very quickly!Īnd here's the links to Part 2: ESP8266 SDK Tutorial This is what the pros use!Ī look at the NodeMCU Lua interpreter for the ESP8266. Take a look at Part 1 of this tutorial series: ESP8266 SDK Tutorial