Wemos Mega +WiFi R3 Module ATmega2560+ESP8266

Hi,

Really struggling to get this board working. I have read so many different posts and tutorials and none of them work and some are also conflicting with others. It's been about 10 hours of frustration and I would really like to ask for help.

I have brought 2 Wemos® Mega +WiFi R3 Module ATmega2560+ESP8266 from Banggood

I do not seem to understand this board and how to make it work as some posts say you have to upload some firmware (somehow) but don't tell you where to get this firmware. Some posts say just set the dip switches and upload a script (which I have tried but does not work)

So, if someone who has one of this boards could take a few mins to explain I would be truly greatful.

So, with the board out of the static bag, what should be my first job at getting this board to work. Say let's get the WiFi working first.

I have in the IDE already done the Additional Boards (http://arduino.esp8266.com/stable/package_esp8266com_index.json) bit and set the board to be Generic ESP8266 Module.

  1. what position does the dip switches need to be in plus the RX/TX switch position
  2. Do I need to upload some firmware, if so where from an how on a win10 PC
  3. Do I need to add an ESP8266 Library (I have tried run a test script but it can not find esp8266.h, so presume a library is needed. I download the GitHub - Hieromon/ESP8266: ESP8266 WiFi module Library for Arduino library but then it complaind "WIFI was not declared in this scope)

The script was

#include "Arduino.h"
#include "ESP8266.h"

#include "SoftwareSerial.h"
SoftwareSerial  ConsoleOut(8, 9);

#define SSID  "CZGB"
#define PWD   "whdhdudt"

void setup() {
  char  *ipAddress, ap[31];

  WiFi.reset(WIFI_RESET_HARD);
  WiFi.begin(9600);
  if (WiFi.join(SSID, PWD) == WIFI_ERR_OK) {
    ipAddress = WiFi.ip(WIFI_MODE_STA);
    ConsoleOut.print(F("\n\rIP address:"));
    ConsoleOut.print(ipAddress);
    ConsoleOut.print(':');
    if (WiFi.isConnect(ap))
      ConsoleOut.println(ap);
    else
      ConsoleOut.println(F("not found"));
  } else
    while (1);
}

void loop() {
  if (WiFi.connect((char *)"www.google.co.jp", 80) == WIFI_ERR_CONNECT) {

    if (WiFi.send((const uint8_t *)"GET / HTTP/1.1\r\n\r\n") == WIFI_ERR_OK) {
      int16_t c;
      uint16_t len = WiFi.listen(10000UL);
      while (len)
        if ((c = WiFi.read()) > 0) {
          ConsoleOut.write((char)c);
          len--;
        }
    } else
      ConsoleOut.println(F("Send fail"));

    WiFi.close();

  } else
    ConsoleOut.println(F("TCP connect fail"));

  WiFi.disconnect();

  while (1);
}

If I can get this part completed then I can try and get the connection to the Mega side.

Thanks

On this board you have an USB to TTL Serial adapter, an Atmega 2560 MCU and an esp8266 WiFi MCU.
If this would be solo modules, you would connect them with wires RX to TX. Here you have DIP switches in pairs. One for RX, and one for TX.

Only 2 device can connect their RX and TX pins together. (2560 has more RX, TX pins)

You can connect

  • USB to 2560 for upload and Serial Monitor to 2560. - esp8266 is out
  • USB to esp8266 for upload and Serial Monitor to esp8266 - 2560 is out
  • 2560 to esp 8266 to communicate between MCU. here are too option
    -- connect on Serial of 2560 - USB is out
    -- connect on Serial3 of 2560 - in this case you can use USB to 2560 too so this is the best option

The Internet is full of tutorials about Arduino and esp8266 module. Use them. Only instead of rewiring, switch the DIP switches.

Thanks for the reply.

I have had some success

I have now been able to upload a script to the Mega, and also separate sketch to the esp8266.

It was not all clear cut as I said previously there are many conflict posts on using this type of board and about upload firmware etc.

So, currently I can setup the esp8266 as an access point and connect to it from my iphone.

Here is what I did to help other get a basic setup working on this Wemos Mega +WiFi R3 Module ATmega2560+ESP8266 board

Arduino Mega First Time

Some Info
Table DIP switch:

1=ON 2=ON 3=OFF 4=OFF 5=OFF 6=OFF 7=OFF 8=OFF (ATmega2560<->ESP8266)
1=OFF 2=OFF 3=ON 4=ON 5=OFF 6=OFF 7=OFF 8=OFF (USB <->ATmega2560)
1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=ON 8=OFF (USB<->ESP8266 (Update firmware or sketch))
1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=OFF 8=OFF (USB<->ESP8266 (communication))
1=OFF 2=OFF 3=OFF 4=OFF 5=OFF 6=OFF 7=OFF 8=OFF (All independent)

Table DIP switch Special Solution:
1=ON 2=ON 3=ON 4=ON 5=OFF 6=OFF 7=OFF 8=OFF (USB <-> ATmega2560<-> ESP8266)
USB converter CH340G connect to RX0/TX0 of ATmega2560
ESP8266 connect to RX3/TX3 of ATmega25

Welcome to ESP8266 Arduino Core’s documentation! — ESP8266 Arduino Core 2.7.1-106-g1a381477 documentation for ESP8266 documentation

Start
Set the Additional Boards URL to http://arduino.esp8266.com/stable/package_esp8266com_index.json in preferences

Under Tools select Board then Board Manager, then install the esp8266 by ESP8266 Community

Under Tools select Board then select the “Arduino/Genuino Mega or Mega 2560”

Set the DIP switches on the actual board to 1=OFF 2=OFF 3=ON 4=ON 5=OFF 6=OFF 7=OFF 8=OFF (USB <->ATmega2560)

Paste the following sketch into the IDE, save and upload and if check the LED flashes

/*
Blink
Turns on an LED on for 3 seconds, then off for one second, repeatedly.
*/
int ledpin = 13;
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(ledpin, OUTPUT);
}

void loop() {
digitalWrite(ledpin, HIGH); // set the LED on
delay(3000); // wait for a second
digitalWrite(ledpin, LOW); // set the LED off
delay(1000); // wait for a second
}

The LED should come on for 3 seconds, then off for a second and repeat.

Set the DIP switches on the actual board to 1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=ON 8=OFF (USB<->ESP8266 (Update firmware or sketch))

Under Tools select Board then select the Generic esp8266 Module

Paste the following sketch into the IDE, save and upload

/* Create a WiFi access point and provide a web server on it. */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

/* Set these to your desired credentials. */
const char *ssid = “Mega”;
const char *password = “12345678”;

ESP8266WebServer server(80);

/* Just a little test message. Go to the IP address you setup below in a web browser
connected to this access point to see it.
*/
void handleRoot() {
server.send(200, “text/html”, “

You are connected

”);
}

void setup() {
delay(1000);
Serial.begin(57600);
Serial.println();
Serial.print(“Configuring access point…”);
//--------------------------------------------

IPAddress local_IP(192,168,0,20);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
Serial.print("Setting soft-AP configuration … ");
Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? “Ready” : “Failed!”);

Serial.print("Setting soft-AP … ");
Serial.println(WiFi.softAP(“ESPsoftAP_01”) ? “Ready” : “Failed!”);

Serial.print("Soft-AP IP address = ");
Serial.println(WiFi.softAPIP());

//--------------------------------------------
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);
// IPAddress myIP = WiFi.softAPIP();
Serial.print(“AP IP address: “);
//Serial.println(myIP);
server.on(”/”, handleRoot);
server.begin();
Serial.println(“HTTP server started”);
}

void loop() {
server.handleClient();
}

Set the DIP switches on the actual board to 1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=OFF 8=OFF (USB<->ESP8266 (communication))

Then open the Serial Monitor or press the reset button

Then with a wifi enabled device (eg iPhone or Android), goto the wifi section and connect to the Access Point using your details above.
Once connected open a browser and put the IP address in and you should see the “You are connected”

Hello mister, do we have BUILT_IN LED on the ESP8266 unit in this WEMOS MEGA WIFI board?
On node MCU V3 board we have built in led on GPIO2.

Best regards.
NewPrasertKitt

SniffTheGlove:
Thanks for the reply.

I have had some success

I have now been able to upload a script to the Mega, and also separate sketch to the esp8266.

It was not all clear cut as I said previously there are many conflict posts on using this type of board and about upload firmware etc.

So, currently I can setup the esp8266 as an access point and connect to it from my iphone.

Here is what I did to help other get a basic setup working on this Wemos Mega +WiFi R3 Module ATmega2560+ESP8266 board

I can't seem to get this working on the esp8266 module, the ip address page doesn't work and neither does the serial monitor, just random characters even after tinkering with the baud rates.

Did you end up getting it to work?

In response to Papayee, having trouble using ESP8266 connection to WiFi, try this code. See if it works for you. Of course, change ssid and password for your router. You can access this server at http>//esp8266ooo.local or at the IP address printed on the serial monitor. You have to set the DIP switches as shown in the code to load and then change them again to be able to see the serial monitor output

/*

  • Set the DIP switches on the actual board to
    1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=ON 8=OFF (USB<->ESP8266 (Update firmware or sketch))
    Under Tools select Board then select the Generic esp8266 Module
    After sketch is uploaded, but want to see Serial output, change DIP to
    1=OFF 2=OFF 3=OFF 4=OFF 5=ON 6=ON 7=OFF 8=OFF (USB<->ESP8266 (communication))
    see:
    17j ~/Arduino/MegaESP8266Combo/ESP8266WiFi2
    */

/* Create a WiFi access point and provide a web webserver on it. */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

/* Set these to your desired credentials. */
const char *ssid = “x”;
const char *password = “y”;

ESP8266WebServer webserver(80);
const int led = LED_BUILTIN;

/* Just a little test message. Go to the IP address you setup below in a web browser
connected to this access point to see it.
*/

// subroutines
// ------------------ begin void handleRoot()
void handleRoot() {
webserver.send(200, “text/html”, “

You are connected

”);
} // ------------------end void handleRoot()

// ------------------------------ begin void handleNotFound()
void handleNotFound() {
digitalWrite(led, 1);
String message = “File Not Found\n\n”;
message += "URI: ";
message += webserver.uri();
message += "\nMethod: ";
message += (webserver.method() == HTTP_GET) ? “GET” : “POST”;
message += "\nArguments: ";
message += webserver.args();
message += “\n”;
for (uint8_t i = 0; i < webserver.args(); i++) {
message += " " + webserver.argName(i) + ": " + webserver.arg(i) + “\n”;
}
webserver.send(404, “text/plain”, message);
digitalWrite(led, 0);
} // --------------------- end void handleNotFound()

// -------------------- begin void setup()
void setup() {
pinMode(led, OUTPUT);
digitalWrite(led, 0);
delay(1000);
Serial.begin(115200);
delay(10);
WiFi.mode(WIFI_STA);
Serial.println();
Serial.println(“This program 17j ~/Arduino/MegaESP8266Combo/ESP8266WiFi2”);
Serial.print(“Configuring access point…”);
//--------------------------------------------

/* You can remove the password parameter if you want the AP to be open. */
WiFi.begin(ssid, password);
Serial.println("");

// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
} // end while
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

if (MDNS.begin(“esp8266ooo”)) {
Serial.println(“MDNS responder started”);
Serial.println(“connect to http://esp8266ooo.local/”);
}
webserver.on("/", handleRoot);
webserver.on("/inline", {
webserver.send(200, “text/plain”, “this works as well”);
});
webserver.onNotFound(handleNotFound);
webserver.begin();
Serial.println(“HTTP webserver started”);
} // --------------------- end void setup()

// ----------------------- begin void loop()
void loop() {
webserver.handleClient();
MDNS.update();
} // ------------------- end void loop()

ESP8266WiFi2.ino (3 KB)

I've tried your code (THANKS!) and "something" is working :slight_smile:
But it only works when monitor baudrate is set to 74880 ... ? I tried all other available baudrates in the monitor, but only gives readable stuff on this (odd) baudrate.
When I start the monitor (or reset the arduino with the resetbutton) I get this on the monitor :

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c

and then : nothing anymore ... :frowning:

anyone a suggestion ? please ?
an advanced tanx in advance !

PS. haven't connected the antenna (yet) but I'm less than 6 feet (2m) away from my router. if the antenna is the culprit, I should get errror messages, no ?

PaulVdB:
I've tried your code (THANKS!) and "something" is working :slight_smile:
But it only works when monitor baudrate is set to 74880 ... ? I tried all other available baudrates in the monitor, but only gives readable stuff on this (odd) baudrate.
When I start the monitor (or reset the arduino with the resetbutton) I get this on the monitor :

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c
ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0xef
csum 0xef
csum err
ets_main.c

and then : nothing anymore ... :frowning:

anyone a suggestion ? please ?
an advanced tanx in advance !

PS. haven't connected the antenna (yet) but I'm less than 6 feet (2m) away from my router. if the antenna is the culprit, I should get errror messages, no ?

no. if the esp8266 needs more power then it can get, it crashes this way. without the antenna it draws more power to transmit

Juraj:
no. if the esp8266 needs more power then it can get, it crashes this way. without the antenna it draws more power to transmit

Ah ! Juraj ! Good to see you here too!

Because my failing experiments with the ESP-01 and Uno, I started to guess that my ESP01 module is broken...
But now you saw that I'm experimenting with a Wemos Mega. So I guess that the power requirements for the onboard ESP8266 are sufficient, and no 3.3-5V converter is necessary.
Still, it doesn't work... I must forget or mistake something basic. I searched the internet for solutions/examples, but I can't get anything to work.
My final goal is to have a Nano (outside, collecting about 20 values from Solar panel and environment) send those data to e.g. a Wemos Mega. It would be nice to do this over the wifi, so that I can monitor those values not only the Wemos (+display), but eventually on any internet connected device (BLYNK ?). I know it's (for ME) a long way to go, but time is on my side and I'm not afraid of trial and (sadly enough) errors ... Collecting the Data with the Nano works (I use serial, analog and digital). But now I need/want to communicate those data and I want to learn this step by step. So I thought that it would be a good start to try to communicate with the 8266... but you know ... searching and trying for about a week hasn't give me ANY results ... not with Nano, not with Uno, not even with Wemos Mega... :frowning:
So for the moment I would be extremely happy when I type in my serial monitor "AT" and get the response "OK".
Nevertheless : thanks for your cooperation, Juraj
and of course thanks for all the other contributors !!!

I spent hours in attempts to make my first esp-01 work. And I worked with 5 different esp8266 boards before. But all the boards before had 5 V to 3.3 V power conversion.

In the end it was two problems. First was powering. The USB to TTL Serial adapters can't supply enough power on 3.3 V pin. They can on 5 V pin because it is the USB 5 V, but not on the 3.3 V pin. It is enough to flash the application, but the esp8266 starts SoftAP at default and the module crashes on brownout.

The second problem was, that my esp-01 has only DOUT mode for flash memory. It flashed in any mode, but was unable to run the application (firmware or sketch). It had checksum error in boot log, like you have.

Juraj:
I spent hours in attempts to make my first esp-01 work. And I worked with 5 different esp8266 boards before. But all the boards before had 5 V to 3.3 V power conversion.

In the end it was two problems. First was powering. The USB to TTL Serial adapters can't supply enough power on 3.3 V pin. They can on 5 V pin because it is the USB 5 V, but not on the 3.3 V pin. It is enough to flash the application, but the esp8266 starts SoftAP at default and the module crashes on brownout.

The second problem was, that my esp-01 has only DOUT mode for flash memory. It flashed in any mode, but was unable to run the application (firmware or sketch). It had checksum error in boot log, like you have.

Again, thanks for your reply !
I can understand that when there's not enough power to the ESP01 board, that it is asking for problems. But now I've put the ESP01 board and Nano away, and took a WEMOS MEGA. On this board, with 8266 ON BOARD, we may assume that the board provides enough 3.3V power to have it working (in whatever mode) when the Wemos board itself is powered by a 12V/20A power supply...
Using a Wemos Mega board, and only wanting to see "OK" on the Serial monitor after typing in "AT", shouldn't be that difficult, no ?
So Again : what do I do wrong ???

Also again : THANKS !!!

PaulVdB:
So Again : what do I do wrong ???

Also again : THANKS !!!

try DOUT setting while flashing the AT firmware

I assume you did flash the AT firmware. Which version and which tool you used to flash it?

Errrr... flash AT firmware ?
Don't these Wemos Megas come with AT "preflashed" ?

PaulVdB:
Errrr... flash AT firmware ?
Don't these Wemos Megas come with AT "preflashed" ?

yes, but then it should work. unless it would work only with antenna

Thanks to all the posts here and days of frustrations with this board I was able to write some sketches and make them work.

I must admit this is the most frustrating and annoying boards I have ever encountered so far and I have many variety of them. None the less, one important question I have.

For some strange reason I was only able to activate reasonable WiFi connectivity and useful sketches directly onto the ESP8266 and get meaningful results. However, I’d like to make the ATmega2560 activate multiple motors in response to WiFi input/output and so far I was able to accomplish that by only uploading directly to the ESP8266.
This might be a bit vague but any suggestion or samples to upload directly to the ATmega2560 sketches that work with the ESP8266 would be appreciated.

mastool:
Thanks to all the posts here and days of frustrations with this board I was able to write some sketches and make them work.

I must admit this is the most frustrating and annoying boards I have ever encountered so far and I have many variety of them. None the less, one important question I have.

For some strange reason I was only able to activate reasonable WiFi connectivity and useful sketches directly onto the ESP8266 and get meaningful results. However, I'd like to make the ATmega2560 activate multiple motors in response to WiFi input/output and so far I was able to accomplish that by only uploading directly to the ESP8266.
This might be a bit vague but any suggestion or samples to upload directly to the ATmega2560 sketches that work with the ESP8266 would be appreciated.

it is not the board. with external esp8266 module you would have the same problems or more

I would LOVE to see a schematic for this. I didn't realize it came with no documentation at all.
I got the Wingoneer version from Amazon

dbvanhorn:
I would LOVE to see a schematic for this. I didn't realize it came with no documentation at all.
I got the Wingoneer version from Amazon

scroll down and switch to Documents tab

Thank you! I wasn't seeing the documents tab as it was getting buried under other text for some reason.
That will clear up a lot.