Sleep functions, something to keep in mind

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MarkEmK
 
Posts: 13
Joined: Sun Jul 25, 2021 4:46 pm

Sleep functions, something to keep in mind

Post by MarkEmK »

I'm using a sleep function to reduce the power consumption of a Feather m0 nrf69 operating as a remote sensor and encountered an "interesting" consequence. On entry to my loop() routine I immediately put the Feather to sleep for 10 minutes. After it wakes back up, it reads the sensors and transmits the data to my base station receiver (another Feather). This works OK, except when I want to upload a new program. The reason: when the Feather goes to sleep, the USB port disconnects -- so the Feather becomes inaccessible, except for a brief time when it reads the sensors and transmits the result.

Fortunately, the Feather's bootloader was written so that two quick presses on the reset button put it into its upload mode. This is something to consider when using an Arduino or clone that doesn't have that feature or its equivalent. If you have one without the feature, it would be wise to reserve a digital pin that can be monitored via code to prevent the microcontroller from going to sleep.

Mark

User avatar
MarkEmK
 
Posts: 13
Joined: Sun Jul 25, 2021 4:46 pm

Re: Sleep functions, something to keep in mind

Post by MarkEmK »

The examples in the Arduino_Low_Power library do mention the upload issue when using the sleep routines. I didn't notice that warning when I first looked at the examples.....or it didn't penetrate my thick skull....

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Sleep functions, something to keep in mind

Post by Franklin97355 »

Thanks for posting. I'm sure others have missed that info also.

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

Return to “Microcontrollers”