Photon Standby Mode Not Waking Up On WKP Rising Edge


I’m currently working on a project, where if a button is normally pressed down mechanically, but when it is released, it should wake up the Photon. While this would normally cause a falling edge, the wiring diagram is as follows to make sure that the pressed state is low and the released state is high:

With this schematic, what should happen is that when the button is released, a rising edge signal is sent to the WKP pin, which should wake the Photon from standby mode. However, this is not happening.

In one test I did, I created a timeout function that put the Photon to standby mode after ten seconds. Leading up to the ten second mark, I held down the button, so it should be at a low signal. After the ten second mark, when the device was put to sleep by a timeout function, I released the button, which means that the signal should be at high. While this rising edge should cause the Photon to wake up, nothing happened.

Thanks in advance for all your help.

Before considering your circuit - could you share the code you are using to test with. Thanks

I’m not testing with any code apart from the timeout function. Since it’s waking from standby mode, it wouldn’t be running any code. Here is the timeout function:

struct CB_Timer {
    long start; 
    int delay; 
    int (*callback)(); 

Setup Function: 
CB_Timer awake_time = { millis(), 30000, put_to_sleep };

Timeout Function: 
int put_to_sleep() { 


    return 1; 

In my loop function, I call an check function to see if any of my timers are up, and if so call the callback function. The timeout function seems to be running fine thought I don’t believe that’s the source of the problem.

Your Timeout Function will never return because after you call System.sleep(SLEEP_MODE_DEEP); it will stop there.

Are you sure that the Photon is in deep sleep? What are the connections to A3 and A4 used for.

Have you tried your test with some very simple logic, the system with restart after waking from DEEP SLEEP.

in Loop()


Unfortunately this is an incomplete snippet of a circuit - however if I have to make some assumptions :slight_smile:

VIN = 3V3
WKP is a pin on your Photon

How did you calculate the 10M value for the resistor and what is the purpose of the diode? In this configuration WKP will never change state?

How is the WKP pin defined on the Photon?

It is always better to post a compilable code sample that exhibits the problem - and a full schematic - that way folks don’t have to guess your intentions?

On the Photon there are pins named Vin (5V supply either via USB or externally into that pin) and WKP (aka A7).

That should (probably) prevent cross talk between A3 and A4 which share the connection to WKP/A7.
Although the two diodes may well cause WKP to float while the buttons are pressed.

Not convinced in this schematic it will work. You would need to have the photon pin defined as INPUT_PULLDOWN (or external pulldown) - secondly with the 10M resistor - this allows 330 nA to flow from Vin - I am not sure it will forward bias the diode enough.

Another thing if you have two switches to the same WKP pin and no other connections - how do you know which one was pushed?

SO back to my point about above saying “complete information” or we are all guessing :slight_smile:

1 Like

System.sleep() overrides the set pinMode() to the respective default depending on the selected sleep mode.
An external pull-down is probably the better choice but with the 10M pull-up finding a suitable value may be difficult.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.