# Deep Sleep waking after only 3 seconds when should sleep for longer

**URL:** https://community.particle.io/t/deep-sleep-waking-after-only-3-seconds-when-should-sleep-for-longer/56265
**Category:** Device OS
**Tags:** photon
**Created:** [May 21, 2020, 5:46am UTC](https://community.particle.io/t/deep-sleep-waking-after-only-3-seconds-when-should-sleep-for-longer/56265 "2020-05-21T05:46:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![InventorSteve](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/inventorsteve/32/3220_2.png) [@InventorSteve](https://community.particle.io/u/InventorSteve)
#### Post date: [May 21, 2020, 5:46am UTC](https://community.particle.io/t/deep-sleep-waking-after-only-3-seconds-when-should-sleep-for-longer/56265/1 "2020-05-21T05:46:39Z")

</div>

Hi All,

Am I missing something silly?

I am trying to get the photon to Deep Sleep for 1 hour but it keeps waking after only a few seconds.

The code works fine with a fresh photon (with nothing wired to the board). However, when I connect my moisture sensor to the board the photon wakes after only a few seconds. Sensor is connected to GND VIN and A0 (DFRobot Capacitative Moisture Sensor). Photon powered via USB battery pack. I have also tried tying WKP Pin to ground using 3.7k resistor, but that didn’t help either?

Pulling my hair out here 🙂

Code is:

```cpp
#define SENSOR_PIN A0

int led2 = D7;
int SensorLevel = 0;

void setup() {

  pinMode(led2, OUTPUT);
  pinMode(SENSOR_PIN, INPUT);
}

void loop() {
// **********************Check moisture level and send to IFTTT*************
SensorLevel = analogRead(SENSOR_PIN);
//SensorLevel = 3000; //For testing
//SensorLevel = random(0,5000); //For testing

if (SensorLevel > 2750) {
    Particle.publish("WaterMeNow", String(SensorLevel), PRIVATE);

//LEDs flash for testing only
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    delay(200);
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    delay(200);
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
}
    
else {
    Particle.publish("NotThirsty", String(SensorLevel), PRIVATE);
  
//LEDs flash for testing only
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    delay(200);
    digitalWrite(led2, HIGH);
    delay(200);
    digitalWrite(led2, LOW);
    
}

// ****************************************************************************

  // Wait 0.5 minutes. For testing purposes to ensure I can reflash photon if necessary
delay(30000);

delay(1000);
System.sleep(SLEEP_MODE_DEEP, 60); //set to 60 seconds for test purposes only. Will change to 60min for real case

}

```

Cheers, and thanks in advance,  
Steve

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [May 21, 2020, 5:59am UTC](https://community.particle.io/t/deep-sleep-waking-after-only-3-seconds-when-should-sleep-for-longer/56265/2 "2020-05-21T05:59:08Z")

</div>

Could it be that your battery pack does something to the supply when the current draw from the Photon disapears?  
A dip in USB supply voltage can also wake the device from deep sleep.

---

<div class="post-metadata">

### Author: ![InventorSteve](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/inventorsteve/32/3220_2.png) [@InventorSteve](https://community.particle.io/u/InventorSteve)
#### Post date: [May 21, 2020, 6:09am UTC](https://community.particle.io/t/deep-sleep-waking-after-only-3-seconds-when-should-sleep-for-longer/56265/3 "2020-05-21T06:09:05Z")

</div>

@ScruffR Thank you! I tried the computer USB as a power source and it is working fine now.

Much appreciated,  
Steve
