Power consumption



  • Hi, I have a LoPy + Pytrack.
    I use LoRaWan, BT and GNSS.
    When the device is in py.sleep I have 380uA, while it's in running mode I have 180mA with BT, and 80mA w/o BT.
    The WLan is OFF.
    I don't undestand this, because one of features of Pytrack is –> Ultra low power operation (~1uA in deep sleep).
    I use py.setup_sleep(30) and pu.go_to_sleep(True).
    Somebody has this problem?

    Thanks
    Andrea



  • @apantano
    Hi
    I took a new LoPy+Pysense and I measured the consumption w/o LAN and BT by modifing the boot.py (the main.py is empty) like this

    Import os
    
    import machine
    from machine import UART
    from network import WLAN, Bluetooth
    
    uart = UART(0, baudrate=115200)
    os.dupterm(uart)
    wlan = WLAN()
    wlan.init(mode=WLAN.STA)
    wlan.deinit()
    bt = Bluetooth()
    bt.deinit()
    
    machine.main('main.py')
    

    The currrent is 45-46 mA.

    Probably there is some active resource that I don't know.

    Thanks
    Andrea



  • @livius
    I Livius,
    thanks for answer.

    Andrea



  • @apantano said in Power consumption:

    It's possible to disable WLAN? For IoT project I don't use the WLAN.

    use wlan.deinit()
    https://docs.pycom.io/chapter/firmwareapi/pycom/network/wlan.html



  • @daniel
    Hi Daniel,
    thanks for your response.

    I done this test for Pytrack+LoPy:
    (to disable the LAN I used pycom.wifi_on_boot(False) )

    • GPS off, LED off, BT off: only running 75-80 mA

    • GPS off, LED on, BT off: 90 mA

    • GPS off, LED (heartbeat), BT off: 77 mA

    • GPS on, LED off, BT off: 95 mA

    • GPS on, LED off, BT on: 170 mA
      (in this case when I use the Lora DR5 on this case I have 190-200 mA)

    • go_to_sleep(False): 9-10uA

    • go_to_sleep(True): 16-17uA

    • go_to_sleep(False/True) and : 380-390uA
      (in this case I used py.setup_int_wake_up(True, True) for wakeup by accelerometer)

    It's possible to reduce current with int_wake_up active?
    It's possible to disable WLAN? For IoT project I don't use the WLAN.

    I need to use a battery.

    Thanks
    Andrea



  • @livius
    ...and if i i've a battery charged by a solar panel through a tp4065, how can i connect the output of tp4065 to the pysense?



  • @acme1999
    Because you must power also USB/TTL converter



  • @daniel said in Power consumption:

    ia USB, then the extra power consumption is normal, you need to use the battery conne

    Sorry, i'm a newbie. Can you explain me the why?



  • @livius
    Hi,
    I have a italian KBD. I'll retry.

    import time
    import sys
    import uos
    import pycom
    
    from LIS2HH12 import LIS2HH12
    # from pytrack import Pytrack
    from pysense import Pysense
    
    print("Entry")
    pycom.heartbeat(False)
    
    # py = Pytrack()
    py = Pysense()
    
    print("(hwVersion='" + str(py.read_hw_version()) + "', fwVersion='" + str(py.read_fw_version()) + "', productID='" + str(py.read_product_id()) + "')")
    print(uos.uname())
    
    pycom.rgbled(0xFFFFFF)
    
    # display the reset reason code and the sleep remaining in seconds
    # possible values of wakeup reason are:
    # WAKE_REASON_ACCELEROMETER = 1
    # WAKE_REASON_PUSH_BUTTON = 2
    # WAKE_REASON_TIMER = 4
    # WAKE_REASON_INT_PIN = 8
    print("Step 1")
    time.sleep(2.0)
    reason = py.get_wake_reason()
    print("Wakeup reason: " + str(reason))
    if reason == 1:
        pycom.rgbled(0xFF0000)
    else:
        pycom.rgbled(0x00FF00)
    print("Step 2")
    print("Aproximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec")
    time.sleep(0.5)
    
    print("Step 3")
    
    # enable wakeup source from INT pin
    py.setup_int_pin_wake_up(False)
    
    # enable activity and also inactivity interrupts, using the default callback handler
    py.setup_int_wake_up(True, True)
    
    acc = LIS2HH12()
    # enable the activity/inactivity interrupts
    # set the accelereation threshold to 2000mG (2G) and the min duration to 200ms
    acc.enable_activity_interrupt(2000, 200)
    
    # check if we were awaken due to activity
    # if acc.activity():
    #     pycom.rgbled(0xFF0000)
    time.sleep(2.0)
    
    # go to sleep for 5 minutes maximum if no accelerometer interrupt happens
    py.setup_sleep(20)
    print("Step 4")
    time.sleep(1.0)
    
    while (True):
        try:
            pycom.rgbled(0x0000FF)
            time.sleep(1.0)
            py.go_to_sleep(False)
            print("Step 5")
            time.sleep(0.5)
        except KeyboardInterrupt:
            time.sleep(1.0)
            print("Exit")
            sys.exit(0)
        except Exception as e:
            print("Error %s", str(e))        
    

    Thanks
    Andrea



  • @livius
    Hi,



  • @apantano
    use ``` (on the left of numer 1 on keyboard)
    i have edited your post



  • @jcaron
    Hi,
    I use the white connector, next to the SUB connector.

    This is the code about the sleep. The device goes to sleep for 20 sec and not for 5 min.

    # go to sleep for 5 minutes maximum if no accelerometer interrupt happens
    py.setup_sleep(20)
    print("Step 4")
    time.sleep(1.0)
    
    while (True):
        try:
            pycom.rgbled(0x0000FF)
            time.sleep(1.0)
            py.go_to_sleep(False)
            print("Step 5")
            time.sleep(0.5)
        except KeyboardInterrupt:
            time.sleep(1.0)
            print("Exit")
            sys.exit(0)
        except Exception as e:
            print("Error %s", str(e))   
    
    

    Thanks
    Andrea



  • @apantano also, just to be sure, you have your battery connected to the JST connector, not via USB?



  • @apantano can you edit your post and add ``` before and after the code?



  • @daniel
    Hello Daniel,
    I tried the FALSE parameter on go_to_sleep() and I got the same result as 380uA.

    This is the main.py taken from the example accelerometer_wake.

    import time
    import sys
    import uos
    import pycom
    
    from LIS2HH12 import LIS2HH12
    # from pytrack import Pytrack
    from pysense import Pysense
    
    print("Entry")
    pycom.heartbeat(False)
    
    # py = Pytrack()
    py = Pysense()
    
    print("(hwVersion='" + str(py.read_hw_version()) + "', fwVersion='" + str(py.read_fw_version()) + "', productID='" + str(py.read_product_id()) + "')")
    print(uos.uname())
    
    pycom.rgbled(0xFFFFFF)
    
    # display the reset reason code and the sleep remaining in seconds
    # possible values of wakeup reason are:
    # WAKE_REASON_ACCELEROMETER = 1
    # WAKE_REASON_PUSH_BUTTON = 2
    # WAKE_REASON_TIMER = 4
    # WAKE_REASON_INT_PIN = 8
    print("Step 1")
    time.sleep(2.0)
    reason = py.get_wake_reason()
    print("Wakeup reason: " + str(reason))
    if reason == 1:
        pycom.rgbled(0xFF0000)
    else:
        pycom.rgbled(0x00FF00)
    print("Step 2")
    print("Aproximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec")
    time.sleep(0.5)
    
    print("Step 3")
    
    # enable wakeup source from INT pin
    py.setup_int_pin_wake_up(False)
    
    # enable activity and also inactivity interrupts, using the default callback handler
    py.setup_int_wake_up(True, True)
    
    acc = LIS2HH12()
    # enable the activity/inactivity interrupts
    # set the accelereation threshold to 2000mG (2G) and the min duration to 200ms
    acc.enable_activity_interrupt(2000, 200)
    
    # check if we were awaken due to activity
    # if acc.activity():
    #     pycom.rgbled(0xFF0000)
    time.sleep(2.0)
    
    # go to sleep for 5 minutes maximum if no accelerometer interrupt happens
    py.setup_sleep(20)
    print("Step 4")
    time.sleep(1.0)
    
    while (True):
        try:
            pycom.rgbled(0x0000FF)
            time.sleep(1.0)
            py.go_to_sleep(False)
            print("Step 5")
            time.sleep(0.5)
        except KeyboardInterrupt:
            time.sleep(1.0)
            print("Exit")
            sys.exit(0)
        except Exception as e:
            print("Error %s", str(e))        
    
    

    Thanks
    Andrea



  • @daniel
    Hello Daniel,
    thanks for your quickly response.
    The device is powered by battery and is stand-alone (Pytrack+LoPy).
    Today I can repeated my test with (False) parameter.

    One question: how can I put the GPS on backup-mode? In L76 library there isn't a function to do it.

    Thanks
    Andrea


  • administrators

    @apantano Do you have any extra stuff connected to your Pytrack? Are you powering via the battery connector or the USB connector? If via USB, then the extra power consumption is normal, you need to use the battery connector...


  • administrators

    @apantano I just repeated your test. Latest firmware on Pytrack board. I get 17.2uA during deepsleep with the GPS back-up enabled.


  • administrators

    Hello Andrea,

    You should have around between 15uA and 20uA with the Pytrack in deepsleep. What current do you get when you do : py.go_to_sleep(False) ?

    Cheers,
    Daniel


 

Pycom on Twitter