Go Down

Topic: Mega + WiFi R3 ATmega2560 + ESP8266 (8 Mb mémoire) (Read 15278 times) previous topic - next topic


Hello every one

I would like know if some one has some information to share about this " Mega + WiFi R3 ATmega2560 + ESP8266 (8 Mb mémoire)

Thank you


Mar 27, 2017, 03:39 am Last Edit: Mar 27, 2017, 04:01 am by OtonashiRyuugen
Please try and put some research into it yourself before asking others about it, it took me two seconds of googling when i first was looking into getting mine to find the page.

The board is exactly as it says, an ATmega2560 with a ESP8266 on a form factor of a Mega breakout.

Are there good instructions out there? No, they are in russian and arnt very helpful, but allow you to set it up.

Are you going to need to play around to get it working? Yes.

Have I got it working yet? not quite how i want it but im still impressed with it.

would i suggest it? Yes.

Just please do a bit of research first before saying basically saying "i cant be bothered to do it, someone hand me the answers"



Yes I have... to use it do the following steps

1. Set the dip switch to "special" mode: (1=on, 2=on, 3=on, 4=on, 5=off, 6=off, 7=off, 8=off) see the the description of the product. ( http://www.ebay.com/itm/Mega-WiFi-R3-ATmega2560-ESP8266-USB-TTL-Arduino-Mega-NodeMCU-WeMos-ESP8266-/222305385421)

2. Set the switch in RXD3
3. Run the below sketch, change the SSID and PASSWORD values. this is just to test that Arduino and ESP8266 are working together. The code originated from BISSA ORBOEA in Element14.

#include "ESP8266.h"
#define SSID        "YOURSID"
ESP8266 wifi(Serial3,115200);
void setup() {
  Serial.println("FW Version:");
    if (wifi.setOprToStation()) {
        Serial.println("OprToStation ok");    }
        else {
        Serial.println("OprToStation  err");
    if (wifi.joinAP(SSID, PASSWORD)) {
        Serial.println("Join AP success");
        Serial.println( wifi.getLocalIP().c_str());     
    } else {
        Serial.println("Join AP failure");

void loop()

I hope this help...


I have the same board and I tried all the solutions I could find but I am still unable to communicate with the esp8266 module. Every code I tried gave me error messages. The module seems to work though cause it creates it´s own wifi network when the arduino is running.
Please help me.  :'(


I have the same problem, impossible to conect
what card select?


I have the same problem. I think that my board is defective.

When I set the DIPs for Mega 2560 it's ok fine. But when set to use ESP8266 and using serial monitor alway the board send some dirt. I try changing the serial speed, but occurs the same.

It's can only be defective. I think.

Regarding to code above, the arduino IDE don't have that library. There are some others associated with 8266, except that.

Someone have some idea?



Hi Guys,

I solve the problem. First you need to write the code for each board according your application, but in your code you need to establish a commmincation between serial port of Atmega and ESP in both code, again in according you application. Finally, put the switches which make the intenal interconnection between both.

For example, I made a code for ESP to connect in an Access Point and put on a TCP server. When a wireless client is connected in ESP and consequently in the TCP Server, all data send by client I redirect to the serial port. As serial port of ESP is connected with serial 3 of the Atmega, the code in Atmega pass to theat the data from serial 3.

It's all!




Before you upload the sketch which board did you choose? When I choose the Atmega2560 board error come up.


For upload the sketch to the board:
5, 6, 7 ON
For run the sketch:
5 and 6 ON
It works



here a good manual. it solve any doubt



isotopa@ thank you very much for your sharing, I also have the exactly the same of your board, and I have try many time with that board. when I try  with Mega alone it works fine, and also alone with Esp works fine. But I found that I cannot use the AT Command to the esp even I already updated new firmware... that is the problem of esp? In my case for my project... I just want to send the sensors data such Temperature or Humidity from Mega pins to the Firebase via built-in Esp8266 on board. I want to start esp from mega by the AT Command via the Serial ports, but I found esp seem doesn't works with AT Command. Now my project still stuck at all. 

Question 1: Do you think, Is it possible to start ESP from Mega via the Serial ports by AT Commands?
Question 2: Do we have to program to both of that , esp and mega?
Question 3: Which board did you select when upload the sketch? "Generic ESP8266 Modules" or "Mega2560"?

I hope you catch what I mean, and happy to provide more information if needed, Thank you again for sharing.


After I try many week, now it works. Follow this if you have the same to my cases:
1. programm to the ESP(upload sketch) for wifi connection by configure the DIP to 5:on,6:on,7:on and other off.
2. program to mega(upload sketch) in case you want to send communication to each other by configure Dip to 3:on,4:on, and other off.
3. switch two  RX0/TX0(in my case I use Serial.print() and Serial.readString() for communicate between Esp and Mega)
4. after you already upload sketch to both Modules you can test communication between them by configure DIP to: 1:on,2:on,3:on,4:on. and then press Reset Button to restart the boards.

5. In ESP you can get the string from Mega by  if(Serial.available()) Serial.readString();  and In mega you can get data from ESP by : if(Serial.available())Serial.readString(). 
6. After you got a string so you can split or do anything whatever you want.
7. If you want send data to Firebase you must use the Firebase Library at the Esp side, in Mega it not support.

*** This work for me, I hope it can help you. Good luck.


In my case
Send from Mega
Serial.println('some text');
ESP read
if(Serial.available()) Serial.readString();

Send From ESP
Serial.println('some text');
Mega read
if(Serial3.available()) Serial3.readString();


receive on ESP from Mega works only when RXD0 - TXD0, Mega does not receive in this case

receive on Mega from ESP works only when RXD3 - TXD3, ESP does not receive in this case

It is possible at the same time to make connection from mega to esp and from esp to mega?



I know how to connect a readymade esp8266 slave module to a Mega using Serial port and using AT command set.

In this board - "Arduino Mega 2560 R3 with integrated WiFi chip ESP8266", the WiFi module is not accepting AT commands.

What code should I program in it so that it becomes similar to readymade slave module?

Thanks in advance.
Prakash W Dandekar
Evangelist Motivator, Trainer and Speaker, Visiting Faculty in Engg colleges; Former Visiting Prof. IIT Gandhinagar & Indore, India


Anyone managed to get the esp8266 from that board to work properly?

I've uploaded my script successfully to the ESP with pins 5, 6 and 7 ON. (tried with RXD0 and RXD3 without change).

I'm also able to get the serial output from ESP with pins 5 and 6 ON.

The problem I currently have is that the ESP does not seems to see my wifi. I've tried the same code to a NodeMCU and another ESP board and they connect almost instantly.

I've enabled ESP debug using that config in my platformio.ini (I'm using platformio to upload the firmware to the ESP) :
Code: [Select]

platform = espressif8266
board = d1_mini
framework = arduino
build_flags =

What I'm seeing from the console, is that the ESP on the "Mega + WiFi R3 ATmega2560 + ESP8266" board see way less wifi than any other ESP board I have... It see between 0 to 3 Wifi when other boards can see up to 20 networks around.
(see log below)

I've even tried with an antenna on the board but that changed absolutely nothing..
I've also used a 12v power supply thinking the 5v usb power should not be enough..
I've 2 of those boards.. They both give me the same result : Poor network resolution.

Also, my wifi network is the one with the strongest signal when I check with my computer or my phone from the same location the board is located.

Can't figure out why it see so less network around.. Any idea???

Script :

Code: [Select]

#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>

ESP8266WiFiMulti WiFiMulti;

void setup() {

 // We start by connecting to a WiFi network
 WiFiMulti.addAP("412 Precondition Failed", "MY WIFI PASS");

 Serial.print("Wait for WiFi... ");

 while (WiFiMulti.run() != WL_CONNECTED) {

 Serial.println("WiFi connected");
 Serial.println("IP address: ");


void loop() {

Console output (other ESP boards display like 20 networks)
Code: [Select]

[WIFI][APlistAdd] add SSID: 412 Precondition Failed

Wait for WiFi... [WIFI] delete old wifi config...
[WIFI] start scan
[WIFI] scan done

[WIFI] 1 networks found
       0: [1][3C:90:66:zz:zz:zz] EBOX-4229 (-87) *

[WIFI] no matching wifi found!
.[WIFI] delete old wifi config...
[WIFI] start scan
[WIFI] scan done
[WIFI] 2 networks found
       0: [1][3C:90:66:zz:zz:zz] EBOX-4229 (-87) *
       1: [1][40:65:A3:zz:zz:zz] BELL062 (-82) *

[WIFI] no matching wifi found!
.[WIFI] delete old wifi config...
[WIFI] start scan
[WIFI] scan done
[WIFI] 2 networks found
       0: [1][3C:90:66:zz:zz:zz] EBOX-4229 (-86) *
       1: [1][54:64:D9:zz:zz:zz] BELL387 (-90) *

When turning it in AP mode, I can't connect to it, it drop immediately as I try to connect to it..

Go Up