Deep Sleep on EyeLights Driver Board

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ISI_BOB
 
Posts: 40
Joined: Tue Jan 11, 2022 3:14 pm

Deep Sleep on EyeLights Driver Board

Post by ISI_BOB »

I am using the following block of code at the beginning of code.py, waking up every two seconds to see if user is pressing side button to "turn on" the board. All seems to work well, except on each wake I'm getting several led flashes which I assume are from the nrf52840 going through some initialization process. Is there a way to suppress those lights and keep the BLE module powered down until we drop though the button logic and enter into normal operation?

Code: Select all

# BUTTON LOGIC
if not button.value: #btn pressed
    pixels.fill((255,0,0)) #red
    while not button.value: #wait until user releases button
        pass
    time.sleep(0.050) #debounce
    pixels.fill((0, 0, 0))
else:
    time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 2)
    alarm.exit_and_deep_sleep_until_alarms(time_alarm)

#drop-through normal operation...
temp_svc = TemperatureService()
temp_svc.measurement_period = 100
temp_last_update = 0

ble = BLERadio()
ble.name = device_name

User avatar
tannewt
 
Posts: 3314
Joined: Thu Oct 06, 2016 8:48 pm

Re: Deep Sleep on EyeLights Driver Board

Post by tannewt »

It should skip the init blinks on wake from deep sleep. If it isn't, then there must be a bug. What version are you using?

I think that the BLE workflow will turn on BLE by default. The function to turn it off is `supervisor.disable_ble_workflow()`: https://circuitpython.readthedocs.io/en ... e_workflow

After that, I think ble is disabled until `import _bleio` so do any imports of ble after you've checked the button.

User avatar
ISI_BOB
 
Posts: 40
Joined: Tue Jan 11, 2022 3:14 pm

Re: Deep Sleep on EyeLights Driver Board

Post by ISI_BOB »

version 7.0.0.

I am experimenting now with moving the inits around, and the BLE shutdown command you mention...

User avatar
ISI_BOB
 
Posts: 40
Joined: Tue Jan 11, 2022 3:14 pm

Re: Deep Sleep on EyeLights Driver Board

Post by ISI_BOB »

I have simplified the code to the following, and still getting the a sequence of lights on wake. This only happens when disconnected from USB serial. Additionally, I have tried supervisor.disable_ble_workflow() in boot.py with same results:

import alarm
import time

time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 3)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)

while True:
pass



The LED sequence, using EyeLights Driver Board, with CircuitPython 7.1.0:

"NEO" RGB | RED "LED"
--------------------------------------------------
solid (RED) | 2 flash
3 flash (YEL) |
7 flash (BLU) |

User avatar
tannewt
 
Posts: 3314
Joined: Thu Oct 06, 2016 8:48 pm

Re: Deep Sleep on EyeLights Driver Board

Post by tannewt »

Please try 7.1.0 and the absolute latest builds. We may have already fixed this issue in newer versions.

User avatar
ISI_BOB
 
Posts: 40
Joined: Tue Jan 11, 2022 3:14 pm

Re: Deep Sleep on EyeLights Driver Board

Post by ISI_BOB »

Tested this morning, same results, using the following and the base code block above:

adafruit-circuitpython-adafruit_led_glasses_nrf52840-en_US-7.1.0.uf2
adafruit-circuitpython-bundle-7.x-mpy-20220114

User avatar
tannewt
 
Posts: 3314
Joined: Thu Oct 06, 2016 8:48 pm

Re: Deep Sleep on EyeLights Driver Board

Post by tannewt »

I've filed an issue here: https://github.com/adafruit/circuitpython/issues/5857

In the meantime, I'd suggest using light sleep. I think it's pretty good on its own.

User avatar
mrdalgaard
 
Posts: 4
Joined: Wed Aug 25, 2021 2:17 am

Re: Deep Sleep on EyeLights Driver Board

Post by mrdalgaard »

I did some testing with the Nordic PPK2 on the nRF52840 (Adafruit Feather nRF52840 Sense)
Basically in the current alarm implementation on CP 7.2 the power consumption is exactly the same in light sleep as it is in deep sleep.
If you switch to using light sleep you will save having to reinitialize you code, load modules, etc, and actually save power.
Attachments
snip.PNG
snip.PNG (85.45 KiB) Viewed 84 times

User avatar
ISI_BOB
 
Posts: 40
Joined: Tue Jan 11, 2022 3:14 pm

Re: Deep Sleep on EyeLights Driver Board

Post by ISI_BOB »

Thank you for the update. The light sleep mode seems to be working well for our application.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”