LoRaWAN 915Mhz in the US



  • After not being able to get the LoPy/LoRaWAN to work with my Multitech Conduit gateway configured for 915Mhz (USA), I grabbed the source to understand why (Other LoRaWAN devices worked out of the box).

    I determined that the add_channel and remove_channel methods do not have any effect for LoPy's loaded with 915Mhz configured firmware. Channel configuration is necessary if you have a gateway that can only listen on 8 channels (most gateways, including the Multitech are limited to 8 channels of the 915Mhz band). This meant that I had a 1 in 8 chance of joining or receiving messages as the LoPy was trying to use all 64 channels instead of the 8 the gateway could receive.

    I added basic functionality to the firmware to make remove_channel() functional on 915Mhz configured LoPys. This is enough to make the LoPy work 100% reliably with my Multitech Conduit/Things Network gateway since I can prevent the LoPy from using channels that the gateway isn't listening on.

    Here is sample code that works for joining TTN and sending 20 messages:

    from network import LoRa
    import socket
    import time
    
    lora = LoRa(mode=LoRa.LORAWAN, public=True, adr=False)
    
    #Setting up channels for sub-band 2 for TTN
    for index in range(0, 8):
        lora.remove_channel(index)
    
    for index in range(16, 65):
        lora.remove_channel(index)
    
    for index in range(66, 72):
        lora.remove_channel(index)
    
    auth = (bytes([... ]), 
            bytes([... ]))
    
    print("joining...")
    lora.join(activation=LoRa.OTAA, auth=auth, timeout=0)
    
    x=0
    # wait until the module has joined the network
    while (not lora.has_joined() and x<10):
        time.sleep(2.5)
        print('Not yet joined...')
        x=x+1
        print(lora.has_joined())
    
    
    if (lora.has_joined()): 
        # create a LoRa socket
        s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
        lora.remove_channel(65); #drop the 500khz channel
        for index in range(0, 20):
            s.send("test1234567");
    

    After some headaches figuring out GitHub and Pull requests, I submitted the changes to be included in a future firmware release. I should add that Fred and Daniel with Pycom have been very helpful--thanks to both of them.



  • Just for easy reference, here is a table of frequencies and data rates that are the default in 915Mhz:

    channel	0:	902300000	hz	min_dr	0	max_dr	3				
    channel	1:	902500000	hz	min_dr	0	max_dr	3				
    channel	2:	902700000	hz	min_dr	0	max_dr	3				
    channel	3:	902900000	hz	min_dr	0	max_dr	3				
    channel	4:	903100000	hz	min_dr	0	max_dr	3				
    channel	5:	903300000	hz	min_dr	0	max_dr	3				
    channel	6:	903500000	hz	min_dr	0	max_dr	3				
    channel	7:	903700000	hz	min_dr	0	max_dr	3				
    channel	8:	903900000	hz	min_dr	0	max_dr	3				
    channel	9:	904100000	hz	min_dr	0	max_dr	3				
    channel	10:	904300000	hz	min_dr	0	max_dr	3				
    channel	11:	904500000	hz	min_dr	0	max_dr	3				
    channel	12:	904700000	hz	min_dr	0	max_dr	3				
    channel	13:	904900000	hz	min_dr	0	max_dr	3				
    channel	14:	905100000	hz	min_dr	0	max_dr	3				
    channel	15:	905300000	hz	min_dr	0	max_dr	3				
    channel	16:	905500000	hz	min_dr	0	max_dr	3				
    channel	17:	905700000	hz	min_dr	0	max_dr	3				
    channel	18:	905900000	hz	min_dr	0	max_dr	3				
    channel	19:	906100000	hz	min_dr	0	max_dr	3				
    channel	20:	906300000	hz	min_dr	0	max_dr	3				
    channel	21:	906500000	hz	min_dr	0	max_dr	3				
    channel	22:	906700000	hz	min_dr	0	max_dr	3				
    channel	23:	906900000	hz	min_dr	0	max_dr	3				
    channel	24:	907100000	hz	min_dr	0	max_dr	3				
    channel	25:	907300000	hz	min_dr	0	max_dr	3				
    channel	26:	907500000	hz	min_dr	0	max_dr	3				
    channel	27:	907700000	hz	min_dr	0	max_dr	3				
    channel	28:	907900000	hz	min_dr	0	max_dr	3				
    channel	29:	908100000	hz	min_dr	0	max_dr	3				
    channel	30:	908300000	hz	min_dr	0	max_dr	3				
    channel	31:	908500000	hz	min_dr	0	max_dr	3				
    channel	32:	908700000	hz	min_dr	0	max_dr	3				
    channel	33:	908900000	hz	min_dr	0	max_dr	3				
    channel	34:	909100000	hz	min_dr	0	max_dr	3				
    channel	35:	909300000	hz	min_dr	0	max_dr	3				
    channel	36:	909500000	hz	min_dr	0	max_dr	3				
    channel	37:	909700000	hz	min_dr	0	max_dr	3				
    channel	38:	909900000	hz	min_dr	0	max_dr	3				
    channel	39:	910100000	hz	min_dr	0	max_dr	3				
    channel	40:	910300000	hz	min_dr	0	max_dr	3				
    channel	41:	910500000	hz	min_dr	0	max_dr	3				
    channel	42:	910700000	hz	min_dr	0	max_dr	3				
    channel	43:	910900000	hz	min_dr	0	max_dr	3				
    channel	44:	911100000	hz	min_dr	0	max_dr	3				
    channel	45:	911300000	hz	min_dr	0	max_dr	3				
    channel	46:	911500000	hz	min_dr	0	max_dr	3				
    channel	47:	911700000	hz	min_dr	0	max_dr	3				
    channel	48:	911900000	hz	min_dr	0	max_dr	3				
    channel	49:	912100000	hz	min_dr	0	max_dr	3				
    channel	50:	912300000	hz	min_dr	0	max_dr	3				
    channel	51:	912500000	hz	min_dr	0	max_dr	3				
    channel	52:	912700000	hz	min_dr	0	max_dr	3				
    channel	53:	912900000	hz	min_dr	0	max_dr	3				
    channel	54:	913100000	hz	min_dr	0	max_dr	3				
    channel	55:	913300000	hz	min_dr	0	max_dr	3				
    channel	56:	913500000	hz	min_dr	0	max_dr	3				
    channel	57:	913700000	hz	min_dr	0	max_dr	3				
    channel	58:	913900000	hz	min_dr	0	max_dr	3				
    channel	59:	914100000	hz	min_dr	0	max_dr	3				
    channel	60:	914300000	hz	min_dr	0	max_dr	3				
    channel	61:	914500000	hz	min_dr	0	max_dr	3				
    channel	62:	914700000	hz	min_dr	0	max_dr	3				
    channel	63:	914900000	hz	min_dr	0	max_dr	3				
    channel	64:	903000000	hz	min_dr	4	max_dr	4				
    channel	65:	904600000	hz	min_dr	4	max_dr	4				
    channel	66:	906200000	hz	min_dr	4	max_dr	4				
    channel	67:	907800000	hz	min_dr	4	max_dr	4				
    channel	68:	909400000	hz	min_dr	4	max_dr	4				
    channel	69:	911000000	hz	min_dr	4	max_dr	4				
    channel	70:	912600000	hz	min_dr	4	max_dr	4				
    channel	71:	914200000	hz	min_dr	4	max_dr	4


  • I've now submitted changes to make add_channel functional for 915Mhz, too. They should be visible in the pull request if you want to roll your own firmware.

    Here is some sample code to for using add_channel to configure a sub-band:

    from network import LoRa
    import socket
    import time
    
    def select_subband(lora, subband):
        if (type(subband) is int):
            if ((subband<1) or (subband>8)):
                raise ValueError("subband out of range (1-8)")
        else:
            raise TypeError("subband must be 1-8")
        
        for channel in range(0, 72):
            lora.remove_channel(channel)
        
        for channel in range((subband-1)*8, ((subband-1)*8)+8):
            lora.add_channel(channel, frequency=902300000+channel*200000, dr_min=0, dr_max=3)
     
    
    lora = LoRa(mode=LoRa.LORAWAN, public=True, adr=False)
    
    select_subband(lora, 2)
    

Log in to reply
 

Pycom on Twitter