Photon Wifi Predefined SSID List


I’d like to predefine a list of wifi ssid’s and passwords for the Photon to connect to. I’m not seeing how to go about that?

David J.

What do you mean by that exactly?
If you just set up to five WiFi credentials in you Photon (by any of the possible means - including a skript for CLI) it will remember them and connect to the first one of them it finds.
Or you could write some sketch which uses setCredentials() to store them into the device. This way you could have more than five sets of credentials at your disposition.

1 Like

yeah @ScruffR is correct. the setCredentials() call is what you’re looking for.
Referenced here:

Wasn’t there a requirement that the wifi network has to exist during the ‘setCredentials’ call?

There was.
But for a while now there is a new overload that also takes the security cipher for cases where it can’t be acquired from a present network.


Thanks for the responses guys! I had seen the reference guide, but being a novice I was unsure about how to initialize the calls to use the wifi instructions- much less list all the creds.

As to the creds, I suppose it should look like this:

WiFi.setCredentials(SSID, PASSWORD);
WiFi.setCredentials(“SSID1”, “mypasswordishuge”);
WiFi.setCredentials(“SSID2”, “mypasswordishuge”);
WiFi.setCredentials(“SSID3”, “mypasswordishuge”);


But I’m unsure what comes before it…

Thanks! David

There should not really anything be needed before, but you have to be aware that the device can only remember up to five sets of credentials.
After that it will start overwriting the first one again.
And permanently overwriting that flash might also cause flash wear.

Additionally you’ll probably need this version of setCredentials()

// for hidden and offline networks on the Photon, the security cipher is also needed
WiFi.setCredentials("SSID", "PASSWORD", WPA2, WLAN_CIPHER_AES));

Since I’d guess you won’t have all your desired networks in reach and not interfering with the setup process.

If you can disclose what you actually want with all that, we might be able to suggest other (better) options.

1 Like