HARDWARE SETUP

All that’s needed to update the firmware on your Mega/Uno with WiFi is to set DIP switches 1,2,3,4 OFF and 5,6,7 ON (8 is not used).

If you’re updating a Mega, you also need to set the slide switch to TXD3. This allows you to use COM1 for Serial Debugging messages and COM3 for the ESP WiFi side and is 100% compatible with a standard Mega with separate ESP-10

Set to the right comm port and 115200 baud rate

Erase first: Should take about 10-40s.

Click start will take about 40 seconds to complete.

The firmware download takes around 40 seconds to complete, after which the status button changes from DOWNLOAD to FINISH. When the firmware has finished uploading, set DIP switch 7 to OFF, to prevent any accidental reprogramming of your new firmware.

To verify everything worked OK, start your Arduino IDE (or preferred Serial comms program), open the Serial Monitor and set it to 115,200 baud and Both NL & CR (New Line & Carriage Return). Press the Arduino Mega/WiFi’s Reset button then type in AT+GMR. You will see a line of garbage followed by:

ready
AT+GMR
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)
compile time:Jun  7 2018 19:34:26
Bin version(Wroom 02):1.6.2
OK

That’s it really, to use your Arduino WiFi combo board as if it’s a standard Mega (or Uno) with an on-board ESP WiFi chip that responds to AT commands, and works with current Arduino WiFi libraries. Just set DIP switches 1,2,3,4 ON and 5, 6, 7 OFF and the slide switch to TXD3 (Mega only).

Is Wifi working?

wifi_config.ino

/*
 WiFiEsp example: WebClient

 This sketch connects to google website using an ESP8266 module to
 perform a simple web search.

 For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-client.html
*/

#include "WiFiEsp.h"
#include "arduino_wifi.h"
char server[] = "www.google.com";

// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL3
#include "SoftwareSerial.h"
SoftwareSerial Serial3(6, 7); // RX, TX
#endif

char ssid[] = SECRET_SSID;            // your network SSID (name)
char pass[] = SECRET_PASS;        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

// Initialize the Ethernet client object
WiFiEspClient client;

void setup()
{
  // initialize serial for debugging
  Serial.begin(115200);
  // initialize serial for ESP module
  Serial3.begin(115200);
  // initialize ESP module
  WiFi.init(&Serial3);

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  // you're connected now, so print out the data
  Serial.println("You're connected to the network");
 
  printWifiStatus();
   
}

void loop()
{
  // if there are incoming bytes available
  // from the server, read them and print them
  while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }
}


void printWifiStatus()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
  IPAddress subnet = WiFi.subnetMask();
  Serial.print("Subnet: ");
  Serial.println(subnet);
}

#define SECRET_SSID "SSID_NAME"
#define SECRET_PASS "SSID_PW"

Output

Attempting to connect to WPA SSID: xxxxxxxx
[WiFiEsp] Connected to xxxxxxxxx
You're connected to the network
SSID: xxxxxxx
IP Address: 172.16.60.3
Subnet: 255.255.255.0