I have a simple Photon application that I’d like to use at a limited number of sites in the remediation industry. I anticipate initially using this at roughly 10 of our sites and if it’s successful it might go to 30 or 40 sites. I’d like to just ship each unit to the field technicians responsible for each location and have them connect the devices to the WiFi at each site but I’m not sure how to do that. While I’ve been prototyping locally it’s easy enough for me to visit each site and set them up using my phone but driving to distant sites is impracticle. Any suggestions? I want to maintain control and monitor each device.

@Silverminer, I have done just that using the “complete example” code for the SoftAP. It allows my client to connect a phone to the Photon and specify the wifi details. I even have a Particle.function() I can call remotely to wipe all WiFi credentials prior to having the unit shipped back.

Haha, I’ll say. At my level of experience that entire section might as well be written in Chamicuro (a language spoken by only 8 people). I think I’ll limit my use of the device to local sites for now.

Flash the code to a Photon that is cloud connected. Make sure to specify the correct target system firmware version.

Once flashed and rebooted, erase all WiFi credentials by pressing the SETUP button until the RGB LED rapidly flashes BLUE.

Once you release SETUP, BLUE will flash slowly indicating it is in LISTEN mode waiting for new credentials.

With you phone, go to WiFi setup and connect to the AP named Photon_xxxx. This is the Photon’s SoftAP!

Once connected, open a browser and go website 192.168.0.1 which is the address of the SoftAP on the Photon

A page will open and you will see a “scan” button. Hit that and it will list all available access points. Select the one you wish to connect to.

A dialog box to type the AP password will appear. Enter the AP’s password, press the button to finish and voila, your Photon is now connected, running Tinker!

When you ship the Photon, you first erase all WiFi credentials so the Photon comes up in LISTEN mode on bootup. Your client follows the setup instructions as above minus the part about clearing existing credentials. That’s it!

@RWB, @Silverminer, there is one caveat to using SoftAP. I found that when running with system threading enabled, my loop() code and SoftAP were clashing and causing an SOS. To fix the problem, I put this at the top of loop():

if (WiFi.listening())
return;

This prevents loop() from running when in LISTEN mode running SoftAP. This is a sledgehammer approach to a solution but it worked.

I’m wondering if there is a way to setup a photon in a remote location without the customer having access to any of the buttons. And can you push wifi credentials to a fleet of devices or a specific device? @peekay123

can you push wifi credentials to a fleet of devices or a specific device?

How would you push credentials to a device that’s not connected? If it’s within reach, you could simply pre-program them. If it’s connected, you could use a particle function. If it’s not connected and has no credentials stored, it’ll enter listening mode, allowing one to use the app. Similarly, you could program in a time-out before entering listening mode.

Thanks @Moors7. So summarizing your points based on these scenarios from the customer’s standpoint.

Setup a new device.
As the device is powered, particle goes into listening mode. Would the customer need to open up the particle app and set it up? OR can we do this remotely for them?

Device already setup and connected but needs a wifi change
Use particle function? How ? Can you please point me to an example?

Device already setup and not connected and hence needs a wifi change
Will it automatically enter into listening mode when there was a change in wifi credentials at the router?
a. Key in new wifi credentials by using Particle app. Same as 1). Can we do it remotely?
b. You mentioned a “time-out”? Can you please elaborate or point to an example?

You need to be in WiFi proximity to connect to the Photon’s SoftAP - so, no you can’t do that remote as @moors7 already said. No connection = no remote access.
But with SoftAP your customer might have more options than just Particle App.

No, the device will not enter Listening Mode if it can’t connect. This would defeat the purpose of catering for multiple networks where a Photon can roam from one to another.
3.b) You can use WiFi.listen() to go into LM for a while and then drop out after a while via WiFi.listen(false).

@Silverminer, make sure you are selecting a Photon target before you compile. The SoftAP code will not work with an older Core. The Particle.h and softap_http.h are intrinsic and are part of the Particle firmware much like “Arduino.h” is.

As for the Tinker code, all those Spark. functions should ideally read Particle. but they still work and thus the warnings (I fixed it in the code above). I made a typo and the the line should read if (WiFi.listening()) and I corrected the code above. Oops!