board and pycom deep sleep
-
Does the pysense board and the pycom chip have their own deep sleep modes? How are they related and how do i combine them to deep sleep both at the same time.
-
I have noticed that upon wake up, that *.py files randomly get errors but when i reset its fine. Didn't know I had to do machine.deepsleep first to close down OS!
I really enjoy the pycom ecosystem BUT the effort should be on a robust OS and not extra hardware. This will bite them...Reliability always win in the long term..
-
@PeterB This is actually documented: https://docs.pycom.io/datasheets/boards/pysense.html
Pin 6 on the Pysense Ext I/O header is connected to P9.
The accelerometer interrupt is connected to P13.
Take it with a grain of salt, though, as there have been many errors in those specs, so double checks are in order.
Note that my experience with the accelerometer is that is uses > 300 µA when the Pysense is in deep sleep (with the ESP32 switched off). Hopefully it will use a lot less if you keep the Pysense running (provided you correctly configure the accelerometer).
NB: IIRC there are errors in the LIS2HH12 data sheet. Can't quite remember what they were though. Something about the interrupt thresholds I believe.
-
@jcaron said in board and pycom deep sleep:
@PeterB you would have to check if those are wired to pins of the ESP32. If they are you can wake up on those pins.
Difficult without board documentation. This kind of information should come from Pycom.
It is too much a hobby project, not really for professional use.
-
@PeterB you would have to check if those are wired to pins of the ESP32. If they are you can wake up on those pins.
-
@jcaron How about the wake up functions of the pysense if you do not put it to sleep, but only the ESP32? The accelerometer and button connected to external connector pin 6 should be able to wake up the whole system.
-
@PeterB Have you measured how much the Pysense board draws while the ESP32 is in deep sleep? It shouldn't be much, there's just a tiny PIC doing USB... Unless you use any of the other sensors, but those can be controlled separately.
If you really need to shut down the Pysense's PIC while at the same time using the ESP32's native deep sleep, then it will probably require a change to the PIC's firmware. However, the source code for that is not published, so you'll have to ask Pycom to add the feature. Going to sleep without changing the ESP32's power should be easy. The question then is how do you handle wake up (should the ESP32 wake up the PIC? Should the PIC wake up the ESP32?...).
-
@misterlisty said in board and pycom deep sleep:
Does the pysense board and the pycom chip have their own deep sleep modes? How are they related and how do i combine them to deep sleep both at the same time.
Good quesion, not really documented.
There are two commands:- machine.deepsleep() putting the main processor in sleep, but first closing the running OS nicely. It does not put the pysense to sleep.
- py.go_to_sleep() rudly swiching power to the main processor off without closing the OS nicely and sleeping the pysense board. Meaning that files which are closed according python but not fully cloesed yet for the OS, are damaged in that process.
One or the other stops executing the program and so they can not be really combined. I also really need the combination:
the main processor HAS TO BE put to sleep correctly, not with a rude power failure damaging files and the pysense has to be put to sleep including its own wake functions.
I did not find a sloution yet.