Enter listening mode without pressing the photon buttons

Is anyone aware of a way to put the app in listening mode without pressing the buttons?

We are building a consumer product that will be powered by the core. When the user gets the device we need to have a way for them to put it in listening mode so they can connect it to the wifi at their home.

We would prefer they not have to disassemble the product to press buttons to get it into listening mode, possible?

1 Like

There is WiFi.listen() which triggers listening mode.

So is the intent that the logic of a consumer electronic goes something like this:


if (unable to connect to the internet >= 30 min) then
   continue with firmware code...

With the Photon, is it possible to emulate the setup button through other pins? The intent would be to expose a button in the outside of the consumer electronic that the user could press and would trigger the setup mode.

The button pin is exposed with a pad on the underside.

1 Like

Got it. Thanks @kennethlimcp!

You could also set up a pin that you read in the loop via digitalRead(), or setup an attachInterrupt() handler to detect changes to your button. When you detect the button is pressed, call WiFi.listen().

This may or may no be easier than soldering to the setup button pad.


Thanks for the alternative @mdma


if (unable to connect to the internet >= 30 min) then
   continue with firmware code...

Is this a viable software solution? I was thinking more like 1 minute of no connection, go into wifi setup mode. One less issues for the customer to worry about (if the device is blinking blue - advise them to use the app to set up wifi). Rather than having to press a button (mainly because I have not designed any buttons on my enclosure).

Continuing the conversation for not wanting to use a physical button to go to listening mode:

I want to check WiFi.ready(); and if this does not return true after 1 minute AND I have a sensor trigger (I have several sensor that the user could trigger), then set to listening mode.

I have put the check into my main loop, but once I put the device into listening mode, the user code (my main loop) seems not to run. Where can I find docs around this?

Do you have to set SYSTEM_MODE(SEMI-AUTOMATIC) to check wifi status? If so, can I then turn back to AUTOMATIC once wifi is set?

Thank you


Is there a reason why you want to enter listening mode if wifi is not connected after one minute?

Use case: When a device needs to be initialised with new wifi details (i.e. new customer or new location).
The device enclosure I have does not have any external buttons, so I need some way to initiate the Blinking Blue mode when required.

The check would be “not connected for more than 1 minute AND a sensor input” (I use a PIR, so the extra event would be a presence indication for 10 seconds).

I need some advise on how to code this.

I modified for your use case based on the original example of mine from :



#define PIN_PIR D0

uint8_t retry_count = 0;
unsigned long old_time = millis();

void setup(){

void loop(){
     if(millis() - old_time >= 60000 && 
	   millis() - old_time <  90000 && 
	   digitalRead(PIN_PIR) == "HIGH") {


    // Insert user code here

Not sure if it covers all the edge cases but something for you to get started with?

1 Like

My compile fails if I place the word HIGH in double quotes, but comiles OK without quotes.

As I simply pasted your example I now wonder which is correct… and why?

if (digitalRead(PIN_EXT) == "HIGH") {WiFi.listen();}

if (digitalRead(PIN_EXT) == HIGH)

@rowifi, the unstoppable @kennethlimcp often contributes at all hours of the day! In this case the line should be if (digitalRead(PIN_EXT) == HIGH) since the return value for digitalRead() is HIGH or LOW, not a chart string as in “HIGH”. You can also abbreviate the line to if (digitalRead(PIN_EXT) ) since LOW causes the test to fail. :smile:


An observation for those going this route. The Hello Inc Sense does something similar (hold your hand over it to put in pairing mode) and it is less than stellar. The wave for status light is nice but the pairing mode has right tolerances on how long to hold your hand over the sensor and it took me several tries to get the timing right. So either leave the time to hold over the device any length over 10secomds or something. Very frustrating!

Would there be a way to continue checking if there is a known network while in listenning mode ?

There is a system event - setup_update that is posted regularly while in setup/listening mode. Every 10 seconsdyou could perform a WiFi.getCredentials() and a WiFi.scan() and compare the results. If there’s a matching network, then call WiFi.listen(false) to exit listening mode.

Good I’ll try this !