arduinomqttesp8266arduino-duearduino-esp8266

Which MQTT library to use for connecting ESP8266 Wifi-Mdodule on Arduino DUE


I have succesfully established a Wifi-Connection with my Arduino DUE and an ESP8266-01 Module attached to it. I now want to establish a connection to an IoT Platform (e.g io.adafruit.com) with a MQTT Protocol. However the MQTT Library provided by the IoT Platform does not support the Arduino DUE. When searching for a fitting library I always come across libraries that use the ESP8266 module directly without the Arduino DUE. Is there a library that I can use for this special application ?


Solution

  • Current libraries fairly requires Ethernet or WiFi client instances to use their protocol implementation and connect to the MQTT. In AT mode, you are posting a raw text data and it is not appropriate to create protocol depended headers etc. I thought that you need another serial firmware to include it and found this :

    http://www.esp8266.com/wiki/doku.php?id=espduino

    As it denotes, required library has a different communication method but no harm, you can still send data to it via AT commands.

    Here is another serial arduino library to work with ESP. It declares a client called ESPWiFiClient and looks like you need to give it as parameter to the PubSubClient's constructor.

    WiFiEspClient espClient;
    PubSubClient client(espClient );
    

    Good luck!