TTN Gateway integration with Lopy

I have The Things Gateway activated with TTN which I am able to see on console up and running. Also I have Lopy Lora Micro python board. I have a question can I add Lopy as node to TTN gateway.
Thank you

did you try ?

you don’t ‘add’ nodes to a gateway… you register and add them to an application.

I created application and added Lopy but status for device showing “never seen”,

that’s really not enough info.

Thank you.
I have some progress TTN gateway is up and running, but I am stuck now with scenario.
I am trying to connect over the air to my TTN Gateway which is up and running from Lopy
and keep getting the message: “Not yet joined…”
any ideas

update: I was able to get connection only using ABP method

1 Like

Still unclear how to register Lopy with US915 TTN gateway via OTAA method.
Does anybody have registered?

I was able to get register Loy with TTN US915

you’ve found it… great !
maybe you want to share how for other users ?

My post on the Pycom might help Pycom fipy connects ok with ABP but not OTAA


I used Pycom Lopy with latest firmware. TTN gateway with original firmware.

code as per below

from network import LoRa
import socket
import time
import struct
import binascii

lora = LoRa(mode=LoRa.LORAWAN, region=LoRa.US915)

dev_eui = binascii.unhexlify(‘xxxx’)
app_eui = binascii.unhexlify(‘xxxx’)
app_key = binascii.unhexlify(‘xxxx’)

for channel in range(0, 72):
lora.add_channel(channel, frequency=903900000, dr_min=0, dr_max=3)

join a network using OTAA
lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0, dr=4)

wait until the module has joined the network
join_wait = 0
while True:
if not lora.has_joined():
print(‘Not joined yet…’)
join_wait += 1
if join_wait == 5:
lora.join(activation=LoRa.OTAA, auth=(dev_eui, app_eui, app_key), timeout=0, dr=0)
join_wait = 0

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, 0)

make the socket blocking


for i in range (200):
pkt = b’PKT #’ + bytes([i])
print(‘Sending:’, pkt)
rx, port = s.recvfrom(256)
if rx:
print(‘Received: {}, on port: {}’.format(rx, port))

1 Like

see Pycom fipy connects ok with ABP but not OTAA