ESP32S2: Scheduling tasks with deepsleep

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
p_j
Posts: 102
Joined: Mon Aug 23, 2021 1:08 pm
Location: Sydney

ESP32S2: Scheduling tasks with deepsleep

Post by p_j » Sun Oct 24, 2021 9:26 am

I'm looking for a way to schedule tasks in micropython, for example read a sensor every 15 minutes, upload data every hour etc...

There are lots of methods to do this using various techniques however I can't find much info on how this can be done if you want to put the MCU to sleep in between task runs as deepsleep will usually results in losing state.

I was thinking of making a list of events in advance and then storing this in the RTC memory. When the MCU wakes it would pull the next task from the list, complete task and then determine how long it needs to go back to sleep for.

Does anyone have any better suggestions?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Scheduling tasks with deepsleep

Post by pythoncoder » Mon Oct 25, 2021 7:15 am

You haven't told us what hardware you're using. There is information on how to do this with Pyboards here but other platforms will vary greatly.
Peter Hinch
Index to my micropython libraries.

p_j
Posts: 102
Joined: Mon Aug 23, 2021 1:08 pm
Location: Sydney

Re: Scheduling tasks with deepsleep

Post by p_j » Thu Oct 28, 2021 2:55 am

Thanks Peter I'll have a look at that link.

I'm currently using an ESP32S2 chip, custom PCB.
pythoncoder wrote:
Mon Oct 25, 2021 7:15 am
You haven't told us what hardware you're using. There is information on how to do this with Pyboards here but other platforms will vary greatly.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ESP32S2: Scheduling tasks with deepsleep

Post by pythoncoder » Thu Oct 28, 2021 9:54 am

I've no experience wit that chip. I've changed the title of your root message in the hope that someone will pop up who can help.
Peter Hinch
Index to my micropython libraries.

Post Reply