Connecting the lopy to my lorank8 gateway



  • Hi,

    I have tried the ABP and OTAA methods to send a message from the lopy to semtech and/or TTN (It would be good enough to know it goes anywhere) but 'it doesn't work' :(

    The OTAA code I tried (Result is that it hangs on trying to connect):

    from network import LoRa
    import time
    import binascii
    
    lora = LoRa(mode=LoRa.LORAWAN)
    
    app_eui = binascii.unhexlify('00000000000000000')
    app_key = binascii.unhexlify('00000000000000000000000000000000')
    
    #eui and key from TTN Application page
    
    lora.join(activation=LoRa.OTAA, auth=(app_eui, app_key), timeout=0)
    
    # wait until the module has joined the network
    while not lora.has_joined():
        time.sleep(2.5)
        print('Not joined yet...')
    
    print('Network joined!')
    

    The ABP Code I tried:

    from network import LoRa
    import socket
    import struct
    import binascii
    
    # Initialize LoRa in LORAWAN mode.
    lora = LoRa(mode=LoRa.LORAWAN)
    
    # create an ABP authentication params
    dev_addr = struct.unpack(">l", binascii.unhexlify('C3F997D5'))[0]
    nwk_swkey = binascii.unhexlify('00000000000000000000000000000000')
    app_swkey = binascii.unhexlify('00000000000000000000000000000000')
    
    # join a network using ABP (Activation By Personalization)
    lora.join(activation=LoRa.ABP, auth=(dev_addr, nwk_swkey, app_swkey))
    
    while not lora.has_joined():
        time.sleep(2.5)
        print('Not joined yet...') 
    	
    print('joined network!')
    
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 5)
    s.setblocking(False)
    s.send(bytes([0x01, 0x02, 0x03]))
    
    data = s.recv(64)
    print(data)
    

    This script actually prints that it is connected to the network but I don't see any packets coming in on the Lorank admin panel, semtech page or TTN application page.

    Am I missing something?



  • I was suspecting that too when I noticed I kept receiving them when the lopy was off.

    But that does not yet solve the issue that the message from my lopy itself is not coming through

    Edit: @Batilan I have also updated the firmware and both scripts still behave the same



  • @George. About the error messages (likely crc errors?) are probably due to other stuff sending on 868 Mhz.



  • @Batilan Apparently I don't have permission to attach CSV files to my replies :(
    Something might have responded on my gateway but it doesn't seem to be what I try to send.

    The responses don't have a node mac (Although I expected my Lopy's address here and none of the payloads has the content that I sent (or am I not understanding this correct?)

    (It's a pain to read from website, but when you copy it into an empty CSV files or excel it should work)

    "gateway ID","node MAC","UTC timestamp","us count","frequency","RF chain","RX chain","status","size","modulation","bandwidth","datarate","coderate","RSSI","SNR","payload"
    "AA555A0000000101","","2016-11-20 09:29:31.467Z",   8202364, 867900000,0, 7,"CRC_BAD",152,"LORA",125000,"SF7"   ,""   ,-96,-11.8,"21E9EB39-07F99FD4-1AE1AF13-49B041CF-66CCA611-49E38044-D3264D34-42B3C782-08997015-F5A7C9BC-61079BCA-9CF274C8-C28C1247-8B68A040-19930848-190C08FA-483CBD42-B9451E3B-1C445A7B-FC1D126D-C19332CC-9786098A-08932C1D-45A6EE8A-FA6CEE58-87AD9C51-776095C8-5D74BF13-7689C6D7-3FA5110B-B8F374BC-D7B69970-B11598FF-7B248E6F-51B94AA9-C2F5D535-10B33E1E-4AB2AC20"
    "AA555A0000000101","","2016-11-20 09:30:04.371Z",  41105508, 867500000,0, 5,"CRC_OK" , 16,"LORA",125000,"SF7"   ,"4/5",-23, +7.0,"40D597F9-C3000100-56B518FD-D77EC5AB"
    "AA555A0000000101","","2016-11-20 09:30:39.421Z",  76156055, 868300000,1, 8,"CRC_BAD",225,"LORA",250000,"SF7"   ,""   ,-98,-11.8,"F1BCADC8-F1185BDA-4E57837C-6C62DCC3-E6733005-88A99209-3EA09F37-37A9A33A-37286EC3-547AE145-5325005D-981D86DB-A6D6F689-37AA0610-4592D283-D5C2CB17-540BA004-FF8FAAB2-34ABBF27-87C8A13F-6F48B7EB-AC75B251-86D33030-B8A4BFCF-F7ED4309-2BC2AFDD-6FD42F6A-B66E9238-F1BB3B82-49CECE49-17CD2C98-41909BBD-9F955AAF-A562AF95-4A6D03A9-7F59BF9F-0412EBBE-500DD698-42C5111F-7C57D8FA-73E93381-9A8AEAAB-621ED1DE-FEAE4A98-B4655FA1-93070D1B-20B58335-22314D6F-E57D664E-51720965-603912A6-CD189B82-318A68DD-EA5C4032-1DED3E72-99D6B460-32"
    "AA555A0000000101","","2016-11-20 09:31:17.677Z",2203537114, 867500000,0,188,"UNDEF"  ,217,"ERR" ,0     ,"ERR"   ,""   ,-128,-128.0,"12076A00-0EBEA3B4-EFD29307-73D9CCE2-21E9EB39-07F99FD4-1AE1AF13-49B041CF-66CCA611-49E38044-D3264D34-42B3C782-08997015-F5A7C9BC-61079BCA-9CF274C8-C28C1247-8B68A040-19930848-190C08FA-483CBD42-B9451E3B-1C445A7B-FC1D126D-C19332CC-9786098A-08932C1D-45A6EE8A-FA6CEE58-87AD9C51-776095C8-5D74BF13-7689C6D7-3FA5110B-B8F374BC-D7B69970-B11598FF-7B248E6F-51B94AA9-C2F5D535-10B33E1E-4AB2AC20-0771D1C8-E9237E2B-7D003ED2-0717000E-40D597F9-C3000100-56B518FD-D77EC5AB-05731C16-2A6C0A3B-7302FB36-076A003A-F1"
    "AA555A0000000101","","2016-11-20 09:32:08.904Z", 165639508, 867700000,0, 6,"CRC_BAD",119,"LORA",125000,"SF7"   ,"4/5",-96,-11.2,"7C65CC66-C5D11693-43F2967D-1601CC33-9306E5D0-5BFA2421-0994B40F-A5103B98-B6B2ABE8-0223D876-2AF42D02-49DF9E1B-7DD81454-F7769D3C-9A1D4190-6A2612FD-176F0F84-97FABBBE-26D5D41E-369C3377-B78471C0-AF2F7F26-C9ED66E9-DFF17DEA-96F14B95-87EB8C60-66995A6D-285931C7-C3F2FD03-AA7BC8"
    "AA555A0000000101","","2016-11-20 09:32:10.668Z", 167402187, 867100000,0, 3,"CRC_BAD",131,"LORA",125000,"SF7"   ,"4/5",-96,-11.0,"17CDD9D1-90C863F5-10010B95-CF519AA7-8839A50C-23A07759-2865181A-AFF4A70B-6EC239B4-FBF35AE4-B1CECD9B-59694C20-86CC9DA4-CE8847AD-8406BEDA-E57936F7-1A3F508E-CA01CABC-005F04B4-BE46DE8F-86F9F02B-87F37FF7-54442427-6F3B683B-E4304390-5048162A-ACA1CECE-50F8D12F-4A32B672-E71D1934-93519221-B98804BC-D209EF"
    
    


  • @Batilan
    I wanted to take out the keys but forgot them on the ABP code.
    I did indeed choose the correct country during the firmware install
    The firmware on the lopy is '0.9.4.b1', I will redo the test with updated firmware.

    Yesterday I 'might' have been buttonsmashing the script to see the any response,
    Could it be that this resulted in my gateway receiving errored messages all night long
    (Even after the lopy has been disconnected) or is there something else broadcasting on the same frequency?



  • @George

    What version of the firmware are you using? (use os.uname() to find out).
    Best to use the latest version because the firmware is updated almost every few days now (0.9.5.b1 is latest at this moment)

    In the OTA code you showed I assume you did actually put your app_eui and app_key ?
    (I ask because in the ABP code you left in our keys).

    You did choose the correct country when installing the firmware?
    This makes sure you are using the right frequency for your reason and gateway (probably EU?)


Log in to reply
 

Pycom on Twitter