-->
Page 1 of 3

Best MQTT api for ESP8266 with arduino

PostPosted: Sun Feb 14, 2016 12:23 pm
by jmv_driver
Hi!
I'm trying to use some api to communicate using the MQTT protocoll.

I tried the Adafruit MQTT Library, MQTT by Joel Gaehwiler, PubSubClient, ... but with any of these libraries are correctly working.

Can someone advise me the best/rocksolid library to use with esp8266? A appreciate one example of publishing and subscribing using the free broker test.mosquitto.org.


Thanks,

Jaime

Re: Best MQTT api for ESP8266 with arduino

PostPosted: Mon Feb 15, 2016 8:09 am
by Andrew Grande
MQTT is a pretty stable tech by now, libraries don't differ much. I've had good results with pubsubclient, see https://github.com/aperepel/iot-mqtt-sp ... sleep-oled for example.

Basically, check the last commit date of the lib to see if it's active, review any forks and give bonus points if they took care of any esp8266-specific issues.

Re: Best MQTT api for ESP8266 with arduino

PostPosted: Mon Feb 15, 2016 9:09 am
by krzychb
@jmv_driver

I am aware about two version of library named PubSubClient, so the question is which one you use.

For esp8266/Arduino I am using PubSubClient - MQTT library by @Imroy - https://github.com/Imroy/pubsubclient
    * A pretty detailed guide how to use it with test.mosquitto.org is here.
    * There is another project using test.mosquitto.org but without a guide - if you prefer to analyse the code yourself :D
Both projects are working without any issues or tricks to compile for several weeks with stable esp8266/Arduino 2.0.0 release.


Hope it helps,

Krzysztof

Re: Best MQTT api for ESP8266 with arduino

PostPosted: Mon Feb 15, 2016 9:13 am
by piersfinlayson
I like tuanpmt's esp_mqtt https://github.com/tuanpmt/esp_mqtt. Seems pretty fully functional, and works well with mosquitto.

Now this isn't natively Arduino capable, but I did make some modifications to it to allow it to run in the Arduino environment, alongside other Arduino tasks using the TaskScheduler library.

If people are interested i can make this code available.

I've moved away from the Arduino framework now to using the SDK directly as it's more powerful and I find it more stable.