Arduino Mega with build-in wifi connect to AWS IoT via MQTT

Hi all,

I have a mega board with build-in wifi that was purchased from here: Amazon.com

This board works great with the WiFiEsp library from here: GitHub - bportaluri/WiFiEsp: Arduino WiFi library for ESP8266 modules. The board communicates with ESP8266 on Serial3.

Note that this mega board does have a tricky setup. You have to configure some pins in order for both Mega2560 and ESP2866 to work together. Not to mention I had to burn the latest firmware to ESP8266 prior, but after that everything works great.

Now, I want to connect the board to AWS IoT via MQTT protocol that requires SSL certificates for authentication. The WiFiEsp library above doesn't provide methods for such authentication.

So I looked into a tutorial that connects to AWS IoT using ESP8266WIFI core library.
The code: ESP-MQTT-AWS-IoT-Core/MQTT.ino at master · debsahu/ESP-MQTT-AWS-IoT-Core · GitHub
The library: Welcome to ESP8266 Arduino Core’s documentation! — ESP8266 Arduino Core 3.1.1-19-gbe02af05 documentation

With ESP8266 core library, I realized it only works with a standalone ESP8266 board because I have to pick the Generic ESP8266 board in Arduino IDE. If I select the Mega board, it will throw errors because ESP8266 core libraries won't be included. Also I didn't see that the core library can connect to ESP8266 on a specific serial.

Has anyone run into the same or similar issue? I am hoping you can help me out with some ideas.

Much appreciated!

Alan

I don't think that you can do what you want with the board you have.

That MQTT library works for boards with ESP32 or ESP8266 ICs.
ESP32 is another IC from Espressif.

.