Using the four lines of code below, to wake up ESP32-S2 QT PY every 20 seconds then go immediately back to sleep, it appears to be taking 1 second to wakeup, with peak current bursts of up to 55mA.
In this test, the neopixel does not light, as waking from DEEP SLEEP, and the USB cable to PC is disconnected. Just testing on stand-alone ESP32-S2 QT Py running CP version 8.0.0-beta.4-4-gb6276265c.
I have been unable to find what is causing the 1 Second wakeup time, and secondly the high current bursts. Looking for a way to tame both of those aspects for a low current battery based application that needs to wake often to read a sensor, then go back to sleep.
We are looking to capture impulse shock values, so we need to capture the readings fairly often, vs other traditional sensors where we can sample at a much slower rate.
The long time and high current during wakeup is detrimental on our power budget. Hoping there is a way these can be tamed on the ESP32-S2 using the stock CP builds.
DEEP SLEEP current running about 80uA, which is nice!
import alarm
import time
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 20)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)
ESP32-S2 QT PY Deep Sleep Wakeup Time
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- chadlung
- Posts: 13
- Joined: Tue Oct 04, 2022 11:57 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Hello. Just a question. It looks like your output is from a Nordic Power Profiler Kit II - is that a correct assumption on my part? I'm curious as I'm about to out one on order and would like to also try your code on one of my ESP32-S2 QT PY's to see if I get the same results.
- ISI_BOB
- Posts: 40
- Joined: Tue Jan 11, 2022 3:14 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Yes, It is Nordic PPK2. You won't regret the purchase, it works great! Been using it now for a couple of weeks and have no complaints. Well, I guess if I had a complaint, I have not been able to find guidance on how to hook it up to a third-party DUT in "Ampere meter" mode. All of their examples show connecting to their dev boards, which already have a dedicated port.
- chadlung
- Posts: 13
- Joined: Tue Oct 04, 2022 11:57 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Thanks for the info. Mine is on order now from Digikey so once it arrives I will try this out and post my results on this thread. Hopefully though by then your issue is solved. Good luck!
- ISI_BOB
- Posts: 40
- Joined: Tue Jan 11, 2022 3:14 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
I am still trying to figure out what is causing the long startup delays.
No response from forum admins or email support, so trying anything I can think of.
I suspect may have to do with USB enumeration, but not 100% sure.
I do observe if USB is connected, boot time can get as fast as about 380mS, vs over 1000mS when not tethered.
When waking up from a DEEP SLEEP, it appears boot.py and code.py are ran.
Using alarm.wake_alarm in boot.py, would it be possible to completely bypass the USB code and perform a very speedy bootup process?
Something like this?
storage.disable_usb_drive()
usb_cdc.disable()
No response from forum admins or email support, so trying anything I can think of.
I suspect may have to do with USB enumeration, but not 100% sure.
I do observe if USB is connected, boot time can get as fast as about 380mS, vs over 1000mS when not tethered.
When waking up from a DEEP SLEEP, it appears boot.py and code.py are ran.
Using alarm.wake_alarm in boot.py, would it be possible to completely bypass the USB code and perform a very speedy bootup process?
Something like this?
storage.disable_usb_drive()
usb_cdc.disable()
- chadlung
- Posts: 13
- Joined: Tue Oct 04, 2022 11:57 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
My Nordic PPK2 arrives Saturday. One thing I did think of was if you tried this same thing but writing the test code using Sketch/C++ and seeing if there were any differences.
- ISI_BOB
- Posts: 40
- Joined: Tue Jan 11, 2022 3:14 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
I took a quick look yesterday to see what would be involved in migrating to Arduino code, but we are on very tight time crunch on this project, so opted to deal with it the best I can. With the full set of Circuitpython includes and boot.py in place, I am seeing about 2 second boot times, with peak current levels in the 20-60mA range.
If I duty cycle with wake from Deep Sleep every 30 seconds, I get an average current of approx 2mA. I am working on stretching that out to do 60 seconds wakeups, to bring the average current down even more, but I have an accelerometer that really could stand to be read every 15 seconds, or even less. The 2 second boot time is really detrimental to the average current, when trying to take sensor readings a couple several times a minute.
I did try to shut down CDC this morning, but had no luck there, only ended bricking the device and had to do a complete factory reset to get it back up and going again.
I usually have really good luck with Adafruit support, but pretty much getting crickets on this one.
If I duty cycle with wake from Deep Sleep every 30 seconds, I get an average current of approx 2mA. I am working on stretching that out to do 60 seconds wakeups, to bring the average current down even more, but I have an accelerometer that really could stand to be read every 15 seconds, or even less. The 2 second boot time is really detrimental to the average current, when trying to take sensor readings a couple several times a minute.
I did try to shut down CDC this morning, but had no luck there, only ended bricking the device and had to do a complete factory reset to get it back up and going again.
I usually have really good luck with Adafruit support, but pretty much getting crickets on this one.
- chadlung
- Posts: 13
- Joined: Tue Oct 04, 2022 11:57 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Ugh FedEx, so much for 2 day delivery. Looks like I won't have my Nordic PPK2 until Monday now.
Have you gotten any further progress since your last update?
Have you gotten any further progress since your last update?
- danhalbert
- Posts: 4683
- Joined: Tue Aug 08, 2017 12:37 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
The reason for what you see may be complicated, or it may be a bug. If USB is connected, then the board should do a "fake" deep sleep, and you would not see the power savings you are seeing. But if USB is not connected, it should wake up fairly quickly. However, there are various delays for various purposes. Could you open an issue with a simple small sample program and the PPK2 plot?
- ISI_BOB
- Posts: 40
- Joined: Tue Jan 11, 2022 3:14 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
I am forum naive, to open an issue is that a new forum post or is there some other process to go through?
- danhalbert
- Posts: 4683
- Joined: Tue Aug 08, 2017 12:37 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Sorry, I meant on the circuitpython source code repository, here: https://github.com/adafruit/circuitpython. You can also search the existing sleep issues and see if any sound similar.
Issues there are not meant for providing simple support, but are for reporting bugs or requesting enhancements. This could be a bug or a potential enhancement (lower sleep latency).
Issues there are not meant for providing simple support, but are for reporting bugs or requesting enhancements. This could be a bug or a potential enhancement (lower sleep latency).
- chadlung
- Posts: 13
- Joined: Tue Oct 04, 2022 11:57 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
Sorry this took me so long. The PPK2 from Nordic took a lot longer to get than the 2 day FedEx it shipped as. Anyway, finally got to this tonight. Posting my results but it looks like they are very similar to the ones above. I used the same code from this posting. Circuit Python v7.3.3 and using the same hardware: ESP32-S2 QT PY along with a QT PY BFF Adafruit #5348 to feed the power in more easily (I was also waiting for this Adafruit shipment to arrive).
- picofun
- Posts: 24
- Joined: Fri Jul 29, 2022 9:22 am
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
I can also see these values with my code. With modem in sleep mode, the datasheet claims something like 30mA with the cpu running at 240 (full speed). But the datasheet is only about the ESP32-S2, not about the breakout.
- rdlaner
- Posts: 10
- Joined: Sun Apr 15, 2018 2:52 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
@ISI_BOB, did you have any luck figuring this out?
I'm encountering the same issue as I'm trying to drive down the boot time on a Magtag in order to preserve battery life.
I'm encountering the same issue as I'm trying to drive down the boot time on a Magtag in order to preserve battery life.
- ISI_BOB
- Posts: 40
- Joined: Tue Jan 11, 2022 3:14 pm
Re: ESP32-S2 QT PY Deep Sleep Wakeup Time
I have not resolved this, but it sure does have a detrimental accumulative effect on the power budget.
Please be positive and constructive with your questions and comments.