Building a Secure MQTT Broker with ESP32

Published at : 23 Dec 2025

In this video, we explore the potential of using the ESP32 as an MQTT broker for small IoT projects using the PicoMQTT library. We'll cover why the ESP32 is a great choice for connecting a few devices, the features and limitations of the PicoMQTT library, and how to set up the ESP32 as an MQTT broker in different network scenarios and we will also learn how to secure our MQTT broker using username and password. This library will help us create a secure and cheap MQTT broker using ESP32.

We will look at two scenarios:
1️⃣ ESP32 as an MQTT broker while connecting to the home network, with all devices connected to the router.
2️⃣ ESP32 as an MQTT broker and WiFi access point, where all devices connect directly to the ESP32 to access the MQTT broker.

Furthermore, we'll test the broker using: 📱 Smartphone MQTT dashboard. (You can use any app)
🐍 Python client: https://youtu.be/IQBWMHMTTO8
⚙️ ESP32 as MQTT client: https://youtu.be/lEXQ9w1z7Aw
📚 PicoMQTT library: https://github.com/mlesniew/PicoMQTT
ESP32 as MQTT brokerusing sMQTTbroker library https://www.youtube.com/watch?v=ji_nfVEI25g

Whether you're just starting out or looking to optimize your IoT setup, this video will guide you through the process!

Don't forget to like, share, and subscribe for more tech tutorials! 🔔

Code and blog: https://github.com/HighVoltages/ESP32-as-MQTT-broker

##################### Hardware used ##############

✅ ESP32 : https://amzn.to/46ZB2I2

✅ XIAO NRF52840 sense by seeed studio: https://amzn.to/3ACVbrD

📖 Check my book "Hands on ESP32 using Arduino IDE book" : https://amzn.to/4cBAnOd

###################################################################

Chapters:
➡️00:00 ESP32 as a MQTT broker (Introduction)
➡️00:15 MQTT cloud options
➡️00:49 why we might need to use ESP32 as MQTT broker ?
➡️01:17 ESP32 as a MQTT broker using Pico MQTT library
➡️01:25 PicoMQTT library Features
➡️02:12 PicoMQTT library Limitations
➡️02:43 ESP32 as MQTT broker two scenerios
➡️03:05 ESP32 as MQTT broker only while connected to the home network
➡️03:39 ESP32 as MQTT broker only while connected to the home network code
➡️06:11 Testing using Python MQTT client
➡️07:09 Secure ESP32 MQTT broker
➡️08:46 Testing using Python ,ESP32 and smartphone as MQTT clients
➡️12:48 ESP32 as MQTT broker and access point
➡️14:16 Testing using Python ,ESP32 and smartphone as MQTT clients
➡️15:35 Performance of the library
➡️16:10 Hands on ESP32 using Arduino IDE book


###############################################################

Order your projects at fiverr: https://www.fiverr.com/users/emmiasim67/

----------------- HOW TO MQTT SERIES -----------------

How To MQTT Series: https://youtube.com/playlist?list=PLGlKxZrcyaVDFqdtvZwfy326rurYZovuO

ESP8266 WifiManager: https://youtu.be/VKqr-RDmRpY

What is MQTT: https://youtu.be/DAOa4uuYaGQ

Raspberry pi as MQTT broker: https://youtu.be/4LnxB_iJ380​

ESP8266 Publish/Subscribe local MQTT broker: https://youtu.be/7gjJfJgi6uE

ESP8266 Publish/subscribe to Cloud | MQTT:
https://youtu.be/eQvlHKTlYCE

Arduino real-time plotting MATLAB: https://youtu.be/hk-RQgofyEw

Arduino Real-time plotting PYTHON: https://youtu.be/COhkJwJtWG0

MQTT in MATLAB: https://youtu.be/ptdNuqGuf6E

MQTT in Python : https://youtu.be/IQBWMHMTTO8

Real time plotting in PYTHON using MQTT : https://youtu.be/cP2kAaat3bI

Android app MQTT: https://youtu.be/WAimZhU5phs



#esp32 #mqtt #mqttbroker #internetofthings -----------------------------------------------------------------------------------------------------------------------------------
📞 Need help with my tutorials? Book a 1:1 call: https://topmate.io/asim_zulfiqar/
-----------------------------------------------------------------------------------------------------------------------------------