Tip: Use Python version 3.7+ to have the support of nanosecond time readings. Following things to remember while the configuration of LoRa.
• Always use "mac pause" before every radio trans-receiving radio command
• Select regional frequency (Example Europe 869100000 Hz)
• Watchdog time should be zero for continuous receiving mode
• A unique HWEUI of LoRa with a unique packet number is transmitted to all the reference nodes
• Regional duty cycle restrictions must be followed.
Sending:
- msg = "{{pn"+temp_packet_number+"hweui@"+str(hweui)+"@ts@"+str(time.time_ns())+"}}"
- sp.write("mac pause\x0d\x0a".encode())
- msg = msg.encode().hex()
- sp.write(("radio tx "+str(msg)+"\x0d\x0a").encode())
Receiving:
- sp.write("mac pause\x0d\x0a".encode())
- sp.write("radio rx 0\x0d\x0a".encode())
- m = sp.read_all().decode("utf-8")
- rda = rda+m
- if "7D7D" in rda:
-
msg2 = bytes.fromhex(rda]).decode('utf-8')+time.time_ns() - data = {'api_key':API_KEY, 'technique':ToA, 'api_payload':msg2}
- r = requests.post(url = API_ENDPOINT, data = data)
- pastebin_url = r.text