Comments on: Raspberry Pi Pico W: Getting Started with MQTT (MicroPython) https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 15 Apr 2026 12:42:38 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Peter Merchant https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1179198 Wed, 15 Apr 2026 12:42:38 +0000 https://randomnerdtutorials.com/?p=151437#comment-1179198 In reply to Emilio.

I can’t find it. 15 April 2026

]]>
By: Peter Merchant https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1179175 Wed, 15 Apr 2026 11:23:04 +0000 https://randomnerdtutorials.com/?p=151437#comment-1179175 In reply to Gary.

This is where I am. I created a MQTT publisher on a WEMOS D1 communicating to a Raspberry Pi with Mosquito, and the subscriber program. This was programmed in Arduino language. Now I want to convert my Publisher device to a PICO using MicroPython. It looks like a config file is needed on the PICO and then my Publisher file.

I’ll see how it goes using this tutorial.

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162706 Wed, 18 Feb 2026 11:10:56 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162706 In reply to Luc Coussement.

The client ID identifies the client.
That is just needed in the Pico code.
Regards,
Sara

]]>
By: Luc Coussement https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162546 Tue, 17 Feb 2026 15:54:44 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162546 Hi
the mosquitto works also.
the user and password must have high comma.
example:
mosquitto_pub -h xxxxx.cloud -p 8883 -t pico/led -m “OFF” -u ‘xxx’ -P ‘yyy’ -d
^ ^ ^ ^
but no Cliend id

wat is de function of the cliend id?

Thanks. for help!

Regards,
Luc

]]>
By: Luc Coussement https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162530 Tue, 17 Feb 2026 15:14:40 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162530 In reply to Sara Santos.

Hi
Thanks.

2 pico’s is now working.
but node-red no connection with Client ID

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162494 Tue, 17 Feb 2026 11:25:14 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162494 In reply to Luc Coussement.

Ok.
Thanks.

If you want to connect a second RPi Pico, you need to set a different MQTT Client ID.

MQTT_CLIENT_ID = b’raspberrypi_picow’

Regards,
Sara

]]>
By: Luc Coussement https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162450 Tue, 17 Feb 2026 08:31:16 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162450 In reply to Luc Coussement.

Hi,

This is only about how to establish the connection to the Cloud Broker HiveMQ.
If, after creating an account, the connection using the provided URL and port number does not work everywhere (for example with one Pico and without Node-RED),

it is better to use the URL “broker.hivemq.com” and port “1883”.

I just want to share my findings and solution with you.
Please review and test whether this is worth mentioning, as it could improve the article.

Kind regards,
Luc

]]>
By: Luc Coussement https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162333 Mon, 16 Feb 2026 18:37:26 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162333 Hi
I am working with de Cloud Broker HiveMQ
Regards
Luc

]]>
By: Sara Santos https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162314 Mon, 16 Feb 2026 16:45:24 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162314 In reply to Luc Coussement.

Hi.
It should work with Node-RED and Raspberry Pi with the Mosquitto broker if that’s your question.
I tested it very recently.

You need to be more specific when you say it doesn’t work, otherwise it’s very difficult to figure out what might be the problem.

Regards,
Sara

]]>
By: Luc Coussement https://randomnerdtutorials.com/raspberry-pi-pico-w-mqtt-micropython/#comment-1162244 Mon, 16 Feb 2026 10:25:33 +0000 https://randomnerdtutorials.com/?p=151437#comment-1162244 This was a good explanation about MQTT.
It works perfectly.

But when I use a second Pico to control the on/off function, I get an error: Error -1 in mqtt_subscribe.py.

It doesn’t work with Node-RED (no connection).
It also doesn’t work with the Raspberry Pi.

After some searching, I found that it is better to use the URL “broker.hivemq.com” and port “1883”,
and not the registration URL.

Example:
Raspberry Pi:
mosquitto_pub -h broker.hivemq.com -p 1883 -t pico/led -m "ON" -u xxx -P yyy

Node-RED also works this way.

There is one disadvantage you cannot use the HiveMQ web page to view the subscribed topics.

Could you please look into this?

Kind regards,
Luc

]]>