Having trouble making a lorawan using 2 lopy4 devices
Roberto Duca about an hour ago
Hi there! I am quite new to Iot and lorawan.
I am trying to set up a small network between two lopy4 devices using lorawan in Australia using the 915 frequency. One device is set up as a gateway using the example off the github drive https://github.com/pycom/pycom-libraries/tree/master/examples/lorawan-nano-gateway
for the config i am currently using the following settings in my config file
LORA_FREQUENCY = 916800000
LORA_GW_DR = "SF12BW500"
LORA_NODE_DR = 8
on the things network i have the device registered with teh following frequency plan: AU_915_928_FSB_2
the gateway seems to connect to the internet and shows being active on ttn console, but unfortunately I am not achieving any communication between the node and gateway using lorawan.
I have tried a couple of various pieces of code i've found but suspect it must be how i am registereing the end device. in my code i am trying this code at the moment to no avail:
from network import LoRa import time import binascii import pycom pycom.heartbeat(False) #needs to be disabled for LED functions to work pycom.rgbled(0x7f0000) #red #Set AppEUI and AppKey - use your values from the device settings --> https://console.thethingsnetwork.org/ app_eui = binascii.unhexlify('removed') app_key = binascii.unhexlify('removed') lora = LoRa(mode=LoRa.LORAWAN, public=1, adr=0, tx_retries=0) # Remove default channels for index in range(0, 72): lora.remove_channel(index) # Set AU ISM 915 channel plan for TTN Australia for index in range(8, 15): lora.add_channel(index, frequency=915200000+index*200000, dr_min=0, dr_max=3) lora.add_channel(65, frequency=917500000, dr_min=4, dr_max=4) for index in range(0, 7): lora.add_channel(index, frequency=923300000+index*600000, dr_min=0, dr_max=3) #Join TTN Network via OTAA 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(): pycom.rgbled(0x7f7f00) #yellow time.sleep(5) print('Trying to join TTN Network!') pass print('Network joined!') pycom.rgbled(0x007f00) #green while not lora.has_joined(): pycom.rgbled(0x7f7f00) #yellow time.sleep(5) print('Trying to join TTN Network!') pass print('Network joined!') pycom.rgbled(0x007f00) #green
i have tried OTAA and ABP but it doesnt seem to work. i think the hardware is working because if i set up a raw lora gateway and node i can see packets being sent to each other.
i am not sure what i might be doing wrong? any advice or help would be much appreciated.
@Roberto-Duca yes, you need to use only the frequency chosen on the gateway.
Note that the network may (and probably will) send it’s on list of channels and frequencies after the join, so ideally you should configure the network to only send that single frequency (don’t know if you can do that on TTN), or you will have to reset the list of channels after the join (or rather before each transmit).
Also I believe the nano-gateway only listen on a single DR, so likewise, you should restrict your node to that single DR (both for join and subsequent traffic).
Remember that a nano-gateway is just there for a bit of testing, it’s by far not a real LoRaWAN-compliant gateway.
Thanks for your reply!
ok so when i set the frequency on the gateway of 916.8MHz that is the listening frequency?
i should then restrict the channel frequencies to 916.8MHz on the node then too?
This post is deleted!
@Roberto-Duca the nano gateway only listens on a single frequency rather than 9 or so a real gateway does. You must remove all channels and only use the signe channel the gateway listens on.