ESP32 module wake on touch, wake on ext1
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?
ESP32 S2 or S3 , can not from machine import TouchPad
I built the firmware under the following conditions:
ESP-IDF v5.0-dev-517-g68cf4ef2be
MicroPython v1.17-212-g23a150789-dirty
I tested on esp32, esp32s2 and esp32s3 chips,Touchpad module is only available on esp32.
When I enter this code in repl:
from machine import TouchPad
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: can't import name TouchPad
So I further confirm whether it exists:
>>> import machine
>>> machine.
ADC DAC DEEPSLEEP DEEPSLEEP_RESET
EXT0_WAKE EXT1_WAKE HARD_RESET I2C
I2S PIN_WAKE PWM PWRON_RESET
Pin RTC SLEEP SOFT_RESET
SPI Signal SoftI2C SoftSPI
TIMER_WAKE TOUCHPAD_WAKE Timer UART
ULP_WAKE WDT WDT_RESET bitstream
deepsleep disable_irq enable_irq freq
idle lightsleep mem16 mem32
mem8 reset reset_cause sleep
soft_reset time_pulse_us unique_id wake_reason
>>> machine.
What is hard to understand is , TOUCHPAD_WAKE is still there, but the TouchPad is gone?!
I reconfirmed that touchpad has been supported on esp32s2 and s3
https://github.com/micropython/micropython/blob/23a150789df1029def2a26cb757e7d6703520159/ports/esp32/machine_touchpad.c#L59-L62
I'm not sure if there's anything I haven't checked.
Hope to get some inspiration or help.