# Connection Failure: RPI Pico W to HiveMQ Cloud

**URL:** <https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359>\
**Category:** HiveMQ Cloud\
**Created:** [August 19, 2022, 8:30am UTC](https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359 "2022-08-19T08:30:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![karl60](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@karl60](https://community.hivemq.com/u/karl60)\
**Post date:** [August 19, 2022, 8:30am UTC](https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359/1 "2022-08-19T08:30:33Z")

</div>

Newbie trying to connect RPI Pico W using module mqtt\_as to HiveMQ Cloud.

Using Port 8883 gives error code -1 ‘Connection closed by host’ (Instant error)  
Using Port 1883 gives error code -1 ‘Timeout on socket read’ (After a delay)

Any guidance on how to resolve the connection issue would be welcome.  
Thanks.

PS The Pico connects to my wifi OK.

---

<div class="post-metadata">

**Author:** ![cymplecy](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@cymplecy](https://community.hivemq.com/u/cymplecy)\
**Post date:** [August 21, 2022, 9:26am UTC](https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359/2 "2022-08-21T09:26:23Z")

</div>

Does your code work to connect to other brokers such as [test.mosquitto.org](http://test.mosquitto.org) or [mqtt.eclipseprojects.io](http://mqtt.eclipseprojects.io) on port 1883?

---

<div class="post-metadata">

**Author:** ![karl60](https://avatars.discourse-cdn.com/v4/letter/k/4af34b/32.png) [@karl60](https://community.hivemq.com/u/karl60)\
**Post date:** [August 22, 2022, 11:50am UTC](https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359/3 "2022-08-22T11:50:22Z")

</div>

Thank you for your response. Code works perfectly with the public brokers ‘[mqtt.eclipseprojects.io](http://mqtt.eclipseprojects.io)’, ‘[broker.hivemq.com](http://broker.hivemq.com)’, ‘[test.mosquitto.org](http://test.mosquitto.org)’ on port 1883.

---

<div class="post-metadata">

**Author:** ![Daria\_H](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@Daria\_H](https://community.hivemq.com/u/Daria_H)\
**Post date:** [August 22, 2022, 12:02pm UTC](https://community.hivemq.com/t/connection-failure-rpi-pico-w-to-hivemq-cloud/1359/4 "2022-08-22T12:02:34Z")

</div>

Hi @karl60 ,

Nice to see your interest in MQTT and HiveMQ Cloud, please welcome to our community 👋

Using port 1883 on HiveMQ Cloud doesn’t make any sense, there are only following ports available:

| Port (TLS): | 8883 |
| --- | --- |
| Port (Websocket + TLS): | 8884 |

To connect to 8883 you need:

- hostname of your cluster;
- username and password from the clusters MQTT Credentials;
- HiveMQ Cloud requires the TLS-SNI extension to be available and used, please refer [here](https://community.hivemq.com/t/client-is-not-authorized-to-connect/856/37) and check if it is available in your system.
- some devices require the root certificate. You can download the root certificate [here](https://letsencrypt.org/certs/isrgrootx1.pem).

I hope this helps,  
Kind regards,  
Dasha from HiveMQ
