It's Cyber Monday all week long! Use promo code BFCM2023 at checkout for 15% off SparkFun Original Products under $200. Some exceptions apply. Shop SparkFun Originals.

The Magic of MQTT

I enjoy electronics; I enjoy the outdoors; I enjoy lots in life that aren't chores.

Favorited Favorite 1

IoT and connected devices hold the solutions to problems on all ends of the spectrum, from areas such as agriculture and industrial automation, to letting you know when your food is about to go bad. For me, the greatest potential for IoT (yes, I realize there's so much more) is the potential to eliminate life's maintenance activities, leaving more time for the stuff I enjoy doing. If I can minimize the amount of time I spend cleaning my house, figuring out what I need on my shopping list, or even just turning on the lights I turn on when I get home at night, I'll deem IoT a success.

alt text

For those looking to make my dreams come true, a good first step is learning MQTT. MQ Telemetry Transport (MQTT) is a machine-to-machine messaging protocol aimed at IoT. It's designed with a lightweight messaging service that's perfect for remote nodes or sensors. One of our engineers, Alex, put together a great tutorial on getting started with MQTT with the very popular Raspberry Pi platform. I highly recommend it as a quick taste of what MQTT and IoT have to offer.

Introduction to MQTT

November 7, 2018

An introduction to MQTT, one of the main communication protocols used with the Internet of Things (IoT).

The tutorial can be found here, and more information can be found on most project websites (it's a very popular thing these days).

Comments 7 comments

  • Very nice article! Thanks for sharing this material.

  • Member #1511557 / about 5 years ago / 1

    I use intensively MQTT in local network to control Arduinos and Raspberries in Escape Rooms (up to 20 IoT boards per room) and it's definitively to right choice.Starting 3 years ago with TCP streams, MQTT is much much better. I don't see any other protocol to compete out there.

    My company will publish commercial software to control Escape Rooms and free open-source librairies code for Arduino with Bridge (YUN) and Python libraries (Pure Python, asyncio, Kivy and Pygame oriented libraries and PySide/PyQt5 libraries).

    On Raspberries I use paho-mqtt python lib, on Arduinos I use PubSubClient and on Windows I use C++/Qt/QMqtt.

    To help our project I've already published an MQTT observer (PyQt5) on Gitub: https://github.com/fauresystems/mqtt-observer

    MQTT protocol is light and efficient across local networks but can be used over TCP (and websockets) over wide networks (in such a case, security might be addressed properly).

    Because MQTT is plain text (and can be used for huge binary files as well) it's a pleasure to work with and debug data exchanges)..

  • bobdabiulder / about 5 years ago / 1

    Hey, it's also super vulnerable. Be careful: setup ACL and SSL for your broker, otherwise you may be spied upon!

  • MicroClutter / about 5 years ago / 1

    You might want to try the Espurna firmware by Xose Perez (tinkerman). You can find it here: https://github.com/xoseperez/espurna. Espurna will give your ESP8266 device a Web UI and OTA updates, integration with MQTT and common attached sensors. Espurna builds best with PlatformIO but there is a Wiki showing how to build it using the Arduino IDE. I was very impressed with it once I got everything working. The Wiki helps and you can post questions to the Espurna community forum.

  • cozytom / about 5 years ago / 1

    Using node-red and mosquitto on a raspberry pi is the nicest MQTT config.

    See http://enginemonitor.blogspot.com

    I update that with handy tips for that exact configuration.


  • Member #134773 / about 5 years ago / 1

    First, great timing! I've got an order whose latest status is "Picking" that includes a RPi-3B+ that I'd intended to put an MQTT broker onto, and tinker a bit with using MQTT with my ESP-8266 stuff! (OK, the timing of that order was to take advantage of the Arduino Day sale and the Clearance sale.)

    It answers directly one of the things I was wondering, to wit, whether a process on the same computer as the broker can be "client"! (I'll be "tinkering" to see if I can get the ESP-8266 to communicate both via http and MQTT, that is so that it can deal with talking to the broker while still responding to browser requests.)

    A couple of constructive criticisms:

    First, looks like there's a typo just before the "Suggested Reading" header -- it comes it out as "[//]: # For reference https://learn.sparkfun.com/tutorials/python-gui-guide-introduction-to-tkinter/all#introduction" -- I suspect it should be showing something else...

    Second, the "wish list" includes the obsolete Raspberry Pi 3 B, rather than the current Raspberry Pi 3B+.

Related Posts

Recent Posts

GIS Day Sale


All Tags