Can I configure multiple wifi networks for photon?

Is there a way to configure multiple wifi networks and have the photon simply pick the first one it can connect to?

What I want is simple: at home I work with my home wifi X but I plan to use a little arts project at another location with wifi Y. Can I tell photon to check if there is X, use it if available, or otherwise keep checking for other preconfigured networks like Y, Z, etc. and connect to the first one that is available?

thx
Sven

@hansamann, the Photon keeps a FIFO list of up to five WiFi configurations. When the Photon connects, it will go through its list in a first to last order to attempt a connection. There is no mechanism currently to “tell” which WiFi to connect to.

So, by setting credentials at home then at other locations, the Photon will take a little longer to connect but will work its way through its list and connect.

Don’t forget that adding more than five configurations erases the oldest one (FIFO). You can erase all configurations by holding down the SETUP button for more than 10 seconds if you wish.

If you search the forum, there are others who have asked similar questions and some have use the Credentials API functions to clear and set WiFi credentials but there is some concern regarding wear on the memory (eeprom possibly) used by the Broadcom/WiFi chip on the Photon if excessive writes are done.

3 Likes

One other tip is that if you are setting up the credentials on the Photon and the and the network is not in “view”, you need to supply all the details including the encryption type in order for it to work on the other network. You have to do the equivalent of this system call for offline networks:

// for hidden and offline networks on the Photon, the security cipher is also needed
// Cipher options are WLAN_CIPHER_AES, WLAN_CIPHER_TKIP and WLAN_CIPHER_AES_TKIP
WiFi.setCredentials("SSID", "PASSWORD", WPA2, WLAN_CIPHER_AES));
3 Likes

@bko, thanks for that tip. I was working with the setCredentials() call a week or so ago and couldn’t figure out why I couldn’t add my local wireless to the configuration. I wasn’t broadcasting the SSID and was missing that last parameter.

1 Like

My 50ct: if you do not know the entrance data to the external WiFi, you can transmit these also later via softAp