Photon Wi-Fi Boilerplate

Hi All,

We have built ourselves a weather station as a test project. The main issues we have run into and need to get a robust solution for, are using the Photon, when connected to battery power.

Our system uses a solar/rechargeable battery configuration, the Photon makes calculations and sends to the Particle Server and then goes in to deep sleep for 10 mins. This works great.

We are using an external antenna.

From time to time the Photon fails to connect to our Wi-Fi. This may be our Wi-Fi set-up, or perhaps the Photon itself failing (the Wi-Fi setup works fine with all other devices).

Either way, what then happens is that the Photon stays in ‘can’t connect’ mode, and then drains the battery, as it never gets to our code which switches to deep sleep mode.

We know that you can prevent connection on boot up, and manually start Wi-Fi and/or Particle Cloud connection.

This is the area we are looking for a boilerplate. We assume that managing the connection (to Network and Particle) is something that most people that want a robust system have to do, and that therefore there is or should be a standard template that we can all use that is considered best practice.

Any thoughts on this would be really useful, as if we wanted to use this in a production product, we would want to be very sure we are doing it in the correct way.



So, this?