2 Imps go offline randomly, same connected router

For just over a week now I have had 2 imps deployed at a site, both connected to the same open router (no password). One is an 001/April and the other an 002. Both have dropped offline a few times, requiring a manual reboot (pull power cord, then plug back in) to get back online again. Each time this happened I knew the router was still available because the alternate device was continuing to post information to an online service.

Both Imps are running a modified version of the original Temp Bug code. They read thermistors then sleep (wakeinterval is set to “1”) using:

`imp.onidle( function() {
    server.sleepfor(1 + WAKEINTERVAL_MIN*60 - (time() % (WAKEINTERVAL_MIN*60)));

I noticed that just before each time a device went offline I received a few “imp restarted, wi-fi outage” messages in the IDE.

What is the first and most logical thing to do to troubleshoot? Should I get make/model info on the router and forward to the folks at Electric Imp?

If you run one imp and leave the other one powered-off, does the running imp fail?
Or reverse the two and test again?

What code do you have in place to handle the loss of wifi connection? Wifi disconnections can be frequent events. If your devices cannot reconnect, it could be that router is refusing their connection.

Consider reading about this:

If you have a second access point, you could cycle between them if attempts to connect to the first one fails. This could help you diagnose what’s going wrong. If your are successful in connecting to the 2nd router, the imp could then pass a message to the agent, indicating WHY it failed the first time.

If you have to pull the plug out on the device, it won’t be able to tell you anything when it powers up again as it has no persistent storage.

You should also take a look at our Developer Guide ‘How to Run an Imp-enabled Device Offline’.

Not heard of anything requiring a power cycle to get back online for… literally years (and there are many many commercial devices which have to stay online for the product to work!).

With the default settings, ie SUSPEND_ON_ERROR mode, if the internet goes away - which is what “wifi outage” implies has happened - then the imp will sleep for 9 minutes before attempting to connect for a minute again. If you see a device offline, it’s worth waiting 10 minutes to see if it’s waking and attempting to connect; noting the LED code at that point would help diagnose the issue.

If you’re using RETURN_ON_ERROR mode then the reconnect logic is in your code - if there’s a bug there then you could run into issues - we can look if you post the code.

Thanks, everyone. For about a week now both devices have remained online on the same router, so maybe my post was premature. If another issue comes up I will post another question to this thread after troubleshooting with the great advice. For now I’m focused on the data and what it tells me about what we deployed. FYI the Electric Imp and Grovestreams were a huge help to me in recent weeks. To build an experimental system and watch it remotely for a few weeks is amazing. Thank you!