Left here for archival purposes.

User avatar
By epsoc
#10461
GeoNomad wrote:
Interestingly, one of them almost never misses an upload.

The other one often skips one and sometimes two connections.


I had similar issues with different modules, or rather test setups. I am quite positive about it being the result of either the wifi quality of connection or RF interference on the test setup itself, like certain test wires may act as antennas and/or absorbing some of the tx energy.
I am really impressed how these little PCB and chip antennas perform.
Attached is a link to a table that I found somewhere on the internet. It shows possible startup functions of various pins.

https://drive.google.com/file/d/0ByLNRz ... FoMGs/edit
User avatar
By epsoc
#10465 One more thing comes to my mind: For my esp devices I use a static IP address on my local wifi network, which saves time and communication overhead (and therefore less chances of comm errors).
I have an nginx web server running remotely with static fixed IP address. So I also use a static IP address for my remote server connection which eliminates DNS lookup (and possible failures).
The advantages to do so are: less error prone and even more important its very fast. Waking up from deepsleep, connecting to my local wifi network, connecting to the remote web server, uploading data, receiving the server response and back to deepsleep takes less than 2 secs, more like 1 1/2 sec. Takes about twice as much with local DHCP and remote DNS. That will probably close to double my battery life.
User avatar
By epsoc
#10652
fabix68 wrote:You can attach the code used to establish connection with static ip and sleep?


I don't know how this translates to LUA/nodeMCU, but here it is:

Code: Select all
static struct espconn client_conn;
static struct _esp_tcp client_tcp;
static uint8 remote_ipadr[4] = { 111, 222,333,444 };

static void ICACHE_FLASH_ATTR connectToServer(){

   client_conn.proto.tcp = &client_tcp;
   client_conn.type = ESPCONN_TCP;
   client_conn.state = ESPCONN_NONE;
   os_memcpy(client_conn.proto.tcp->remote_ip, remote_ipadr, 4);
   
   client_conn.proto.tcp->local_port = espconn_port();
   client_conn.proto.tcp->remote_port = 80;

   espconn_regist_connectcb( &client_conn, clientConnectedCb);
   espconn_regist_reconcb( &client_conn, clientConnectionFailedCb);
   espconn_regist_disconcb( &client_conn, clientDisconnectedCb);
    espconn_regist_sentcb( &client_conn, clientSentCb );
   espconn_regist_recvcb( &client_conn, clientHTTPRecvCb );

#ifdef CLIENT_SSL_ENABLE
   sint8 res = (flashdata.ssl_enable == 1 ? espconn_secure_connect(&client_conn) : espconn_connect(&client_conn));
#else
   sint8 res = espconn_connect(&client_conn);
#endif

   if( res != ESPCONN_OK ){
      // nothing else we can do, maybe next time
      deepsleep();
   }

}