SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By kepeter

I have a running project using the RedBoard and the ESP8266 WiFi shield...
These are the steps:
1. Connect to the shield via (soft)serial
2. Connect the access point
3. send POST messages to some server

All these works perfectly...for 2-3 hours, but then POST messages are stop to reaching the server...
Adding some debug messages I found that the local IP address of the WiFi shield got corrupted (in normal it is like 10.0.0.x, but it becomes x.0.0.0, where x changes every few seconds)...To add this the connection to the access point still seems to be intact from both end...
I tried to restart and also unplug the module, but it have to be off for a long time (more than half hour) before comes back to normal functionality...

Anybody with some experience about such problem?
By kepeter
Some more details...

1. The code (most of)
Code: Select all
#include <SoftwareSerial.h>
#include <SparkFunESP8266WiFi.h>

static ESP8266Client _client;
static char _http[] = "POST HTTP/1.1\r\nContent-Type:application/x-www-form-urlencoded\r\nHost:\r\nContent-Length:27\r\n\r\nid=000000000000000000000000";

void setup() {
    while (!Serial);

    while (!esp8266.begin(9600))

    while (esp8266.setMode(ESP8266_MODE_STA) < 0);

    esp8266.connect(_networkName, _password);

void loop() {
    _client.connect("", 80);

I made some debugging, and found that if I remove the _client.print(_http); line, all works perfectly for 6-7 hours, but with that line in it it can go crazy very fast (I told 2-3 hours as that why I saw, but now I saw less than that - some 40 minutes)...

There is any problem with the print function?
By kepeter
And one more bit - this time much happier...

I found the solution, but! I would like an explanation, if someone has it :?

All I had to do is to read! back the answer after writing the POST string, so the code changed like this:
Code: Select all

while (_client.available())
It seems that the buffer must be cleaned before the next print-out, otherwise something goes wrong with the communication...
User avatar
By Ross Robotics
Thanks for posting the solution. It seems most members here don't have experience with the ESP8266 yet. But it seems that the Serial buffer was overflowing. Lots of info on this with a Google search. This was my first though when I read your original post, but wasn't for sure since your symptoms are unique.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]