Jump to content


MQTT Subscribe using mqttbroker.carriots.com Arduino+ESP8266

  • Please log in to reply
2 replies to this topic

#1 sreejith.nair



  • Members
  • Pip
  • 6 posts

Posted 26 February 2018 - 11:23 AM

Hi I am using Arduino+ESP8266 with PubSubclient.h to connect to the carriots.

and i successfully connected and published the data to a stream topic. 

by using following call i am establishing a connection with carriots and after that i am publishing the data.

1. mqtt_client.setServer( mqtt.carriots.com, 1883 );



Now i tried with mqttbroker.carriots.com with the same port, but i am not able to establish a connection with carriots. 

It's returning a packet error. 

I am using a corporate account. 

My connect call is not returning success, Please guide me to solve it.

How do i check, i am authorized to use mqttbroker.carriots.com 

#2 nyshos



  • Members
  • Pip
  • 1 posts

Posted 27 February 2018 - 08:13 AM

I see a mistake in your mqtt.connect() you are using the APIKEY like username, thats okey for publishing ont the mqtt.carriots.com but for publishing on mqttbroker.carriots.com you need to use a username, and a password.


Here you have an example of how to config the device for mqtt and what I mean with a username and a password.



Here you can find more info: https://pubsubclient...i.html#connect3


Hope it helps! :)

#3 sreejith.nair



  • Members
  • Pip
  • 6 posts

Posted 01 March 2018 - 09:19 AM


Thanks for the help!!! Now i am able to use mqttbroker.carriots.com 


I made one device setup (Arduino+ESP8266) for Publishing the message and another Device setup(Arduino+ESP8266) for Subscribing the message.


Publish : Device 1

mqtt_client.connect(CLIENTID, CARRIOTS_USERNAME, CARRIOTS_DEVICE_PASSWORD) //Client should be unique

mqtt_client.publish(CARRIOTS_MQTT_TOPPIC, frame)


Subscribe: Device 2


mqtt_client.connect(CLIENTID, CARRIOTS_USERNAME, CARRIOTS_DEVICE_PASSWORD) //Client should be unique 


mqtt_client.loop(); // This should run in the loop, to keep the connection alive.

// Once the message is published from the Device 1 , your callback will be executed. you can print in serial and verify.


Thanks for the help.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users