Buffer overflow while run sample esp8266_shield_softser after a few minute

i run sample esp8266_shield_softser with uno r3,it working but not stable,and show buffer overflow after a few minute

please share your code

sample in library

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_SoftSer.h>
#include <BlynkSimpleShieldEsp8266_SoftSer.h>

// Set ESP8266 Serial object
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

ESP8266 wifi(EspSerial);

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

void setup()
// Set console baud rate
// Set ESP8266 baud rate
// 9600 is recommended for Software Serial

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

void loop()

Are you trying ethernet or wifi? Because you mention the ethernet adapter, but your code says you are using the wifi adapter.

my mistake…!

Have you tried using hardware serial? I mean, you can’t get serial output anymore, but you can check if it’s still connected with the app. It may be serialsoftware which is bad (personally I really don’t like it). I bought a cheap Arduino Mega knock-off especially for testing with wifi :slight_smile:

i try softserial because hardware serial show error

Arduino:1.6.5 (Windows 7), 板子:“Arduino Nano, ATmega328”


ESP8266_Shield_HardSer:35: error: ‘Serial1’ was not declared in this scope
ESP8266_Shield_HardSer.ino:37:14: note: in expansion of macro ‘EspSerial’
ESP8266_Shield_HardSer.ino: In function ‘void setup()’:
ESP8266_Shield_HardSer:35: error: ‘Serial1’ was not declared in this scope
ESP8266_Shield_HardSer.ino:49:3: note: in expansion of macro ‘EspSerial’
Multiple libraries were found for “BlynkSimpleShieldEsp8266_HardSer.h”

Used: C:\Users\H55-E33\Documents\Arduino\libraries\blynk-library-master

Not used: C:\Users\H55-E33\Desktop\arduino-1.6.5-r5\libraries\blynk-library-master

‘Serial1’ was not declared in this scope


OK, your board does not have hard serial, so you should use Soft Serial… But it can be rather unstable.

We suggest you using ESP8266 in standalone mode (without Arduino).

Yes you can use the hardware serial, but you cannot upload a sketch with the ESP attached. It’s on or the other so:

  1. Disconnect ESP
  2. Define hardserial as “Serial” (Not Serial1);
  3. Upload your sketch
  4. Connect your ESP with RX/TX to Uno ports TX/RX
  5. Reset the Uno and connect with blynk app.
1 Like

error occur on code verify,just run arduino ide>open simple>blynk>boardandshield>esp8266_shield_hardser>kick verify=error show below, no matter about which board or pin0 pin1 connected

ESP8266_Shield_HardSer:35: error: ‘Serial1’ was not declared in this scope
ESP8266_Shield_HardSer.ino:37:14: note: in expansion of macro ‘EspSerial’

Cause, on UNO, you have only ONE hardware serial, which is “Serial”, not “Serial1”.
Also, you have to disable logger prints (as they would go to the same port).

P.S. In general, such configuration is not supported (it’s not designed to be used).

It does work, but it’s not very handy or practical in usage, I’ll admit that :smile:

I bought a cheap Mega knock-off for this kind of things. That one has more than one hardware serial and that works better, as indicated by vhymanskyy.

is it possible to have the hardware serial on the only rx and tx of arduino for esp8266 , but using a software serial for debug message ?

I guess so, if you attach your usb to serial convertor to that pins, I don’t see a reason why that shouldn’t work. Have you tried that?

had the same problem…what worked for me

  • call blynk.run() as many time as you can

  • don’t use delay() if necessary use it like this overloaded version
    void delay_1(int interval)
    for (int i=0;i<interval ;i++)
    delay(20); // total delay will be 20xinterval

  • every time you read or write to or from blynk app call Blynk.run()…in fact sprinkel this function as many time as you can

I had the samp problem, but your ideas worked for me, I just added the blynk.run() as many times as possible. But I have a little question:
Can I make the code looking better? The blynk.run() every seconds line destroys my code a little bit. I like it to habe a good overview. :joy:
And sorry for my bad English, im a german stundent. :slight_smile:

It’s a bad habit for developers to “solve” stuff like this. The basics of Blynk are quite simple:

  1. Have Blynk.run() in the main loop
  2. Use SimpleTimer to time actions which need to be executed on regular intervals
  3. DO NOT USE delay().

I cannot emphasize enough how important step 3 is. It makes or breaks your program :slight_smile: Because Blynk is depended on real time communication with the uP (which is basically a slow device) it’s important I can keep all functions alive. When you use delay() the uP does nothing and it cannot be interrupted! It comes to a total standstill, like your call when it turns off. Power steering will be gone, A/C will gone, etc.

1 Like