Deep sleep, connect, reconnect

I would like to understand the way the Imp reestablishes communication after it looses it’s WiFi source for a period of time, and then regains it again.

Our situation is a bit different in that our WiFi/Internet source is mobile, and the Imp is static. We are monitoring remote tank fluid levels using an iPhone to tether to the internet. As the iPhone comes into range of the Imp, we would like to quickly reestablish communication to the Imp Cloud.

The tethering feature of the iPhone works just fine, once it is connected. I am using deep sleep to conserve battery power, and waking after a given period of time, perhaps every minute. The iPhone is carried by a field person who inspects the site on a daily basis.

What we notice is that when the iPhone comes back into range of the Imp, it might take between 5 to 10 minutes to reestablish communication via tethering. We don’t want our field people standing around waiting for a connection to occur.

I would think that my program would wake the imp every minute to see if it can transmit. My guess is that if the Imp can’t connect, something else is causing the delay that I don’t understand.

I’ve also seen cases where the Imp will go offline in a good WiFi signal situation for 10 minutes, even though it is programmed to wake every minute. Perhaps this is a similar condition?

I’ve seen the discussions about watchdog code, and new Imp release coming to address some issues, but I’m not sure if that is what is happening. I’m also interested in wireless wakeup when available.

Regardless of your code, the imp tries to connect for 1 min, then sleeps for 9 min. Then repeats. Hopefully we will be able to change this soon?

The API you require is coming in the next release. You can wake up and see if the network is available, without being blocked or prevented from running other code that doesn’t require a connection.

There is no wireless wakeup; you need to be on and associated to receive data. You can reduce the power when in this mode (from about 90mA to around 7mA, though this will move lower in the future) by using imp.setpowersave(true).

sbright33 Thanks for the 9mins update :)))))) \m/