• 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 with user and password credentials

Q&A Forum › Category: ESP32 › ESP32 MQTT with user and password credentials
1 Vote Up Vote Down
Michael asked 5 years ago

Hi Rui and Sara,
I bought your courses because I need resources in getting me running with the esp32 MQTT communication. I have setup already a mosquito broker in my Raspberry Pi but also have user and password secured mosquito. Where would I enter those credentials into the arduino code if my esp32 would be subscribing to a topic? Can you help me with this?
Greatly appreciate it, Michael.

Question Tags: credentials, ESP32, MQTT
4 Answers
0 Vote Up Vote Down
Michael answered 5 years ago

PS, It would be really great if you can do a short blog or tutorial on using Node-Red, to send a message to an esp32 subscribed topic… Or maybe an example code? 

1 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Michael.
Add the following lines to set your mqtt brokerubroker and password.

mqttClient.setCredentials( "username", "password"); 
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Answering your second question.
Take a look at the ESP32 course, last unit in the mqtt module. It shows what you’re looking for. As an example, we’re controlling an LED of the ESP32. 

Connect ESP32 to Node-RED using MQTT


I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
Michael answered 5 years ago

Thank you veru much, 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.