Sipy+Pytrack, Deepsleep and power consumption problem

  • I have a Sipy on a pytrack (with the shield on) and a huge power consumption problem
    My 2000maH battery is empty in 48 hours. Which is ridiculous.

    Seems to be a deepsleep problem.
    I can only put the sipy to deepsleep using :

    import machine

    that works, but it is useless as the pytrack is the one consumming

    I tryed

    from pytrack import Pytrack
    py = Pytrack()

    But the code get stuck after py.setup_sleep(10)
    I have to unplug and replug to get things running again.

    Support asked me to try :

    from deepsleep import DeepSleep
    import deepsleep
    ds = DeepSleep()
    # get the wake reason and the value of the pins during wake up
    wake_s = ds.get_wake_status()
    if wake_s['wake'] == deepsleep.PIN_WAKE:
        print("Pin wake up")
    elif wake_s['wake'] == deepsleep.TIMER_WAKE:
        print("Timer wake up")
    else:  # deepsleep.POWER_ON_WAKE:
        print("Power ON reset")
    ds.go_to_sleep(10)  # go to sleep for 10 seconds

    But i got a
    IndexError: bytes index out of range
    on the ds.get_wake_status()

    if I go straight to ds.go_to_sleep(10) it get stuck as previously

    I don't know what to do.
    48h of use is not what I had in mind when I've started this project

    Please, help me.

  • @devinv it takes a while for a GPS chip to get a fix. You definitely won’t get a position right after wake up, the chip needs to receive ephemeris data, lock onto satellites, compute a position...

    This has been discussed several times in the forum, search for the relevant topics for details.

  • @jcaron Actually I still have a problem.
    The py.go_to_sleep() does work but on the wake up the gps is not returning anything

    if I do

    py = Pytrack()
    gps = L76GNSS(py, timeout=60)
    coord = gps.coordinates()

    It does work, I get new coordinate very 10 secondes (but the chip is using lots of power cause it is not a full Deepsleep)

    but if I do

    py = Pytrack()
    gps = L76GNSS(py, timeout=60)
    coord = gps.coordinates()

    It works only on the first launch.
    Every following 10 secondes, it does wake up but I will get an empty coord

    What is going wrong?

  • @devinv Actually, I thought it did but my card is not responsive and I'm now stuck.
    I get a continuous

    rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
    configsip: 0, SPIWP:0xee
    mode:DIO, clock div:1
    entry 0x400a059c
    Starting theets Jun 8 2016 00:22:57

    and the hard reset (pin 12 on 3V for one second) is not getting me out of it.
    What should I do?

  • @jcaron Great, thanks, because it doesn't work when it is on.

  • @devinv no, if you use a Pytrack or Pysense, you don’t need the Deep Sleep Shield, all three do the same thing in terms of controlling deep sleep.

  • @jcaron Thanks a lot. It does work. If I'm using this Deepsleep function (for pytrack), do I need the shield?

  • @devinv the second one is the right one, but you can’t just type it (or even copy-paste it) on REPL: setup_sleep will start changing the state of the PIC and disable USB before you can enter the next call.

    Put that code in a function and call the function, it’ll work.

Pycom on Twitter