I am using a lopy4 and a pysense board and would like to mesure temperature and pressure and send them using lorawan.
After sending the data, I would like to go to deepsleep and be waked up in case of an interrupt.
Should I use machine.deepsleep() or the pysense.go_to_sleep() method ? which method generate the lowest current in deepsleep modus ?
John Baird last edited by
@jcaron Thanks. I'm (literally) waiting for the glue to dry and then I'll be trying to wake from deepsleep on a GPy in a PySense. I'll let you know how it goes - but thanks for the information.
@john-baird I only experienced wit the LoPy (1), but I'm expecting the issue to be valid for all modules if you use Pysense-controlled deep sleep and want to wake on pin.
John Baird last edited by
@jcaron Does this pin clash apply to the GPy and FiPy as well, or only the LoPy?
@geda the Pysense-controlled Deep Sleep has the advantage that it will (under the right conditions) make sure that all sensors on the Pysense are powered down as well, not only the LoPy 4.
If wake up on the built-in Pysense button is fine for you, I believe you can use that one without a problem.
If you need to wake up on a different pin, trouble starts. There’s only one pin on the pysense I/O header you can use for wake-up, but it’s connected to both the PIC on the Pysense and the LoPy 4. When the Pysense puts the LoPy 4 to sleep, it actually powers it off completely, and the pin ends up being pulled down or something similar, which interferes with the observed voltages, and entering/exiting deep sleep will lead to spurious interrupts. If you want to avoid those you’ll have to cut/isolate one of the pins of the LoPy 4. I wrote out the details in another thread in the forum a while ago.
Note that you also need the latest Pysense firmware (0.0.8 or newer).
Alternatively, you could just use
machine.deepsleepand make sure you power down all the sensors beforehand (probably need to talk to the PIC directly to do that, but you should find relevant pointers in the Pysense library). You can then wake up on any of LoPy 4 pins you want.
YMMV, let us know how things work out for you.
@jcaron I just need to be waked up when the user press a button, that means
when an input pin goes high. I don't need any pysense specific to be waked up.
Paul Thornton last edited by
You'll want the go_to_sleep() version.
@randomrnti With a LoPy4, there's a choice between using the "native"
machine.deepsleepand the Pysense-controlled deep-sleep. Using one or the other depends on the exact scenario (including the wake-up source).
Note that wake-on-pin using Pysense-controlled deep sleep requires a pin to be cut on the LoPy, otherwise it's very unreliable in my experience.
Wake on move/shake is quite power-hungry, last I heard.
randomrnti last edited by
Did a quick search and the link below looks to be roughly what you're after. The pysense.go_to_sleep() looks to use significantly less current.
@geda what interrupt do you want to wake up on?