WiFi Shield Mega+ESP32 how to connect

Hi all.
i want to create Mega2560+ESP32 wifi shield
But how to connect it together?
i connect RX/TX ground and vin, but here is the error
[14] WiFi module not found

https://examples.blynk.cc/?board=Arduino%20Mega%202560&shield=Arduino%20WiFi%20Shield&example=GettingStarted%2FBlynkBlink

Maybe you should read this topic:

Then ask yourself why would you want to use an ESP32 as a Wi-Fi modem for an Arduino when the ESP has much more processing power, memory etc.

Pete.

1 Like

Wow… now we go from peddling motorbikes to adding propellers on rockets :stuck_out_tongue:

2 Likes

too many flooding, too little useful

Why wasn’t that link useful?

Pete.

oops. sorry Pete I didn’t see the first answer. How can I use this version?

Its adding turbo to a motorcycle :stuck_out_tongue_winking_eye:

1 Like

I don’t understand the question.

Pete.

If only it did :slight_smile: … but the WiFi transceiver function (when used as a shield) will be the same transmission speed on a ESP-0, NodeMCU or ESP32. No benefit to the Arduino, just increasingly waisted potential for the ESP.

1 Like

@RazorLine Lets start with WHY you want to use a perfectly good ESP32 with, much more “horsepower” and flexibility and even a fair chunk of the I/O of an Arduino Mega… all to act as a simple lobotomised WiFi Transceiver?

Then if that answer makes sense to anyone… read through that other topic and see that in the end, all that was needed was flashing the ESP8266 AT firmware onto the NodeMCU. However, an ESP32 is NOT an ESP8266… thus there may NOT be any AT firmware even available for it to use in such a fashion (Yes, I said this about the NodeMCU… but this time I think I might even be correct :stuck_out_tongue_winking_eye: ).

I will use mega instead of esp32 because I need 16 sensors.
I will use esp32 instead of esp8266 because there is no good working library what can work with static ip.

For Pete: You wrote that you have earned a bunch of Mega/UNO and ESP. Write in detail how you achieved this, please lay out a sketch, to which contacts you connected and so on.

For all: Please take You mega and esp32(esp8266 v3) and try to solve this problem. May be it’ll work perfect in you hands. Thanks a lot.

I’m not sure where you’ve read that, but I’ve never bothered to use an ESP and an Arduino together, in the same way that I’ve never felt the need to stick pins in my eyes.

When you say esp8266 v3 I assume that you mean a NodeMCU v3 dev board?
There’s a big difference between an ESP8266 and an ESP32. I doubt if many people will take the time to try this for themselves, it’s a bit of a pointless exercise and most folks have better things to do with their time.

@Gunner thinks that maybe ESP32s doesn’t ship with AT firmware installed. There’s an easy way to try this with your ESP32 (assuming that’s what you have). Connect it to your terminal monitor at the correct baud rate (you’ll know that it’s correct when you see readable messages at boot time) and issue an “AT” command. If you get the reply “OK” then you will probably be able to use it as a Wi-Fi shield. If not then you’ll need to find some AT firmware, or a different solution.

I doubt very much that this statement is true.
As I said before I don’t use an Arduino/ESP combo, and I also don’t use Blynk in the same way as most other people, but I do use static IP addresses - specified in code - on all of my ESP8266 devices.

I’ve only dabbled with a couple of ESP32s, but one of their big advantages is that they have many more GPIOs that an ESP8266. Not all dev boards make all of the pins available, but with the right board you should be ble to do what you wnat without the need for an Arduino in the equation. This article may help:

The other alternative is to add a cheap multiplexor to an ESP8266 to add more GPIOs. Or, you could do what I and many others do which is to use multiple devices. I find that in practice it’s very rare that you want lots of sensors in the same physical space - unless you’re doing something like monitoring the individual temperatures of a large bank of batteries - in which case I’d use I2C bus temperature sensors and solve the problem that way.
When you have sensors in different physical locations then it makes sense to connect them to a number of remotely located MCUs. Blynk makes this very easy as each device will have its own Auth code and they can all separately send data to the Blynk server then the app can pull that data together into one place.

I think you’re on your own when it comes to the Arduino/ESP32 thing, but if you want to explore different (and probably more sensible) alternatives then share some information about what it is you’re trying to achieve and I’m sure forum members will be happy to chip-in with advice, suggestions and help.

Pete.

1 Like

Many thanks Pete, you answers is very detailed.
static IP addresses on all of my ESP8266 devices work good to. But not in conjunction with mega.
I have already ordered multiplexers, they will arrive soon. But I would like for general development to make mega and esp work

Yep… I didn’t even think of checking :blush: But then that would have been like checking if a new car still has that old turn handle starter crank :rofl:

Mine all have Blynk code so, you are right… not a chance :stuck_out_tongue:

I believe you are all on your own for this endeavor.

EDIT - Of course you could always run the ESP32 as full dev board it is, and link the Mega (running normal code) via Serial or i2c with something like EasyTransfer

ESP32 has a firmware, other projects work on it.

I actually know that :stuck_out_tongue_winking_eye: … I was simply saying using it as a simple shield had never even crossed my mind… and I am still a firm believer and user of that method, with ESP-01.

Look at my last edited post… dual MCU is probably your best bet… use both devices for even MORE POWA

I also want to try to send sensor data via the serial and the sensor identifier to the ESP and then send it to the blynk

Dual power of two esp32 is the best solution :slight_smile:

1 Like

i did it.

With Mega pass to the port ECP 32 (nodemcu v3) a string of digits separated by spaces
ESP translates the string into an array, assigns the array elements a port, and passes it to Blynk.
There is protection against incorrect data in the form of a special character check “,”.
Used 16 sensors - 12 MLX90615, 1 DHT, MQ135, HC SR04
The mega + sensors are powered directly from the ESP. There are no additional resistors, diodes, capacitors.
With Mega, the decimal digits are passed multiplied by 100, on the receiver divided by 100.0 for convenience.

If RX/transmitter TX = RX/TX receiver, the port monitor get the row mega
If RX/TX transmitter = TX/RX receiver, then the monitor port receive line with ESP
//very convenient

With Mega, I have, moves away line in the form of:
, 2275 2269 2275 2303 2417 2255 2269 2231 2241 2275 2222 2441 2820 1400 824 157

#include <WiFi.h>
#include <WiFiMulti.h>

#define SSID "YOUSSID"
#define PASS "YOUPASS"
#define TIME 1000 // Частота отправки данных (в мс)

#define BLYNK_PRINT Serial
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#define I_Simvol 500    //Длина буфера принятых символов, много, но так надо
#define I_Buf 170        //Длина буфера результата, много, но так надо
int KolicSimvolov = 0;  //Сколько получили байт
int Simvol [I_Simvol];  //Буфер для принятых символов
int Buf[I_Buf];         //Буфер для результата
int i, i2;              //Счетчики


WiFiMulti wifiMulti; const char* ssid = SSID; const char* password = PASS; char auth[] = "YOUBLYNKAUTH";


IPAddress local_IP(192, 168, 1, 42); IPAddress gateway(192, 168, 1, 202); IPAddress subnet(255, 255, 255, 0); IPAddress primaryDNS(8, 8, 8, 8); IPAddress secondaryDNS(8, 8, 4, 4);
WiFiServer server(80); WiFiClient serverClients;

void setup () {

  Blynk.begin(auth, SSID, PASS, IPAddress(192, 168, 1, 205), 8080); //Blynk.begin(auth);// Blynk.begin(auth, ssid, pass);  // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);


  Serial.begin(9600);
  WiFi.begin(ssid, password);
  if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("STA Failed to configure");
  }

  Serial.print("Connecting to ");  Serial.println(ssid);  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");  Serial.println("WiFi connected!");  Serial.print("IP address: ");  Serial.println(WiFi.localIP());  Serial.print("ESP Mac Address: ");  Serial.println(WiFi.macAddress());  Serial.print("Subnet Mask: ");  Serial.println(WiFi.subnetMask());  Serial.print("Gateway IP: ");  Serial.println(WiFi.gatewayIP());  Serial.print("DNS: ");  Serial.println(WiFi.dnsIP());

  server.begin();  server.setNoDelay(true);
}


void loop () {
  Blynk.run();


  while (Serial.available() > 15) {
    char c = Serial.read();
    if (c == ',') {

      for (i = 0; i < I_Simvol; i++) Simvol[i] = 0; //обнулить буфер приема
      for (i = 0; i < I_Buf; i++) Buf[i] = 0;       //обнулить буфер результата
      /*Получение данных*/
      KolicSimvolov = Serial.available();       // Сколько получили байт
      delay(20);//Нужна эта долбаная задержка иначе будет читать НЕ ВСЕ символы в одну строку
      if (KolicSimvolov > 0) {
        for ( i = 0; i < KolicSimvolov; i++) {  // Читаем все данные из порта
          Simvol [i] =  Serial.read();            // читаем байт
          // Serial.println(Serial.read());
          delay(20);
        } /*Данные получены*/

        /*АНАЛИЗ ПОЛУЧЕННЫХ ДАННЫХ*/
        i = 0;
        i2 = 0;
        while (i < KolicSimvolov) {
          if (Simvol[i] >= 48 && Simvol[i] <= 57) {     //если цифра
            Buf[i2] = Buf[i2] * 10 + (Simvol [i] - 48); //Накапливаем переменную
            i++;
          }
          else {   //если НЕ цифра (любой символ)
            i2++;  //переходим к следующему элементу буфера результата
            i++;
          }
        }
        Serial.flush();//очистка буфера

        /*проверка*/
        for (i = 0; i < I_Buf; i++) {
          //Serial.println(Buf[i]);

          Serial.println("");
          float t1 = (Buf[1] / 100.0);
          Serial.print("T01=");
          Serial.print(t1);
          Serial.print(" ");
          float t2 = (Buf[2] / 100.0);
          Serial.print("T02=");
          Serial.print(t2);
          Serial.print(" ");
          float t3 = (Buf[3] / 100.0);
          Serial.print("T03=");
          Serial.print(t3);
          Serial.print(" ");
          float t4 = (Buf[4] / 100.0);
          Serial.print("T04=");
          Serial.print(t4);
          Serial.print(" ");
          Serial.print("Tср1=");
          Serial.print((t4 + t3 + t2 + t1) / 4);

          Serial.println("");
          float t5 = (Buf[5] / 100.0);
          Serial.print("T05=");
          Serial.print(t5);
          Serial.print(" ");
          float t6 = (Buf[6] / 100.0);
          Serial.print("T06=");
          Serial.print(t6);
          Serial.print(" ");
          float t7 = (Buf[7] / 100.0);
          Serial.print("T07=");
          Serial.print(t7);
          Serial.print(" ");
          float t8 = (Buf[8] / 100.0);
          Serial.print("T08=");
          Serial.print(t8);
          Serial.print(" ");
          Serial.print("Tср2=");
          Serial.print((t8 + t7 + t6 + t5) / 4);

          Serial.println("");
          float t9 = (Buf[9] / 100.0);
          Serial.print("T09=");
          Serial.print(t9);
          Serial.print(" ");
          float t10 = (Buf[10] / 100.0);
          Serial.print("T10=");
          Serial.print(t10);
          Serial.print(" ");
          float t11 = (Buf[11] / 100.0);
          Serial.print("T11=");
          Serial.print(t11);
          Serial.print(" ");
          float t12 = (Buf[12] / 100.0);
          Serial.print("T12=");
          Serial.print(t12);
          Serial.print(" ");
          Serial.print("Tср3=");
          Serial.print((t12 + t11 + t10 + t9) / 4);

          Serial.println("");
          float t13 = (Buf[13] / 100.0);
          Serial.print("T=");
          Serial.print(t13);
          Serial.print(" ");

          int t14 = (Buf[14] / 100);
          Serial.print("H=");
          Serial.print(t14);
          Serial.print(" ");

          int t15 = (Buf[15]);
          Serial.print("CO2=");
          Serial.print(t15);
          Serial.print(" ");

          int t16 = (Buf[16]);
          Serial.print("D=");
          Serial.print(t16);
          Serial.println("");


          Blynk.virtualWrite(V51, t1);
          Blynk.virtualWrite(V52, t2);
          Blynk.virtualWrite(V53, t3);
          Blynk.virtualWrite(V54, t4);
          Blynk.virtualWrite(V55, t5);
          Blynk.virtualWrite(V56, t6);
          Blynk.virtualWrite(V57, t7);
          Blynk.virtualWrite(V58, t8);
          Blynk.virtualWrite(V59, t9);
          Blynk.virtualWrite(V60, t10);
          Blynk.virtualWrite(V61, t11);
          Blynk.virtualWrite(V62, t12);
          Blynk.virtualWrite(V63, t13);
          Blynk.virtualWrite(V64, t14);
          Blynk.virtualWrite(V65, t15);
          Blynk.virtualWrite(V66, t16);

//На всякий случай еще разок
          for (i = 0; i < I_Simvol; i++) Simvol[i] = 0; //обнулить буфер приема
          for (i = 0; i < I_Buf; i++) Buf[i] = 0;       //обнулить буфер результата
          Serial.flush();//очистка буфера


        }
      }
    }
  }
}

Thank you all who helped real advice, sent, supported, helped and etc. (if, indeed were).

1 Like