How to setup WiFi SSID and password for photon in softAP mode using HTTP webpage?

Hello Everyone,

I am using the example given below for my photon in softAP mode using HTTP web page.

https://docs.particle.io/reference/firmware/photon/#complete-example

Can anyone help me how can I setup SSID and Password for it?

Thank You.

I guess this is written in the docs, but connect your device to the Photon SoftAP and then use your browser to navigate to 192.168.0.1, then you should see what to do next.

Hey @ScruffR,

Thanks for the help. It’s been connected successfully.

But, how can I know on which IP address it’s working? I can’t configure it if I don’t know its IP address!

It will always be 192.168.0.1

@ScruffR, I’m really confused!:confused:

First I flash the code to my device. Then I HOLD the SETUP butten until it blinks Blue(listening mode). Then I open the web browser and go to 192.168.0.1 and I see the softAP setup page, then I click on Scan!
After that, I select my Wireless Network from the list and type password and then click on “Connect”!

It is showing “Attempting to connect” even though my Photon is breathing Cyan now! But now, if I type 192.168.0.1 in another tab or browser, it won’t work(as expected)!

Then, how can I see the details of my photon from a webpage which isn’t opening? What am I doing wrong?

Thanks.

After you have set the WiFi creds on the Photon the SoftAP feature will be switched off on the Photon and the Photon will itself connect to the WiFi network you just had set it up to use.

From then on the device will normally receive a DHCP IP from your WiFi router which can be any IP address relly - but the info which address your router handed out can be viewed (and even be set as preassigned/static IP) on your router.
Another way to find the IP of the device out is via code by use of WiFi.localIP() which will allow you to either expose this as Particle.variable() or print over USB serial or any other way.

A less advisable way IMHO is to set a static IP on the device itself via WiFi.useStaticIP() and its relatives.

1 Like

Other than running SoftAP for wifi setup (if you included in your application), the Photon has no web page to show details. You can implement a web server in your app to do that if you wish.

1 Like

@ScruffR, I've got it now! I've used WiFi.localIP() function and printed it on serial monitor! It gave some random IP!

But as @peekay123 said:

So that means I cannot use the Photon's IP address directly to see the details like : Humidity, temperature, etc. that I want to access,right?

If so, it leads me to one question: how can I then see the details of my application without any APP??

Thank You.

P.S. : Pardon me if my questions seem so much basic, but I've just passed my bachelor's and I am curious to learn new things!

Nope, this doesn't mean that, hence Paul also said this

There is a library for that already.

Or if you are happy with a standalone Photon (not connected to cloud or your local WiFi) you can implement the HTTP page as a SoftAP page and make sure that your Photon does not drop out of Listening Mode (e.g. by disabling/removing the "set credentials" button).
This would be a workaround till the long standing promise to implement the feature to have SoftAP also available "outside" of Listening Mode.

1 Like

@ScruffR,

so I should add this library to my project that's it? No modification?

And sorry but I didn't get how to do this:

Also, my Particle App is showing this IP address!

What it is actually for?

Its not necessarily FOR anything. If you had services (http/tftp etc) running on your Photon that you then wanted to connect to remotely then you could use that address along with a suitable firewall rule to connect to that service. Equally if you had several Particle devices in different locations it could help you identify where that one is and what network it is connected to.

Its important to grasp the key concept of a Particle device, it enables you to create smart devices that are connected to the cloud. Specifically they connect to the Particle cloud and you can then connect a website/app of your own design or another service like Ubidots, to that cloud, it can be used in other ways but they typically have their shortcomings as they don’t reflect the devices targeted usage.

I would suggest you read the Docs, particularly the bits around Particle functions and variables which describe how you expose things like a temperature you might be measuring or things you might be controlling to the outside world. The functions and values then become visible in your device dashboard and accessible to apps, websites or simply to control from the command line.

2 Likes

@Viscacha,

Thanks for the guidance. It certainly helped me and I’ll look into the docs for more clarity. Thanks a lot.:relaxed:

Hello @ScruffR,

I think I've got it what you mean now by saying this:

If I'm not wrong you meant that I should make an HTTP page(edit script of the softAP setup myself) and then open it in the same way by entering 192.168.0.1 IP while in LM; and then to stay in listening mode.

But then, I have a loss that I can't have internet access. Please guide if I've understood anything wrong.

Thanks.

Yup, that’s what I meant since the need for internet access at the same time wasn’t explicitly stated.
SoftAP and internet connection are mutually exclusive.

1 Like

There is another option by running one of the tiny http servers on the device you could have a little local page for connecting to the device directly and keep an internet connection as well. Combined with something like Bonjour or a DNS entry on your router you could even then connect to it on the LAN with a nice name like myparticledevice.local.

1 Like

Phewww! I’m the slow learner, but now I learned. Thanks to you.

@ScruffR, and as you’ve shown another option of implementing the webserver, has anyone ever done it yet in their project? Can you show me link of any thread related to it?

Thank You.

Asking the "same" question twice is not appreciated, even when using two accounts ( @djs07 & @AJ7 )

OMG! @ScruffR, I can see the reason to doubt! He was having the similar question! @AJ7, Man! What a coincidence! :grin: