• 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

ESP32 MQTT Server (Port and Password)

Q&A Forum › Category: ESP32 › ESP32 MQTT Server (Port and Password)
0 Vote Up Vote Down
ChinGuan Quek asked 2 years ago

Hi,
Would it be possible to provide advice on configuring port setting that is different form the default port 1833 and what code changes need on the two project files.
Also, if it possible, adding password to the for the Raspberry Pin broker and code changes for the two ESP32 MQTT project files.
Thanks

Question Tags: MQTT Password, MQTT Port
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
Which project or eBook are you following?
Regards,
Sara

0 Vote Up Vote Down
ChinGuan Quek answered 2 years ago

Learn ESP32 with Arduino IDE

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
To add password and user to the Mosquitto MQTT broker, you need to follow this tutorial: https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
 
To change port on the ESP32 code, change on the following line:

#define MQTT_PORT 1883

 
You can insert the MQTT username and password on the ESP32 code after the following line:

mqttClient.setServer(MQTT_HOST, MQTT_PORT);

 
Add:

mqttClient.setCredentials("REPlACE_WITH_YOUR_USER", "REPLACE_WITH_YOUR_PASSWORD");

 
Let me know if this helps.
 
Regards,
Sara
 

0 Vote Up Vote Down
ChinGuan Quek answered 2 years ago

Hi Sara,
While awaiting your reply, I stumble upon the solution as you have advised. It worked.
At the Raspberry Pi, MQTT server end, the port, user and password has to be configured to match that set in here
Thanks for your advice.
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

That’s great!
I’ll mark this issue as resolved.
If you need further help, you just need to open a new question in our forum.
Regards,
Sara

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.