9:15 am

February 9, 2019

Hello,
I am using ESP8266 Wroom-02 and the latest version library: ThingSpeak ver.1.4.3 for Arduino. I'm using a simple example from the library.
When I use the function: delay (20000) everything works fine. But when instead of the delay function it uses the sleep function: ESP.deepSleep (20,000,000) the thingspeak server returns error -301 (Failed to connect to ThingSpeak)
I receive update successful connection ( code 200) a reliable connection once every several dozen attempts.
A part of my sketch:
...
void loop() {
...
// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
int x = ThingSpeak.writeField(myChannelNumber, 1, number, myWriteAPIKey);
// Check the return code
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
delay(20000); // Wait 20 seconds before sending a new value *******************- this works well
// ESP.deepSleep(20000000); //*************************************************- this does'n work!
}
Anyone have an idea to solve the problem?
BR
Greg
12:13 pm

February 9, 2019

10:31 pm


MathWorks
May 1, 2016

6:23 am

February 9, 2019

Hi,
After wake up ESP, I have wifi connection - I checked it.
I noticed a certain dependence. If the sleep time is more than 4 minutes, everything works fine! For example - I send data every 5 minutes and it works 100%.
If the deepsleep time is less than 5 minutes, the server very often returns error -301.
Does the server have some time to automatically shut down the tcpip connection?
11:59 am

February 8, 2020

Vinod said
ThingSpeak never sends a 301 back to an update request. The 301 could be from somewhere else in the chain, possibly a router or gateway.
Have you tried assigning you esp8266 a static IP in your router config settings?
I have the same problem. I used a static ip address in the code. How to fix it?
I need a static address to communicate with the application on the smartphone on the local network
Most Users Ever Online: 166
Currently Online:
27 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeugan, StefanWiModerators: cstapels: 460
Administrators: Hans: 405, lee: 457