ESP32 module, wake_on_touch, wake_on_ext1

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
tahouse
Posts: 1
Joined: Mon Aug 20, 2018 8:07 pm

ESP32 module, wake_on_touch, wake_on_ext1

Post by tahouse » Mon Aug 20, 2018 8:28 pm

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:

[code]
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)
[/code]

after bringing Pin 14 line up to 3V3
[code]
Reset cause: DEEPSLEEP_RESET
Wake reason: PIN_WAKE/EXT0_WAKE
[/code]

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

[code]

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)
[/code]
(after 5 seconds and touching/untouching wire to Pin 14)
[code]
Reset cause: DEEPSLEEP_RESET
Wake reason: TIMER_WAKE
[/code]

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
[code]
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)
[/code]

But this resets immediately regardless of whether I bring Pin 14 high or not (not in touch mode, mind you).
[code]
Reset cause: DEEPSLEEP_RESET
Wake reason: EXT1_WAKE
[/code]

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

Any ideas?

andermutu99
Posts: 18
Joined: Thu Sep 27, 2018 10:19 am

Re: ESP32 module, wake_on_touch, wake_on_ext1

Post by andermutu99 » Fri Nov 02, 2018 10:56 am

Hi;

I am interested in wake up ESP32 from touch pin. Have you found a solution?

Thanks.

andermutu99
Posts: 18
Joined: Thu Sep 27, 2018 10:19 am

Re: ESP32 module, wake_on_touch, wake_on_ext1

Post by andermutu99 » Fri Nov 02, 2018 5:46 pm

andermutu99 wrote:
Fri Nov 02, 2018 10:56 am
Hi;

I am interested in wake up ESP32 from touch pin. Have you found a solution?

Thanks.
I have the same problem that ESP32 resets immediately, however it worked sometimes (I have a video). But now it does not work, and the board resets after deep sleep. Any help is highly appreciated.

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


time.sleep(5)
machine.deepsleep(10000)

Thanks.

fid
Posts: 1
Joined: Sun Jan 20, 2019 2:33 am

Re: ESP32 module, wake_on_touch, wake_on_ext1

Post by fid » Sun Jan 20, 2019 2:47 am

andermutu99 wrote:
Fri Nov 02, 2018 5:46 pm
andermutu99 wrote:
Fri Nov 02, 2018 10:56 am
Hi;

I am interested in wake up ESP32 from touch pin. Have you found a solution?

Thanks.
I have the same problem that ESP32 resets immediately, however it worked sometimes (I have a video). But now it does not work, and the board resets after deep sleep. Any help is highly appreciated.

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


time.sleep(5)
machine.deepsleep(10000)

Thanks.
I was looking for information for a few hours about raising from deep sleep using a touch pin. I solved it with your code and by taking out the 10000 in the last line of your code. It now reads: machine.deepsleep()
Here's what I uploaded to the ESP32:

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

print('Entering Deep Sleep in 10 seconds.')
time.sleep(10)
print('Time is up. Going to sleep')
machine.deepsleep()

I did put ten seconds into the sleep command so I had time to stop the code from running. That way I can upload something else. I don't have any wire attached to the module. I have to touch the actual pin.

Thank you!
fid

Post Reply