Wake up from deep sleep via accelerometer outputs?
-
I am using Lopy4 + PySense and trying to use PySense accelerometer measurements to define my wake up condition based on a threshold determined by me. How is it possible?
Also, what is the difference between using machine.deepsleep and the Deep Sleep API? Sorry, I just started with Pycom
#Lopy4 #PySense
-
machine.deepsleep() just puts the lopy4 to sleep.
The deepsleep API can be used with some of our expansion boards (Pysense/track ect) to also put that to sleep as well.
-
We have a basic example of "wake on shake" available here: https://github.com/pycom/pycom-libraries/blob/master/examples/accelerometer_wake/main.py
-
This post is deleted! -
@gabrielapb said in Wake up from deep sleep via accelerometer outputs?:
While sleeping, the device should still be able to keep running the RTC and saving the measurements in a file.
Unfortunately, sleeping means just that. It's asleep. you can have it wake up every "X" period. take a measurement and write it to the file then go back to sleep.
Yes. When waking up it will indeed restart the script. You can use the wake reason to see why it was woken up and react accordingly.
Ie run one set of functionality if the wake reason was the accelerometer. another if it was due to a timer.
-
@paul-thornton Why are there 2 different libraries to put the expansion boards to sleep? (via pysense lib and deepsleep API)
-
@gabrielapb said in Wake up from deep sleep via accelerometer outputs?:
@paul-thornton Why are there 2 different libraries to put the expansion boards to sleep? (via pysense lib and deepsleep API)
The machine API does not know which hardware is connected. So it will send only the LoPy into sleep mode and not the pysense board. The pysense board will cut the power to the *Py, so it will be forced to sleep as well ;)
-
@crumble Thanks, I got this part, but now I am actually asking about this https://docs.pycom.io/datasheets/boards/deepsleep/api.html and https://docs.pycom.io/pytrackpysense/apireference/sleep.html, since both can be used to put Pysense to sleep
-
@gabrielapb the first one is specifically for the Deep Sleep shield which has equivalent functionality to the Pysense for deep sleep control only (it was a workaround for some of the early modules which used too much power while in
machine.deepsleep).You should definitely use the Pysense lib.
-
@gabrielapb said in Wake up from deep sleep via accelerometer outputs?:
@crumble Thanks, I got this part, but now I am actually asking about this https://docs.pycom.io/datasheets/boards/deepsleep/api.html and https://docs.pycom.io/pytrackpysense/apireference/sleep.html, since both can be used to put Pysense to sleep
DeepSleep() is there for those that dont need the extra Pytrack/Pysense functionality. the versions inside the Pytrack/Pysense class are the same as DeepSleep() but included in the Pytrack/Pysense libs as a convinience. .
@jcaron has this perfectly. use the Pysense lib.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login