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

    ADC causing current increase during deep sleep

    Scheduled Pinned Locked Moved LoPy
    2 Posts 1 Posters 38 Views 1 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.
    • B Offline
      beelzmon
      last edited by

      Currently, some basic code sending data over LoRa and then going into deep sleep is functional, and during deep sleep has about 28 u-amps current. See below, where bytes would be replaced by data to be sent.

      lora = LoRa(mode=LoRa.LORAWAN , region=LoRa.AU915, adr = True )
      lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
      for index in (list(range(0,8))+list(range(16,65))+list(range(66,72))): 
        lora.remove_channel(index)
      s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
      s.setblocking(False)
      while True:
        s.send(bytes)
        machine.deepsleep(60000)
      

      However, addition of the following code increases this current to 51 u-amps. This code just reads the battery voltage via ADC. See below the new code:

      
      lora = LoRa(mode=LoRa.LORAWAN , region=LoRa.AU915, adr = True )
      lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
      for index in (list(range(0,8))+list(range(16,65))+list(range(66,72))): 
        lora.remove_channel(index)
      adc = machine.ADC()
      adc.init(bits=10)
      adc.vref_to_pin('P22')
      adc.vref(1100)
      Channel  = adc.channel(pin='P13', attn = machine.ADC.ATTN_0DB)
      Current_Battery_Reading= Channel.voltage()
      Channel.deinit()
      adc.deinit()
      s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
      s.setblocking(False)
      while True:
        s.send(bytes)
        machine.deepsleep(60000)
      

      It looks to me that i disabled the ADC after use, but the current is still higher than without it. Is there something i am missing in order to have the deepsleep current remain at 28 u-amps, and not increase to 51 u-amps with this new code.

      1 Reply Last reply Reply Quote 0
      • B Offline
        beelzmon
        last edited by

        SOLVED: The line adc.vref_to_pin('P22') was causing this. Should only be run for calibration with a multimeter for the vref value once, is the current conclusion.

        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