WiFi Auto Reconnect problems

User mickeypop investigated and found some solutions:

Additional explanations:

While one bypasses some library issues the other uses the WiFi.onEvent() service, both simply detect when a connection is broken and re-initiate a new connection.

While some have noted after several hours they keep getting bumped, this is almost certainly a function of the lease time of DHCP server in the router.

If the lease time of the router is not the same sometimes devices “forget” to update causing a no IP address even though sometimes the WiFi connect is still there.

  • WiFi.begin() forces the DHCP to get a new IP along with a new connection.
  • WiFi.reconnect() works but often assumes the unit still has an IP and may not do a DHCP request.

The simple way around this is to Ping the DHCP router periodically.
This forces the router to know you are still on the network and keep the lease current.

Rebooting may reconnect, but does not address the WHY of getting disconnected and often applications can get out of sync if you are simply rebooting.

Loading...
Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Free Link Directory