Cmd Error on Arduino Mega + Esp8266

Hello
I try to search the solution of this issue but is very difficult to resolve.
i have the same error on debug: “Cmd Error” on Arduino mega 2560 + esp8266
I set the bound at 9600 on the Esp8266 with ATcommand and i write a simplest sketch with ONLY One Send every 11 sec to send 0 to Blynk app
(Blynk.virtualWrite(V38, 0):wink:

After 2/3 min there is the same error :frowning_face:
Cmd Error and after Blynk disconnect the connection

send to blynk[1915808] <[14|01]f[00|07]vw[00]38[00]0
[1920819] Cmd error
The informations are:

Lib v0.6.1 on Arduino Mega
AT version:1.6.2.0(Apr 13 2018 11:10:59)
SDK version:2.2.1(6ab97e9)


/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************

  This example shows how to use ESP8266 Shield (with AT commands)
  to connect your project to Blynk.

  WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG // debugga
#include <SimpleTimer.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "TP-LINK_Outdoor_871430";
char pass[] = "xxxxxxxxxxxxx";
  char server[]=    "192.168.1.22";
// 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 9600

ESP8266 wifi(&EspSerial);
SimpleTimer timer;
void setup()
{
  // Debug console
  Serial.begin(9600);

  delay(10);

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);
 
//  Blynk.begin(auth, wifi, ssid, pass);
   Blynk.begin(auth, wifi, ssid, pass,server,8080);
    timer.setInterval(11000L, invia);
}

void loop()
{/* Serial.print("[");
      Serial.print(millis());
      Serial.print("]");
      Serial.println("Run Blynk");
      */
       timer.run();
  Blynk.run();
}
void invia()
{ Serial.print("send to blynk");
Blynk.virtualWrite(V38,  0);
}

Thank you

How are you powering your ESP-01 ?

Pete.

i have a separate power supply of 3V.

ESP-01 power requirements are 3.3 to 3.6v @ 170mA

Pete.

There is 3.27 V with a power supply adapter
i don’t think is the power.

What sort of ping time are you getting when Bkynk connects?

Is your internet generally reliable?

Have you tried rebooting your router?

Pete.

Ready (ping: 58ms)
the server is a blynk server on the same LAN
the connection is on AP (Ubiquiti nano station 2) with channel width at 20 Mhz
i set latest firmware on this AP but there is always cmd error
i get all simple to identify the reason of this errore but is very difficult to understand

Try turning the AP off and connecting directly to the router (and place the Arduino/ESP in close proximity to the router) and see if this helps.

Pete.

OK very difficult to test it
there are more 100 mt from router to esp… the AP is outdoor to connect the esp to LAN, but i will test it

There is always the same problem cmd error
i used the simplest sketch on Arduino UNO on serial port 2 and 3 (no serial1)
// or Software Serial on Uno, Nano…
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2,3); // RX, TX

May be i have to use a different ESP like ESP32? Could work fine?

Thanks

Blockquote
[19]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.6.1 on Arduino Uno

[110] Con2:PIANO SOTTO
[6930] WIFI GOT IP
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
[12920] IP = +CIPSTA:ip:“192.168.1.13”
+CIPSTA:gateway:“192.168.1.1”
+CIPSTA:netmask:“255.255.255.0”
[12962] WOK
[23116] <[1D|00|01|00] c232d4f1eef840ddb529b5486e4de5c4
[23275] >[00|00|01|00|C8]
[23275] Ready (ping: 31ms).
[23276] Free RAM: 314
[23299] >[14|00|01|00|08]
[23318] >pm[00]54[00]in
[23354] <[11|00|02|00]fver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]256[00]dev
[28452] Cmd error

Blockquote

Do you mean replace your entire Arduino + ESP-01 combination with a NodeMCU or ESP32?
If so, then that’s the best approach in my opinion, but which board you choose depends on your requirements.
As the board will be located in a distant location then maybe something that can have an external antenna connected (such as the Wemos D1 Mini Pro) would be a good choice.

Pete.

Thanks Pete
the Wemos works like the Esp8266 ? I mean, the RX and TX works always one Arduino 's serial?

No, the Wemos should be used as a stand-alone device to replace both the Arduino Uno/Mega and the ESP-01. Read this…

Pete

On Arduino Mega i manage over 20 pin , don’t belive i can to do with Wemos.
I have to use the Arduino Mega.
I don’t understand, does that mean that Blynk on Arduino (UNO or Mega) and ESP connected together don’t work?
Why is the sketch among the examples in the Arduino IDE on BLynk Example is don’t work?

That’s why I said…

In your case it sounds like an ESP32 may be the best choice.

No, it works, but isn’t the optimal solution and I’m guessing that your current issues are caused by signal strength or network issues, which a dedicated IoT board may tolerate better - but it’s difficult to say, as you haven’t fed-back on what happens when you take your access point out of the equation.

Pete.

I’m sorry to contradict but it doesn’t work. i’m sorry to contradict but it doesn’t work. I exactly configured the tabs as expected by Blynk but it doesn’t work. I exactly configured the setup as expected by Blynk but it doesn’t work. This Arduino + ESP01 configuration does not work and should be deleted from the documentation. These tests waste a lot of time.
Fab

There are probably tens of thousands of Blynk users who would disagree with on that.

Pete.