• 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

MicroPython Programming with ESP32 and ESP8266 – Module 5 MQTT protocol

Q&A Forum › Category: Raspberry Pi › MicroPython Programming with ESP32 and ESP8266 – Module 5 MQTT protocol
0 Vote Up Vote Down
Meelis Kalder asked 6 months ago

Hello!
I have a problem with MQTT protocol. I use Raspberry Pi 5, ESP32 and Thonny. I have installed and uninstalled it several times now, changed passwords and conf file, nothing helps, still the message below:
 
Connection succeeded!
 …
Failed to connect to MQTT broker. Reconnecting…
 
In the Raspberry Pi 5’s own terminal, mosquitto works correctly when I used the command
$ mosquitto_sub -h localhost -t test/topic -u user -P password
$ mosquitto_pub -h localhost -t test/topic -m “Hello World” -u user -P password
 
But mosquitto doesn’t work with ESP32, Thonny and sample code.

5 Answers
0 Vote Up Vote Down
Meelis Kalder answered 6 months ago

Solved

0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

Hi.
What program exactly are you referring to?
I suggest copying the content of the boot.py file to the beginning of the main.py file.
Let me know if that changes anything.
Regards,
Sara

0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

I just tested the example in 5.3 and it is working just fine as it is in the eBook.
Do you have any other devices connected to the broker?
Regards,
Sara

0 Vote Up Vote Down
Meelis Kalder answered 6 months ago

Thanks for answering! Unfortunately, English is not my native language, so it’s hard to explain, but I got the code working. The error was probably not in the code, but in the firewall of the Raspberry Pi. ChatGPT solved it this time. Everything will work out, some things just take longer.
Thank you! The book is very good! I have become a fan of IoT thanks to RND.

0 Vote Up Vote Down
Sara Santos Staff answered 6 months ago

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.