Issue: payload not sending to TTN but the joining metadat was successfully can be seen in TTN
Setup: I used raspberry pi 3b+ with rak811 lora piHat this is connected to the opal-RT via ethernet to get the data from real-time simulation through UDP. I am using rak7240 as my gateway.
Server: TTN (network server v2)
I am trying to send data from simulink then using UDP sending this data to raspberry. The data in raspberry pi was displayed correctly. But, when I am trying to send the UDP data to lora it was not able to send. Can someone help me how to fix the code. P.S. I am not expert in programming, I am just starting to learn everything. Thank you. BTW, I just got the basic code of sending data from github. The idea here is raspberry pi will accept data from another machine through UDP protocol. Then, the data will be unpack in raspberry pi, those data will be transmitted using lora piHat going to the gateway, then to network server.
from sys import exit from time import sleep from rak811.rak811 import Mode, Rak811 from ttn_secrets import APP_EUI, APP_KEY import socket, struct, os import numpy as np import struct import socket lora = Rak811() print('Setup') lora.hard_reset() lora.mode = Mode.LoRaWan lora.band = 'AS923' lora.set_config(app_eui=APP_EUI, app_key=APP_KEY) print('Joining') lora.join_otaa() lora.dr = 5 IP = "" PORT = 50000 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind((IP, PORT)) try: while True: data, addr = sock.recvfrom(1024) data = struct.unpack('dddddddddd', data) lora.send(data) print("x1", data) sleep(0) except pass print('Cleaning up') lora.close() exit(0)