I was wondering if there is any alternative to using the Particle CLI or Tinker to commission the WiFi credentials on a Photon. Specifically, could it be done with a USB or Micro SD interface? I was thinking you could flash firmware that started operating the Photon in WiFi.off() mode – then when in another location, insert a USB or SD card (via appropriate hardware interface) with the (local) WiFi credentials, and, I imagine, the device ID and access token. The photon reads the credentials, and connects to the local WiFi.
Any opinions on if this could work? I’d greatly appreciate any directions on how to go about trying it out.
For USB, there’s the
particle-cli. A simpler solution is to use a serial terminal and hit w to get a prompt for wifi credentials.
This might be a good option too: http://photonsoftap.meteor.com/
All of the above
yes the SD card version would also be possible, but not the access token as this is not a device but a cloud property.
The device ID is hard wired in your device, so unless you want it to check if this device should use the settings provided (via a device ID compare), I’d also say: “For what?”
Hi @kennethlimcp and @ScruffR - and as ever, thanks for your responses. I may have been a little vague about the purpose of this question. My aim is to be able to commission a photon, that has previously been claimed (setup) with new WiFi credentials, whereby the installer has nothing more than a USB Memory drive or (MicroSD) equivalent. I was thinking you could have a text or csv file on the USB Memory drive that contained the device ID, the (local) WiFi SSID and password. The photon, which has previously been flashed with code that has it running in WiFi off mode is waiting for the memory device insertion in a USB or Micro SD host device (not the micro USB port on the Photon) - and upon “seeing” the drive - reads the credentials, writes them to the appropriate memory table and connects to the local WiFi. I guess my question is “where in firmware memory are these (WiFi credentials stored?” and “can they be updated from the main operating code”?
I’m really only asking is this feasible?
Something like this? - https://docs.particle.io/reference/firmware/photon/#setcredentials-
You will need to write the code to read from the source (SD, memory drive) etc…
Is there a reason why the softAP app is not considered?
In connection with @kennethlimcp’s link, you might also like to look at the related functions
The first one to check if you need to pull credentials from the storage device and the latter for you to have a way to clear your credentials before deployment and for the user to change them without the need to expose the SETUP button.
Also in order to use
WiFi.setCredentials() you’d need to provide the security type and encryption cipher via storage device, if your user wants to setup with a non-present or hidden network.
This way the storage device could stay plugged in without the credentials always being set anew on each bootup.
Another way for this would be renaming/deleting the credentials file after the first time.
BTW: I still don’t understand the need for the device ID. Or do you not only want to change WiFi but also allow the user to claim the device?
Hi @ScruffR - thanks again for your help. I’ve got some better minds than mine looking at your suggestions - and will advise if we get something working. And sorry about the constant reference to device ID - you’re right, for my purposes it won’t be needed. I don’t see the end user claiming the device.