Remote reset a Photon

There needs to be a way to remotely reset a photon. I had a 2 second power disruption and now the Photon is offline andcannot be accessed by USB. There is no way I can sell a product that hangs up from a simple power interruption.

If not a remote reset, at least a graceful restart in this situation. Can you imagine a mission critical monitor that hangs for no good reason?

If it does not connect it can’t be reset remotely.
In such a case you’d need to build the reset logic into your own firmware, use ApplicationWatchdog or even add some HW watchdog.

Thanks. I’ll look into it.

And thanks for the quick reply.

Sorry if I sounded angry, fatigue.

A power disruption should cause the Photon to do a hard reset so why would it not reconnect? Did the power event also affect the WiFi router? I think you need to understand the event and the circumstances around the event so we can better guide you.

Yes, it was a whole house power failure. Computer, router and cable modem all reconnected. When I was able to get to the Photon it was fast flashing Cyan and the computer was unable to connect via USB.

Did you keep all devices plugged in i.e., when power came back on did they all power up? Routers and such require some time to go through their start up sequence so I bet the photon would have been ready looking for WiFi before the router or modem was available. That should not be a problem, but I suspect it is.

@particle; I do not know if this is related to other WiFi issues mentioned by myself and others but my gut just tells me the WiFi stack is not entirely kosher. Disconnects without reconnects are just too easy.

yeah, my router takes what seems like 10 minutes to reconnect to the internet after a power cycle. My devices are flashing Cyan long before that (Wi-Fi starts quickly), but eventually it all restores.

What SYSTEM MODE are you using?

@jbstcyr and @joost, one issue that I recently came across in another thread was in connection with “multi level” networks, where the WiFi AP is not also the DHCP server.
This can result in the Photon connecting to the WiFi and obtaining an “invalid” IP from the WiFi AP, which doesn’t get dropped (which is understandable tho’), even after the actual DHCP server becomes available.

This might or might not apply to your cases but might be a possible route to investigate.

@scruffR; oh that is a good one, didn’t think of that. So the photon is marooned thinking it is good with its obtained IP. What is a good strategy to climb out of that hole? Can we do something like:

at regular interval:
ping known site
if ping fails
stop WiFi
start WiFi

The ‘ping known site’ is a little dangerous because it can be offline (just our luck). Can we ping the router? So if the photon gets, it pings If it had an improper address the ping should fail, no?

There might be several routs out of that.
The “brute force” would be setting a static IP.
Another would be to control the WiFi connection and apply timeouts. If the cloud can’t be reached within a sensible time, knock back the WiFi connection to see if things clear up and after doing that a few times in vain, try a System.reset() and if that doesn’t help, send the device into deep sleep for an hour or so and repeat.
Instead of pinging, you could use WiFi.resolve() which would tell whether your device can get hold of a valid DNS.
Or multiple other ways.

The Wiced stack was not designed for ALL network topologies and conditions I suspect. Running in SEMI_AUTOMATIC mode and probing the network environment at startup is a good way to add protection. Exception handling is always tricky but so necessary!

This perplexes me though I’m not sure what @jbstcyr means by “unable to connect”.

1 Like

I will have to experiment with all the helpful suggestions.

My router was working for my iPhone so it should have reconnected the Photon. I didn’t get back to the Photon for 18 hours so it had plenty of time to reconnect.

Thanks everybody. I will report back when I have more information. Might be a while since it doesn’t hang up all the time.

Thanks again.

FWIW, I occasionally experience cases with my Photon where it will rapidly flash cyan for extended periods, ranging from several minutes to several hours before finally connecting and starting its normal slow pulsing (excuse me, “Breathing”). Never figured that one out. There’s plenty of wi-fi signal available and other devices on the same LAN don’t get interrupted. I’m not requesting a solution, just adding a data point.

Not sure if Michele’s case has been closed out but I have an older Photon that does this too (fast flashes and drops cloud connection), moreover it will sporadically flash cyan like a circuit has been damaged …

I was able to manually flash the latest bootloader + OS (from Particle’s GitHub stash) but no difference. Actually it was tricky to do even this as the hold setup + press/release reset would sometimes result in a dim D7 LED, best I figure is maybe an ESD event corrupted a component.

Actually, I have not had this problem since I upgraded my router (currently a Synology RT2600-AC).

scruffr posted some code elsewhere in the forum last year that would restore dropped network connections, IIRC.