The use of the ESP8266 in the world of IoT

User avatar
By mberoldo
#35306 Hi, I´m using Arduino MEGA + ESP8266-07 with SDK v1.4.0 firmware .

My test program reads 8 analog values and sends them to Thingspeak every 15 seconds .
For this purpose, I connect ESP8266 to ThingSpeak as a TCP client using AT+CIPSTART command, then I send the data with AT+CIPSEND and finally close the TCP connection using AT+CIPCLOSE. This loop repeats every 15 seconds.

My problem is that there is a pattern: every ten minutes, after the last AT+CIPCLOSE ,ESP8266 can´t reconnect to Thingspeak for 1min 15 sec.

I know this because my program has a do while loop that looks for OK or ALREADY CONNECTED when it sends the AT+CIPSTART command, so it stays in that loop for that minute.

I have forced TCP keep alive parameter to several values in the AT+CIPSTART command without success.

Any idea of what other parameter could be changed/tested to avoid this problem?

Thanks in advance,
Marcelo
User avatar
By mberoldo
#39402 I found a workaround to solve this problem: I created a loop to try to reconnect several times. If AT+CIPSTART command fails (this means not receiving OK), reset the module with AT+RST and start the setup again. This has worked for me.