power supply (Lopy4+Exp.Board v.3)



  • Hi, I have this question:
    Which is the minimum current that is possible to have in a sort of power down with a Lopy4 mounted on an expansion board 3? And in which way?(deep sleep -- go to sleep.... -- )?
    I obtained 3,5mA at best. Is it possible to arrive at the order of uA?
    Thanks in advance for your help.
    Giorgio



  • @paul-thornton ... and in the boot.py file I have this code:

    # boot.py -- run on boot-up
    import os
    from machine import UART
    uart = UART(0, 115200)
    os.dupterm(uart)
    #disable the wifi radio
    from network import WLAN
    wlan=WLAN()
    wlan.deinit()
    #disable the bluetotth radio
    from network import Bluetooth
    blt=Bluetooth()
    blt.deinit()
    


  • @paul-thornton This is the code (below). At the end of main.py I use the machine.deepsleep(10000)...
    ...is machine.deepsleep() sufficient in order to shut down everythings?
    Then I use also a library for HX711 (for load cell) and a config.py file for Lorawan parameters
    thanks.

    print('\n\nVERSION 0x01\n\n')
    
    """importo libreria per LoRa"""
    from network import LoRa
    
    """importo libreria machine per deep sleep"""
    import machine
    """importo libreria machine per RTC"""
    from machine import RTC
    rtc=RTC()
    rtc.ntp_sync("pool.ntp.org")
    #rtc.init((2018,11,30,15,45,0))
    #print(rtc.now())
    import time
    time.sleep(3)
    
    """importo libreria machine per ADC"""
    from machine import ADC
    adc = ADC()
    battread = adc.channel(attn=0,pin='P16')
    batt=battread()
    print("VALORE DI BATTERIA ", batt)
    """importo vari moduli Python utili"""
    import pycom
    import socket
    import ubinascii
    import struct
    
    import config
    
    """importo libreria per HX711"""
    from hx711 import HX711
    
    #---------------------------------------------------------------------------
    """Setup per LoRaWAN """
    # initialize LoRa in LORAWAN mode.
    # Please pick the region that matches where you are using the device:
    # Asia = LoRa.AS923
    # Australia = LoRa.AU915
    # Europe = LoRa.EU868
    # United States = LoRa.US915
    lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.EU868)
    
    # create an OTA authentication params
    dev_eui = ubinascii.unhexlify('0004A30B001BD398')
    app_eui = ubinascii.unhexlify('70B3D57ED00140CB')
    app_key = ubinascii.unhexlify('5C777F91BAFE83DD6C8651CC7873DDA7')
    
    # set the 3 default channels to the same frequency (must be before sending the OTAA join request)
    """HO commentato 3 righe per il set delle frequenze sui canali 0, 1, 2,
    	In questo modo posso usare più canali. NON va bene per il nanogateway che vuole solo un canale"""
    lora.add_channel(0, frequency=config.LORA_FREQUENCY, dr_min=0, dr_max=5)
    #lora.add_channel(1, frequency=config.LORA_FREQUENCY, dr_min=0, dr_max=5)
    #lora.add_channel(2, frequency=config.LORA_FREQUENCY, dr_min=0, dr_max=5)
    
    # join a network using OTAA
    lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0, dr=config.LORA_NODE_DR)
    
    # wait until the module has joined the network
    prove=0
    freq=machine.freq()
    #uni_id=machine.unique_id()
    print(freq)
    #print(uni_id)
    
    while not lora.has_joined():
        time.sleep(2.5)
        print('Not joined yet...')
        prove+=1
        if(prove==5):
    		break
    if (prove<5):
        join=1
        print('Joined to LoRaWAN Network')
        # remove all the non-default channels
        for i in range(3, 16):
    		lora.remove_channel(i)
        # create a LoRa socket
        s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    
    	# set the LoRaWAN data rate
        s.setsockopt(socket.SOL_LORA, socket.SO_DR, config.LORA_NODE_DR)
    
    	# make the socket non-blocking
        s.setblocking(False)
    else:
        print('Not joined to LoRaWAN Network')
        join=0
    
    
    """ Your own code can be written below! """
    time.sleep(5.0)
    """FINE SETUP PER LoRaWAN"""
    #---------------------------------------------------------------------------
    #---------------------------------------------------------------------------
    """Setup per HX711 """
    """imposto il valore di offset - non mi serve la tara
    #è il peso del sistema a vuoto senza pesi sopra """
    hx = HX711('P15', 'P11') #DAT, clk
    hx.set_offset(400500)	#è la tara senza peso sopra da togliere alla misura(iniziale 380600)
    reference_unit = 745.500 #calcolato con peso di 5000gr (iniziale di 743.500)
    """FINE SETUP PER HX711"""
    #---------------------------------------------------------------------------
    for i in range(1):
    	#leggo un valore dalla bilancia
        value = hx.get_value(10)
        print("Read VALUE: ", i)
        grammi = value/reference_unit #calcolo il peso della bilancia
        kg = grammi/1000
        print('             ')
        print('grammi: ', grammi, 'Kg: ',kg)
        print('             ')
    
    	#leggo un valore di temperatura
    	#trasformo i valori in byte
        if(kg < 0):
    		kg=kg*(-1)	#tolgo i valori negativi
        kg1=int(kg*100) #*100 come se avesse due decimali-prendo la parte intera
        print(kg1)
        hi=kg1>>8 #prendo il byte alto
        lo=kg1-(hi<<8) #prendo il byte basso
        print("kg1: ", kg1, hex(kg1), "hi: ", hex(hi), "lo: ", hex(lo))
        print("sending...")
        pkg=bytes([1,2])+bytes([hi,lo]) #formato LPP - Cayenne -
        #if(join==1):
        #    s.send(pkg)
        #time.sleep(30)
    	#trasmetto in lorawan
    	#leggo da lorawan
        #leggo la batteria in add_channel
        batt=battread()
        print("VALORE DI BATTERIA ", batt)
        batt=int(batt/10)
        batHi=batt>>8
        batLo=batt-(batHi<<8)
        pkg1=bytes([2,2])+bytes([batHi,batLo]) #formato LPP - Cayenne -
        pkg2=pkg+pkg1
        if(join==1):
            s.send(pkg2)
        time.sleep(30)
    
    
    print("entro in deep sleep")
    machine.deepsleep(10000) #10sec to test
    
    


  • This post is deleted!


  • With everything shut down and sleeping LTE/Wifi/Lora and the expansion board ect you should be seeing way less than 3.5mA

    Ive seen 32uA with a LoPY 3 + an Expansion board v 3.1.

    If you'd like to post the code perhaps we have work out whats going on :)



Pycom on Twitter