Pysense pinout / wake on pin
-
@sslupsky The Pysense/Pytrack firmware was updated to support wake on pin (along with changes to the libraries), so it’s no longer needed to patch the firmware.
However you will still need to cut that pin to achieve good results.
Note that this only applies to Pysense/Pytrack controlled deep sleep / wake on pin. If you use one of the more recent modules (WiPy 3, LoPy 4, FiPy...), you should use the module’s native deep sleep and wake on pin functionality.
-
@jcaron Hang on, I've read elsewhere that if you are using a pysense or pytrack you should use the
deepsleepfrom the board library, yet here you say to use the one from the module. Which is it? Does using the board library only apply to older modules? If so, what classes as 'old'?I'm running a GPy on a Pysense board and need both deepsleep and wake-on-pin. Which should be called and what is the difference in functionality?
Thx
-
@john-baird The "old" boards (LoPy 1 but not LoPy 4, WiPy 2 but not 3, SiPy, possibly a few others) had an issue with deep sleep taking too much power.
On those,
machine.deepsleepwould use >10 mA in deep sleep. More recent boards (WiPy 3, LoPy 4, FiPy, and I believe the GPy as well) don't have that issue, and use about 10 µA in deep sleep (with the possible complications related to LTE etc. of course).If you don't use external sensors, then
machine.deepsleepis the recommended way of doing deep sleep.If you use a PySense or PyTrack, you have also to take into account the PIC and the sensors on those boards:
machine.deepsleepwill not shut them down, so they can continue drawing power during deep sleep.If you don't need those sensors during sleep, you can probably just power them off before going to sleep (and power them back on when you resume). The simplest way is probably to change the relevant PIC registers to cut the power to those. Not sure if there's enough information in the Pysense library for that, but it's not too difficult.
Then you still have the PIC that remains active (for the UART-to-USB bridge, mostly). Don't know how much power than one draws. If you really want to minimise your power draw, you'll have to put the PIC to sleep as well, and I'm not sure if there's a way to do that without also cutting power to the module.
If you need to wake up based on an interrupt from a sensor, you may also have to go through the PIC, though experience with that has not been quite positive (way too much power drawn when trying to use the accelerometer for wake up, for instance).
So it all really depends on your exact scenario. In my case I was using LoPy 1 modules, so I had no choice but PySense-controlled deep sleep. With a GPy the situation is quite different.
-
@jcaron Thanks for the clarification. Sounds like a bit of a mess really. I was hoping we could end up with a fairly standard codebase, changing modules depending upon the communication methods required. If there are so many variations between revisions and further differences depending on which board you have them seated in, it doesn't sound like a common codebase would be that easy. If the board library contains a
[board].deepsleepfunction I would have expected it to shut down the sensors I'm not using then callmachine.deepsleep. Having to reverse engineer a library to find out how to drive the hardware directly sort of defeats one of the advantages of having Python ... but maybe that's just me :-)Thanks for the information, I appreciate it.
-
@jcaron what does cutting the pin actually refers too?
-
@prashanth in our case, physically cutting the pin on the module so it’s isolated from the Pysense. That was the only way to have Pysense-controlled wake-on-pin work reliably with the sensor we used. YMMV.
-
@prashanth I have cut the pin p9 as you said, but it is not able to detect it as interrupt. I have used 1 if py.peek_memory(0xE) & 0x02 else 0 to read the status of the pins. It actually prints the data when detected. But, only problem it is not able to detect as interrupt. It toggles between 1 and 0 using sensor. If possible please share any example code which you have tested will be helpful to me. Thank You
-
@jcaron It's working as you said. Thank you
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