Using py.setup_int_pin_wake_up(True)
-
According to the sleep documentation at https://docs.pycom.io/pytrackpysense/apireference/sleep/ you can wake up a lopy4 when using a pysense using the INT pin which is PIC_RC1 on the pysense.
When I run the "Quick usage example" I'm unable to wake up the board by bringing P9 / PIC_RC1 to ground.
I've tried setting up the pin (
p_in = Pin('P9', mode=Pin.IN, pull=Pin.PULL_DOWN)
) but it doesn't wake up. There are suggestions to cut p9 but as this is advertised to work I do expect that this should work!!Can someone from Pycom state categorically whether you can wake up a lopy4 when using pysense on pin9 and again(rising or falling edge) please?
Surely the correct thing to do would be to update the documentation if the only resort is cutting a pin!?
-
I just realized that I could get actually get a much finer readout that I originally thought.
Running the Pytrack with just the 10K resistor on the latest firmware is yeilding me 8.5uA. Give the error of my power supply on the readout listed here , that would put the power draw in line with the expected 20uA.
So it seems like the draw is actually negligible here.
-
@jcaron said in Using py.setup_int_pin_wake_up(True):
330 uA would be a dramatic increase over the expected deep sleep current (around 20 uA). Hope it’s a lot less than that.
I did not realize that it was that low, and unfortunately I do not have any good way to measure current draw below 0.1mA.
I can say that in my case, with a sensor that draws about 80uA, the current I am getting is still 0.1mA.Just to clarify, that calculation is a worst case scenario where the chip is being pulled up to 3.3V actively, so it shouldn't be near that.
I decided to calculate the worst-case that way given I saw some old posts that were suggesting that the issues were caused by the lopy actually somewhat pulling up that pin, rather than just leaving it floating. I measured in my case and the voltage did seem to be about ~1.5-1.6V consistently on that pin of the expansion board but was not able to test if it was being pulled up, or how much power was being dissipated in grounding it.
-
@MichaelWojcik 330 uA would be a dramatic increase over the expected deep sleep current (around 20 uA). Hope it’s a lot less than that.
-
@jcaron said in Using py.setup_int_pin_wake_up(True):
remember if I had tried that back then.
Is there any impact on power draw during deep sleep though?The difference is too small for me to be able to see (under 0.1mA).
If the pin was being held at 3.3V a 10k pull down resistor should really only draw 0.33mA from the battery in a worst case scenario, so unless there is something weird going on with the chip or expansion board it shouldn't really affect too much.
Now, with the latest few versions of the firmware I do sometimes still run into issues where the pycom will exit deepsleep and being to draw power, but will not run any code. My guess is that there is a massive power spike at wakeup and it is browning out the chip even though I believe that I have disabled all of the radios' etc at startup. If you run into that issue, I have found that I don't have that problem on Micropython 1.20.2.r1 & Pybytes version 1.60 (the one released 9/19).
Also, here is a separate forum post on that topic:
-
@MichaelWojcik That's good news. Don't remember if I had tried that back then.
Is there any impact on power draw during deep sleep though?
-
@Gijs said in Using py.setup_int_pin_wake_up(True):
Lopy4 board by cutting the trace should help with the floating voltages (In their case, it was useful, as the Lopy needed the pin for a different function, it is not actually pin9 that is used here, but the PIC_RC1). Now I am unable to test this at the moment, but I believe using a pulldown resistor, like 10Kohm, on pin 9, will also keep the voltage down. Then connect the button to 3.3V on the othe
I know this is old, but I would just like to add that using a 10K pulldown worked to solve the same issue for me on a lopy4 with a pytrack.
-
@Gijs thank you for your reply. Are you suggesting that there are two possible solutions (1. cut the trace and 2. add a 10Kohm resistor in-line on pin 9 and connecting that to 3v3) or are these both part of a single solution?
Perhaps you can post a full example with wiring diagram so that there is a canonical solution to the problem with little room for misinterpretation and ambiguity?
I just bought 3 of these boards for a customer based on the specs in the documentation and am very disappointed that it is not capable of advertised capability, so a full example would help retain some faith in the platform.
-
As stated in the other forum post, the Pysense and Pytrack sleep modes are enabled by completely cutting power to the Lopy4 (or any other) board. This is done by the PIC controller on the Pysense or Pytrack board. The line you suggest (
p_in = Pin('P9', mode=Pin.IN, pull=Pin.PULL_DOWN
) will not help, as the power to the controller is cut, thus the GPIO states are not remembered. Disconnecting the pin9 from the Lopy4 board by cutting the trace should help with the floating voltages (In their case, it was useful, as the Lopy needed the pin for a different function, it is not actually pin9 that is used here, but the PIC_RC1). Now I am unable to test this at the moment, but I believe using a pulldown resistor, like 10Kohm, on pin 9, will also keep the voltage down. Then connect the button to 3.3V on the other side. Pressing should then give a rising edge. As I stated before, I am not able to test my theory at the moment, are you able to?.
Gijs