Arduino MEGA + NodeMCU stuck at 'redirecting' on Serial Debugger

Hello folks!
I have a custom designed Arduino Mega (lets just called it that for this post). I am facing a very peculiar problem.

So firstly this application requires 8 analog inputs and 8 digital inputs and 16 digital outputs hence I can’t really use just the node or an esp module and i have connected the esp8266 to the arduino Mega on Serial1 of the mega. Every time I make some changes to the code, or restart the board either by the reset button or when the power is disconnected, I see that the board doesn’t connect online! I have to connect it to my phone’s hot spot and I usually change the name for the hotspot to the local wifi that’s available and then after multiple mobile data restarts and in app Blink restarts I get a beautiful “Ready” message on the serial monitor of the PC. Now I need to build a field ready application which doesn’t need 20 mins of DIY network switching so if any of you guys can help me figure out the problem, it’ll be really appreciated.

Also I have looked through this forum a lot, I’ve done

  1. Watchdog timer as recommended by some gentleman
    2)made sure the ESP connects to the board fine and also responds to AT commands, else I wouldn’t be able to see connected to the wifi in the first place, so that’s covered.
    3)Swapped the Node modules also borrowed a few from a friend
    4)I know my custom mega board can be questioned so I have tried on a Genuino Mega aswell, No luck!

Can someone please help me find the problem, as I really can’t figure out how to identify what’s going wrong.

Summary:- Mega + ESP8266 - Stuck on “Redirecting” to what I believe is Blynks server address, takes about 15 mins of switching on and off mobile data for a while the esp is connected to the hotspot and also a few restarts of the app to get the “Ready(11ms)” message

Here’s my code:-

#define BLYNK_PRINT Serial

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <avr/wdt.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "Blynks Auth token";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "my wifis SSID";
char pass[] = "My password";

// Hardware Serial on Mega, Leonardo, Micro...
#define EspSerial Serial1

// or Software Serial on Uno, Nano...
//#include <SoftwareSerial.h>
//SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

int DIs[] = {6, 7, 8, 9, 2, 3, 4, 5};
int AI_V[] = {A4, A5, A6, A7, A0, A1, A2, A3};
int AI_C[] = {A12, A13, A14, A15, A8, A9, A10, A11};
int DOs[] = {26, 27, 28, 29, 22, 23, 24, 25};
int LED[] = {34, 35, 36, 37, 30, 31, 32, 33};
BlynkTimer timer;

void setup()
  for (int i = 0; i++; i < 8) {
    pinMode(LED[i] , OUTPUT);
    pinMode(DOs[i] , OUTPUT);
    pinMode(DIs[i], INPUT);
  // Debug console

  // Set ESP8266 baud rate

Blynk.begin(auth, wifi, ssid, pass, "", 80);
  // You can also specify server:
  //Blynk.begin(auth, wifi, ssid, pass, "", 80);
  //Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);

  Blynk.virtualWrite(V16, 1);  // 1 for Digilog, 2 for Hydac
  timer.setInterval(500L, Read);

int AV[] = {};

void Read() {
  for (int i = 0; i < 4; i++) {
    AV[i] = analogRead(AI_V[i]);
  Blynk.virtualWrite(V0, AV[0]);
  Blynk.virtualWrite(V1, AV[1]);
  Blynk.virtualWrite(V2, AV[2]);
  Blynk.virtualWrite(V3, AV[3]); 

void loop() {;;
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!

Also I if anyone can guide me to some literature which can help me understand the Buffer? I am also facing issues with buffer overflow but I think that’s just my programming mess.

Thank you for reading! :slight_smile: :grin: