• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

How to Use Cloud MQTT Broker with ESP32 using Async MQTT Client Library

Q&A Forum › Category: ESP32 › How to Use Cloud MQTT Broker with ESP32 using Async MQTT Client Library
0 Vote Up Vote Down
Rui Santos Staff asked 7 years ago

If you want to use Cloud MQTT broker with your ESP32, instead of running your local Mosquitto MQTT broker on a Raspberry Pi, follow these next instructions to modify the example sketch provided in the ESP32 course:

1. Open the details of your MQTT instance: https://customer.cloudmqtt.com/instance

Copy your server, user, password, port number:

2. Type your MQTT_HOST and MQTT_PORT, it should look like this:

#define MQTT_HOST "m12.cloudmqtt.com"
#define MQTT_PORT 134---

3. After the .setServer() (in the setup() function), you also need to call the .setCredentials() method with your own username and password:

mqttClient.setServer(MQTT_HOST, MQTT_PORT);
mqttClient.setCredentials("zkk-----", "BtH------");

That’s it! Your ESP32 should be able to connect to the Cloud MQTT broker.

Question Tags: ESP32, MQTT

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.