← index #4060Issue #15260
Related · high · value 3.595
QUERY · ISSUE

ESP32 module wake on touch, wake on ext1

openby tahouseopened 2018-08-17updated 2019-05-28
port-esp32

Hi there,

I'm running MicroPython v1.9.4-409-g434975def and have successfully used a Pin irq to wake from deep sleep and can confirm the wake reason:

import machine
from machine import Pin, TouchPad, deepsleep
import time

wake = Pin(14, mode = Pin.IN, pull = Pin.PULL_DOWN)
wake.irq(trigger=Pin.WAKE_HIGH, wake = machine.DEEPSLEEP)

time.sleep(5)
deepsleep(5*1000)

after bringing Pin 14 line up to 3V3

Reset cause:  DEEPSLEEP_RESET
Wake reason:  PIN_WAKE/EXT0_WAKE

Now I'm trying to do the same but with a TouchPad input:


from machine import Pin, TouchPad, deepsleep
import time
import esp32

wake = Pin(14, mode = Pin.IN)
touch = TouchPad(wake)
touch.config(500)
esp32.wake_on_touch(True)

time.sleep(5)
deepsleep(5*1000)

(after 5 seconds and touching/untouching wire to Pin 14)

Reset cause:  DEEPSLEEP_RESET
Wake reason:  TIMER_WAKE

The range of my touch.read() values are around 700 when untouched, and down to around 100 when touched. I've tried adjusting the touch.config to various settings but I cannot get my ESP32 to wake from touch.. only from timer in this mode.

Lastly,
I've tried using wake_on_ext1

import machine
from machine import Pin, TouchPad
import time
import esp32
wake = Pin(14, mode = Pin.IN, pull = Pin.PULL_DOWN)
esp32.wake_on_ext1(pins = [wake], level = Pin.WAKE_HIGH)

time.sleep(5)
deepsleep(5*1000)

But this resets immediately regardless of whether I bring Pin 14 high or not (not in touch mode, mind you).

Reset cause:  DEEPSLEEP_RESET
Wake reason:  EXT1_WAKE

I've browsed through the esp32 module code, but I'm not sure if any of the wake modes work?

Any ideas?

CANDIDATE · ISSUE

esp32.wake_on_ext0 not workingon esp32s2

openby kjm1102opened 2024-06-12updated 2024-09-01
bugdocs

Port, board and/or hardware

esp32 port, waveshare ESP32-S2-Pico

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Generic ESP32S2 module with ESP32S2

Reproduction

import os,time,esp32
from machine import Pin,deepsleep

time.sleep(5)
pb=Pin(0, Pin.IN); esp32.wake_on_ext0(pb,0)
deepsleep(10*1000)

Expected behaviour

Loaded the file as main.py then reset the board. Expected s2 to either deepsleep for 10s or exit deepsleep when I press the button connected to gpio0.

Observed behaviour

The s2 exits deepsleep immediately after entering it. This can be verified with a usb ammeter in series with the usb powering the board. I did not include print commands because having a usb repl active often plays badly with deepsleep.

Additional Information

esp32.wake_on_ext0 works OK with deepsleep on an esp32 v1.23.0 so I figure the instant wakeup on the s2 is down to it being an s2.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied