ADC causing current increase during deep sleep



  • 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.



  • 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.


Log in to reply
 

Pycom on Twitter