Hi All,
I have selected the Photon for a project that will be outside and not accessible very often. The project needs to connection to the cloud to register ‘events’.
The program needs to capture events regardless of Wifi Connection, which we have done, but we find that when Wifi access goes away (sometimes Photon seems to get bored, or if the wifi is really not available) the system seems to hang and cannot go about it’s normal business.
We have researched the forums and of course there is a lot of chatter.
I would imagine with Wifi being the biggest single point of failure, that the Particle guys will have built the product to deal with this situation.
We have tried all sorts of wifi.connect() type code snippets (all from the web) but none seem to work and they all seem to get more and more complex.
My test harness is:
-
Using an Iphone Hotspot next to the Photon, with System Automatic, an external atenna and code something like this in setup.
WiFi.on();
WiFi.clearCredentials();
WiFi.setCredentials(SSID, PASSWORD);
WiFi.connect();
if (WiFi.ready() )
{
Particle.connect();
waitFor(Particle.connected, 10000);
Particle.syncTime();Particle.publish(" Setup Completed", VERSION_STRING);
}
Forgetting the complexities in the loop, here is what happens when we reset the Photon.
-
Reset the Photon with the hotspot up and running.
All works fine -
Reset the Photon with the hotspot not running
We get flashing blue - not green as we thought we would -
Reset the Photon with the hotspot running but the password changed
We get flashing green, it duly waits 10 seconds and then carries on, note if we then change the password back on the hotspot, we then suddenly get a rapid green flash for a few seconds followed by a breathing green, We then have to reset the Photon to get back to a working state.
What I cannot simulate is a connection that is not stable. We have noticed that the Photon often goes in to a ‘trying to connect’ mode after a couple of days and cannot get back on, this of course will drain the batteries you are on and eventually the whole system is out…
One real worry is that when the system is up and running (breathing Cyan) and we then take the hotspot down, then the program seems to hang (we have an LCD display to help on this and of course Serial Monitor) and we have a flashing green.
This is the worst situation for us, as in this position we cannot record any data in the hope of doing a lazy upload later.
I am sorry this is a long winded post, but I think it is probably what most people would expect to be able to do out of the box, So we must be missing something, and I think a ‘robust’ code template would be a really useful tool.
Thanks for reading and look forward to your pointers.
jon