# Problem With WakeUp on External for Heltec ESP32 v2

**URL:** <https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654>\
**Category:** Hardware\
**Created:** [January 24, 2020, 8:25pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654 "2020-01-24T20:25:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hcfk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/hcfk/32/31477_2.png) [@hcfk](https://www.thethingsnetwork.org/forum/u/hcfk)\
**Post date:** [January 24, 2020, 8:25pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/1 "2020-01-24T20:25:28Z")

</div>

I am writing a simple code on Heltec ESP32 v2 board and want to make it deep sleep till an external signal got from PIR.  
For this GPIO\_NUM\_27 pin as input.  
But the problem is although the pir is not connected to the pin 27 it wakes up in 2-2.5 seconds I also changed it to low but no affect.  
I have tried the same with 33 there is no problem or 19.

The code is like

void setup(){  
//WIFI Kit series V1 not support Vext control  
Heltec.begin(false /_DisplayEnable Enable_/, true /_LoRa Disable_/, true /_Serial Enable_/, true /_PABOOST Enable_/, BAND /_long BAND_/);  
//Increment boot number and print it every reboot  
++bootCount;  
Serial.println("Boot number: " + String(bootCount));  
delay(2);  
//Print the wakeup reason for ESP32  
print\_wakeup\_reason();  
Serial.println(“Setup ESP32 to sleep for every " + String(TIME\_TO\_SLEEP) +  
" Seconds”);  
delay(100);

LoRa.end();  
LoRa.sleep();  
delay(100);

pinMode(5,INPUT);

pinMode(14,INPUT);  
pinMode(15,INPUT);  
pinMode(16,INPUT);  
pinMode(17,INPUT);  
pinMode(18,INPUT);  
pinMode(19,INPUT);

pinMode(26,INPUT);  
pinMode(27,INPUT);

delay(100);  
Serial.println(“Going to sleep now”);  
delay(2);  
esp\_sleep\_enable\_ext0\_wakeup(GPIO\_NUM\_27,1);  
delay(1000);  
esp\_deep\_sleep\_start();  
Serial.println(“This will never be printed”);  
}

---

<div class="post-metadata">

**Author:** ![MOS-FET](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mos-fet/32/35697_2.png) [@MOS-FET](https://www.thethingsnetwork.org/forum/u/MOS-FET)\
**Post date:** [January 24, 2020, 9:55pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/2 "2020-01-24T21:55:55Z")

</div>

I did same as you. I tried first this code example:  
[https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/](https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/)

---

<div class="post-metadata">

**Author:** ![hcfk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/hcfk/32/31477_2.png) [@hcfk](https://www.thethingsnetwork.org/forum/u/hcfk)\
**Post date:** [January 26, 2020, 11:05pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/3 "2020-01-26T23:05:20Z")

</div>

Yes that was the starting point but did not create a solution on Heltec.

---

<div class="post-metadata">

**Author:** ![hcfk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/hcfk/32/31477_2.png) [@hcfk](https://www.thethingsnetwork.org/forum/u/hcfk)\
**Post date:** [January 26, 2020, 11:08pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/4 "2020-01-26T23:08:12Z")

</div>

There is a discussion [https://github.com/Heltec-Aaron-Lee/WiFi\_Kit\_series/issues/6](https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/issues/6)

---

<div class="post-metadata">

**Author:** ![bluejedi](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/bluejedi/32/44639_2.png) [@bluejedi](https://www.thethingsnetwork.org/forum/u/bluejedi)\
**Post date:** [January 27, 2020, 10:14am UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/5 "2020-01-27T10:14:10Z")

</div>

> [@hcfk](#):
>
> I am writing a simple code on Heltec ESP32 v2 board and want to make it deep sleep till an external signal got from PIR.  
> For this GPIO\_NUM\_27 pin as input.  
> But the problem is although the pir is not connected to the pin 27 it wakes up in 2-2.5 seconds I also changed it to low but no affect.  
> I have tried the same with 33 there is no problem or 19.

GPIO27 is wired to LoRa MOSI  
GPIO19 is wired to LoRa MISO

To prevent issues you should not use these GPIO’s to trigger external wakeup interrupts from a PIR.

* * *

Not relevant for your issue, but note that Heltec Wifi LoRa 32 V2 has I2C related configuration issues.  
See the [following post](https://www.thethingsnetwork.org/forum/t/big-esp32-sx127x-topic-part-3/18436/312) for more information.

---

<div class="post-metadata">

**Author:** ![hcfk](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/hcfk/32/31477_2.png) [@hcfk](https://www.thethingsnetwork.org/forum/u/hcfk)\
**Post date:** [January 28, 2020, 12:42am UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/6 "2020-01-28T00:42:37Z")

</div>

Thanks blueJedi. You are right i will change the GPIO port. As declared in the layout only 2,12,13 are free to use for digital in.  
 ![image](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/8/2/82aa886952ddc00c338b1602f00f50526728c0fe.png)

---

<div class="post-metadata">

**Author:** ![saiyo143](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/8c91f0/32.png) [@saiyo143](https://www.thethingsnetwork.org/forum/u/saiyo143)\
**Post date:** [January 7, 2025, 3:49pm UTC](https://www.thethingsnetwork.org/forum/t/problem-with-wakeup-on-external-for-heltec-esp32-v2/33654/7 "2025-01-07T15:49:40Z")

</div>

Hello, by any chance, have you already fixed your issues regarding the external wakeup? I would love to hear some advice as i am also working on a simple project and i want to use rain sensor as the source of the external wakeup from deep sleep. Any advice would greatly help me. Thank you in advance
