0

I'm wondering if an Arduino Uno (or any other 328 family) that connects via Serial to an ESP8266 can send MQTT messages, rather than AT commands.

0

1 Answer 1

2

I didn't use MQTT yet so I didn't try any of the following options. I only know they exist.

  1. AT firmware version 2 has a set of AT commands for MQTT. But development of AT 2 for esp8266 was ended with version 2.2. It requires an esp8266 with a 4 MB flash.

  2. a very old esp8266 firmware called ESPLink has support to register to a MQTT topic and then use it in Arduino with the EL-link library. (The main goal of the ESPLink firmware was OTA update for Uno)

  3. PubSubClient library is a very popular Arduino library for MQTT. It works over any standard Arduino networking library. For esp8266 there are multiple options for a firmware+library combination. I can only recommend my WiFiEspAT library (all others have too many problems). WiFiEspAT works with AT firmware in esp8266. Best is to use AT 1.7.5 or the 'fake' AT firmware ESP_ATMod, which is an Arduino sketch.

The third option will take much more flash and RAM than the first two, but it is a standard and portable way. You can port it to other networking library or other MCU type.

EDIT: Another option is to write a sketch with MQTT for the esp8266 directly and communicate the data with Uno or not use the Uno at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.