Configure wifi from (custom) app without logging in?

Hello,
i’m currently looking for a way to:

  1. Claim a device
  2. Reset the Wifi credential
  3. Use an Android/iOS app to connect to the new default SoftAP
  4. Send the credentials without using Android/iOS API
  5. Switch to client mode with the given credentials

Is it possible?
I found a lot of unanswered topic about this and i find it strange since it is really common

The iOS and Android Particle apps are open source and do exactly that do they not? So fork those and rip out Tinker bits?

1 Like

I’m currently looking in here https://github.com/spark/spark-setup-android/tree/master/devicesetup/src/main/java/io/particle/android/sdk/devicesetup
but i was wondering if there were something already exposed to do it in a simpler fashion

I’m currently trying to remove the particle login in your android example, is it strictly needed to start a fully functional device setup (not particle sdk/cloud functions) using your sdk? I mean i only need the device setup procedure (softAP->home network client)

If you’re trying to claim the device (as your post states), you’ll need some kind of cloud interaction.
If it’s for wifi only, then you won’t. Then you’ll have to program it accordingly, or it might not connect properly.

Is there a reason you don’t want to use the Device Setup API in step 4? It’s possible but it’s a huge pain to set the Wi-Fi credentials by hand. You can use the Device Setup API to set the Wi-Fi credentials only and not mess with the claiming.

If you do want to do it completely by yourself, see the section “Set up Wi-Fi” in this document. It describes how to manually set the Wi-Fi credentials over SoftAP:

1 Like

Could you please link me the SoftAP part to do so? Initially i though that SoftAP needed cloud and particle login, but it doesn’t seems so.

I don’t think it’s documented anywhere. I figured it out by reading the source to the SoftAP Setup Javascript API.

The SoftAP endpoints are what the phone apps use to initially configure a Photon. You can use it to configure Wi-Fi with no internet or cloud access at all if you skip the claim code stuff.

There are only a few endpoints and the ones you need are in the link I previously posted.

What i meant was a simple way to set up photon connection to the wireless with a smartphone without the hassle of the login/claim and cloud stuff (it is meant for a person that doesn’t care of the cloud).

Soft-AP is already there and using the example in the reference it allows to do it from a browser (from a phone eventually but it is not so clean).

Is there a simpler way guys?

What’s not clean about it and how much simpler would you want it?
In what way?

No particle login and no particle sdk init , that’s what i mean.
Basically it means to start directly from DiscoverDeviceActivity rather than passing through LoginActivity

SoftAP as in here does not require any of that.
It just requires you to connect to the SoftAP and browse to 192.168.0.1

Thanks for this great document @rickkas7. Everything works as expected until I interact with the photon in listening mode.

For example curl http://192.168.0.1/device-id just hangs. I can ping 192.168.0.1.

I’m running firmware 0.6.2.

Is running firmware version 0.6.2 default install enough? From this post it you mention SoftAP is not included in core: Photon SoftAP Repository?.

Thanks in advance.

I did solve my problem, so I will post for others.

Ensure you include the softap_http library. To do this make sure these lines are at the top of your .ino file.

#include "Particle.h"
#include "softap_http.h"

Sorry, I’m a little bit lost.
The code from documentation, where, do I put it?

Do I put it in my sketch or do I need to flash the firmware with the code?

You just copy the whole code in a new project and build/flash it.

Once you got that running, you can extend that project to whatever you want - once you’ve done that, you’ll know how to incorporate that part into existing projects :wink:

1 Like

Got it!! :blush:

Thanks a lot @ScruffR

1 Like