Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    LoPy 4 - Deep Sleep high current consumption? 412uA

    Scheduled Pinned Locked Moved LoPy
    2 Posts 1 Posters 27 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      Rasmus Persson 0
      last edited by Rasmus Persson 0

      I'm having trouble with getting my LoPy 4 down to the specified 50uA during deep sleep. As of now I get an average of 412uA. I don't know why.

      from machine import Pin
      import time
      from network import LoRa
      from network import WLAN
      from network import Bluetooth
      from network import Server
      # from network import MDNS
      import socket
      import ubinascii
      import pycom
      import machine
      from machine import Timer
      from network import Sigfox
      
      
      intervalforlora = 10 # in seconds
      # MDNS.deinit()
      wlan = WLAN()
      wlan.deinit()
      bt = Bluetooth()
      bt.deinit()
      server = Server()
      server.deinit() # disable the server
      
      
      
      
      buttonPin = Pin('P8', mode=Pin.IN, pull=True)
      buttonPin2 = Pin('P9', mode=Pin.IN, pull=True)
      
      lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868, tx_power=14, sf=12, power_mode=LoRa.TX_ONLY)
      
      
      
      app_eui = ubinascii.unhexlify('XXXXXXXXXXXXXX')
      app_key = ubinascii.unhexlify('XXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
      dev_eui = ubinascii.unhexlify('XXXXXXXXXXXXXX') 
      
      lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0)
      
      chrono = Timer.Chrono()
      chrono.start()
      
      lora.nvram_restore()
      
      
      while not lora.has_joined() or chrono.read() <= intervalforlora:
          pycom.heartbeat(True)
          starttime = time.time()
          time.sleep(2.5)
          print('Not yet joined...')
      if chrono.read() >= intervalforlora and not lora.has_joined():
      	machine.reset()
      
      print('Joined')
      s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
      
      s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
      
      pycom.heartbeat(False)
      
      
      while True:
          s.setblocking(True)
          print()
          s.send(bytes([buttonPin()]))
          s.setblocking(False)
          time.sleep(10)
          
          print(buttonPin(),buttonPin2())
      
          # deepsleep
        
          if buttonPin() == 1:
              machine.pin_sleep_wakeup(["P9"], mode=machine.WAKEUP_ANY_HIGH, enable_pull=True)
              machine.deepsleep(1000*3600*24)  # 24 hours
          else:
              machine.pin_sleep_wakeup(["P8"], mode=machine.WAKEUP_ANY_HIGH, enable_pull=True)
              machine.deepsleep(1000*3600*24)  # 24 hours
      
      

      alt text
      Any help with solving this mystery would be greatly appreciated!

      1 Reply Last reply Reply Quote 0
      • R Offline
        Rasmus Persson 0
        last edited by

        Could this be caused by having 2x 10k resistors connected to 3v3?

        1 Reply Last reply Reply Quote 0

        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
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom