Repeatedly receiving "Cmd error" even with simplest examples

Hi everyone,

I recently stumbled across Blynk and am now trying to get some of the examples to work with my Arduino Nano using ESP8266 as wifi shield. However, no matter which example I try (the ESP8266_Shield one for example) after the connection is established, I always receive a “Cmd error” as shown in the serial output below (using BLYNK_DEBUG and I replaced ssid, auth token etc.). After the error it reconnects until a few seconds later the next “Cmd error” occurs and so on.

[19] Blynk v0.4.0 on Arduino Nano
[520] Connecting to XXXX
[13552] AT version: 20 2015 10:04:26)
SDK version:1.0.0
compile time:Mar 20 2015 11:00:32


[18719] Connected to WiFi
[44276] <[02|00|01|00] XXXXXXXXXXXXXXXXXXXX
[44390] >[00|00|01|00|C8]
[44390] Ready (ping: 34ms).
[44391] <[11|00|01|00]gver[00]0.4.0[00]h-beat[00]10[00]buff-in[00]256[00]dev
[44541] <[00]Arduino Nano[00]cpu[00]ATmega328P[00]con[00]ESP8266
[44617] <[00]build[00]Dec  7 2016 12:22:37[00]
[44733] >[00|00|01|00|C8]
[54704] <[06|00|02|00|00]
[59721] Cmd error

This is the sketch causing this (although it also appears with every other example I tried), the ESP8266_Shield.ino adapted to my setup:

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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXX";
char pass[] = "XXXXXXXXXX";
// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(11, 12); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 19200

ESP8266 wifi(&EspSerial);

void setup()
  // Set console baud rate
  // Set ESP8266 baud rate

  Blynk.begin(auth, wifi, ssid, pass);

void loop()

As the firmware seems to be the correct one and the initial connection works (so ssid, password and auth token are correct) I tried several possible solutions (given by this community or generally linked to ESP8266 problems) including

  • installing the newest Blynk library
  • changing wifi network security (WPA2, WPA2-WPA, WPA, Open)
  • changing the channel used by my network in order to avoid overlapping with others
  • changing the power source for Arduino and ESP8266
  • assuring that the sketch leaves enough dynamic memory
  • changing baud rate
  • using different values for delay().

I even set up my own local Blynk server and tried it all over again but that did not fix the problem. If I set up a project without Blynk using only the built-in AT commands of ESP8266, everything works fine and my wifi connection is stable.

So I would really appreciate if anyone gave me a hint towards what else could cause this problem.

@marco you mention you changed the power source, what are you suing for the ESP?

You can flash an ESP with the power from a Nano but you can’t run an ESP from it.

BLYNK_DEBUG in itself can be the problem so it’s only recommended for debugging.

Try 9600 baud rate for ESP (19200 should be ok for Serial Monitor).

Ensure you use any frequency based widgets as PUSH frequency not timed frequencies.

See Solved disconnect/cmd skipped etc issues. My advice

@Costas thanks for the quick answer. For the ESP I’m currently using an external 3V3, 1A power supply.
I tried disabling BLYNK_DEBUG but still my connection constantly fails.
Sorry, for the ESP baud rate I forgot to mention that every other value than 19200 gives me a “Failed to disable echo” error message, so in these cases there isn’t even a connection established in the first place.

Officially Blynk requires a baud rate of 9600 so you should change it with an AT command and in the sketch. See Create new page · blynkkk/blynk-library Wiki · GitHub

This is very weird error, which I encountered too when syncing few virtual pins. Yours problem is different though, hope developers can dig into it.

A note for developers (for eventual debug purposes) :
This causes disconnect after cmd error (have somewhere saved debug output, if needed)

  Blynk.syncVirtual(V7); //uint32_t
  Blynk.syncVirtual(V8); //timer widget
  Blynk.syncVirtual(V11); // slider (uint8_t)
  Blynk.syncVirtual(V20); //button
  Blynk.syncVirtual(V21); //button
  Blynk.syncVirtual(V22); //button

There are other virtual pins, which doesn’t have to be synced…

This one works fine:



@marvin7 syncing more than about 3 or 4 virtual pins in succession is a known issue. All you can do at the moment is to sync them at timed intervals (max 4 at a time).

@Costas: thanks, I didn’t know that. But the weird thing is, syncAll() works fine, syncing ALL needed pins!? AND the error is also weird - what does it means Cmd error?.. but let’s not mess marco’s topic. My problem gone after changing to syncAll()…

Unfortunately this doesn’t work either. It fixes the “Failed to disable echo” error and starts a connection but again fails a few seconds later with “Cmd error”.

@marvin7 glad to here that your problem was solved!

Out of interest, did you also just receive the “Cmd error”? Because that’s what irritates me most, every other problem related to cmd I found here always includes some “Cmd skipped” or other message following the error. Meanwhile all I get is the “Cmd error” without any further information.

Failed to disable echo is probably the big obstacle to overcome with shields so this is an important step.

Disable debug, set ALL baud rates at 9600 and keep Serial Monitor CLOSED. Report back with news.

I wonder… Maybe upgrading ESP AT firmware will help?

exactly! That is why your topic got my attention! There was cmd error, then blynk disconnected. I was sure I had the output log saved, but can’t find it now. The ‘cmd skipped’ I had later on, after some messing with code. But only after changing code as above, error(s) had gone

@Costas unfortunately this didn’t solve it either, however I figured it out and it turns out the error is not related to Blynk:

Yesterday I had the opportunity to try my whole setup at a friend’s house and it just worked “out of the box”. I was really confused because with my router I literally tried changing every single option there was, so to compare, we took a deeper look into his router settings.
Now it turns out that he uses exactly the same settings as me (WPA2, 802.11n only mode, etc.), we could not find a single difference! We were however capable of reconstructing my error by simply shortly deactivating his network and then activating it again. This produced the “cmd error” without any further information and afterwards reconnects again.

So for testing purposes I noted all of his settings, went home and made sure my router is configured exactly the same way, even using the ssid and password of his network to make sure there wasn’t some kind of special character or else messing the whole thing up.
But again the same behavior, connecting, “Cmd error”, reconnecting and so on.

So for now I am unfortunately not capable of locating the exact cause (there are no more settings I can change) but it seems to be a router specific issue (maybe a hidden setting I cannot change?).
So for everyone who runs into similar problems I would just advise: Make sure that after checking all your setup, hardware etc., you also try connecting with a different router even if there are no apparent differences in configuration etc.!

This MAY BE a router specific issue (though it’s weird). I do remember one APoint made by D-Link, which had serious connection issue with JUST ONE device. All in all I was forced to buy another… And what about DNS servers config, tryed

I am at this point 99% sure it is a router specific issue.

Unfortunately I can’t change the DNS settings in my router (the available options overall are pretty poor) so I can’t try this out but it could be a factor although my ESP is the only device facing this kind of trouble connecting to my network.

For now I found a pretty neat solution by simply configuring my Raspberry Pi as a wifi router/access point. Of course this is not really the preferable way to go when it comes to everyday usage of Blynk and the ESP but for experimenting around and trying some stuff it is actually quite nice to have a network you can simply mess around with.
By the way this is also configured exactly like my “normal” router with WPA2 and everything but it works perfectly!