Adding a ESP8266 to an Arduino project

I have a project that I’m working on based on an aquarium controller using an Arduino Mega (lots of pins).

It has monitoring of several sensors and a TFT to control the features. It’s a very simplified version of iAqua.

I wanted to add an ESP8266 and I would like it to be an additional module with all the “netoworking functions” (webpages, api and mqtt) só these are esssentially 2 arduinos, one for networking, another for control.

I’m reading/googling a lot for communication between arduinos and it sounds like serial is the only route.

I couldn’t find a “clear winner” in terms of library, there several guidance posts on best practices.

A lot of what I find out there is about using the ESP just with the AT interface, and doing everything else on the Arduino.

Should I abandon the route of “2 arduinos” in favor of a more popular solution?

If not, any alternatives to serial comm?

If there are no alternatives, is there any defacto standard library to use for comm.

Here's the most popular library for easy control of an ESP8266 running the AT firmware: https://github.com/bportaluri/WiFiEsp It uses a standardized API so you can easily adapt code you find that was written for use with the Ethernet, WiFi, and other common network interface libraries.

Are you looking for a packet based high level messaging system that uses the inbuilt hardware? https://github.com/madsci1016/Arduino-EasyTransfer

Add a coupe of RS485 transceivers and you can do a message bus. http://www.gammon.com.au/forum/?id=11428

Alternatively buy a pair of ethernet or CAN bus interfaces. These do all the low level stuff you so you only have to deal with an API that sends chunks of data. How that data is structured is up to you.

do what you planed. write a sketch for the esp8266 using esp8266 Arduino core and code the exchange of the data with Mega over Serial

pert: Here's the most popular library for easy control of an ESP8266 running the AT firmware:

I'm running the arduino firmware on both. The idea is to have all the code for IoT/Web in the ESP and all the controlling code in the Mega. But then they need to exchange data/data structures.

mikb55: Are you looking for a packet based high level messaging system that uses the inbuilt hardware? https://github.com/madsci1016/Arduino-EasyTransfer

This sounds like what I'm looking for. Will try. Thanks!