Chat freely about anything...

User avatar
By Rob.Binet
#70633 Hi,
I am loosing from time to time WiFi connection to my WeMos D1 pro.
Now I know that the WiFi signal is weak, the reason I use a pro version with an appropriate antenna.
However, I am loosing the connection with the WeMos and only a reset solves this problem.
I am currently using a DHCP configuration, but I had the same problem using a fix IP address.
I am quite sure the WeMos is still running, because it has a second wireless interface (RFM69 transceiver) which stills respond.

I don't know how the disconnection is handled by the ESP8266, but I suppose there is an internal recovery procedure while the AP signal is lost but,... how often, how long?

As work around I can test one of the follow:
Code: Select all  !WL_CONNECTED 

or
Code: Select all WL_CONNECTION_LOST

And then:
1. Restart the connection through a
Code: Select all WiFi.begin(ssid,pass)

or
2. using the function
Code: Select allWiFi.setAutoReconnect (true)

or
3. Simply restart the WeMos with something like
Code: Select allESP.reset()

What should be the best solution (I don't like the last one of course) or is it a better one?.
NB: I wonder that the WiFi.setAutoReconnect is run automatically, if yes why is it not in some circumstances giving it up?
Thanks in advance
Robert
User avatar
By rudy
#70642 I assume you are using an external antenna. Did you remove the 0 Ohm resistor on the board that connects the onboard antenna? You should get better signal with only the external connected.

EDIT.

I had another look at the board and it seems that the 0 Ohm resistor must be moved and not just removed. (to connect the external antenna)
User avatar
By Rob.Binet
#70652 Rudy,
Nice hint; yes I see that I have to move the strap to use the external antena.

However I still looking for more info about the reconnect algorithm, which seems to fail after a while. Anyway I decided to restart the wifi ap connection procedure in case the status is other than CONNECTED, expecting to improve the reliability of my application.
So wait and see .....
Thanks
Robert
User avatar
By andre_teprom
#70661
Rob.Binet wrote:However I still looking for more info about the reconnect algorithm, which seems to fail after a while.


I have created a function containing all Wifi setup stuffs, which can be placed either at the beginning of the program, or anywhere in the Loop(), but in this case I run it once at each 60 seconds, but you can change timming according to your need:

Code: Select all            if ( WiFi.status() != WL_CONNECTED )
                      NetworkSetup()        ; // note that here there is the : while ( WiFi.status() != WL_CONNECTED ), as well


In the event of the Wifi disconnected (e.g, by rebooting your wifi router), you can see the characterisitcal dots ('.') printed at 0,5s intervals on serial console window.