Adding wifi data logging to a Mega 2560 project - need some advice.

Hi There,

I was hoping to get some insight wrapping my head around how I should go about a new phase of this project I'm working on.

I have a aquarium controller I've been building and I would like to have the data from the various sensors displayed online. There are maybe 6 sensor values I would like displayed.

I have successfully been able to flash a ESP8266-01 with a FDTI programmer. I've uploaded the ArduinoOTA sketch and can see the network port in the Arduino IDE. This is as far as I've got and I am having a little trouble understanding how to approach this project's next steps.

If my Arduino Mega is humming away, taking temperatures and measuring stuff - what is the esp8266 doing? Do I upload a program to the ESP to wake up every minute and check in on a bunch of data and then post to a server? Or do the Arduino Mega and ESP work in tandem all the time? Is it one code uploaded to both (that doesn't seem right) or does the ESP get a tiny portion of the code that has to do with just the wifi and posting aspect?

If anyone could help clarify what direction to research or how to conceptualize this kind of a project, it would be very much appreciated.

Bonus: I've uploaded the basicOTA.ino sketch from the examples in the Arduino IDE, but not sure if that is sufficient (I've not actually been able to upload anything OTA yet - it says no answer or other errors). Should I be looking to flash the firmware with micropython or something?

Thank you for reading, Happy Tinkering.

one option https://github.com/jandrassy/WiFiEspAT/