For a project of mine, I need an Arduino to control a Wifi ESP8266 module using a serial connection. The Wifi module needs to be instructed by the Arduino to connect itself to an MQTT broker. While there are many MQTT libraries available, such as arduino-mqtt, pubsubclient, or mqtt-client, each requires an instance of the Client class for network transport in their respective constructors.
The official ESP8266 library does indeed provide the WiFiClient
type implementing Client
, but the problem is that this library seems to be available only if the .ino sketch is uploaded onto the ESP8266 board itself, and that to communicate with it through an external micro-controller requires manually sending AT commands to it.
While again there are libraries for this sort of interface, such as ArduinoESPAT, or ESP-AT, none of these seem to expose an instance of Client
required to run one of the three aforementioned MQTT libraries such as the ESP8266 library does.
My question therefore is,
- Is there any ESP8266 AT library available out there that I might have missed offering an implementation of the
Client
type? - Or, must I implement this on my own writing a custom class implementing
Client
?
I have thus far tried uploading an .ino sketch onto the Arduino rather than the ESP8266 module including the ESP8266WiFi.h
header, but this on the former fails to compile while works on the latter. This is what made me believe that the official ESP8266 library was written to interface an ESP8266 module directly and not through any other micro-controller.
As said earlier, the two AT libraries I have found do not offer any implementation of the Client
type required by the MQTT libraries. Does someone have any idea how to remedy this?
Thanks in advance.
1