Lorarx

Aus DXL-Wiki
Zur Navigation springen Zur Suche springen

Über lorarx

lorarx ist ein Dekoder für LoRa APRS mithilfe eines RTL-SDR USB Sticks (und Ähnlichem). lorarx benötigt wie afskmodem das Empfangsmodul sdrtst und den SDR-Server rtl-tcp zum funktionieren.

Wichtig:

  • sdrtst muss mindestens den Stand vom 18. Mai 2022 haben um lorarx nutzen zu können!
  • Nachträglicher Download von lorarx und dem aktuellen sdrtst bei OE5DXL, z.B. hier: http://oe5dxl.hamspirit.at:8025/aprs/bin/

Parameter in der Kurzübersicht

 Decode lora out of IQ-File/Pipe (samplerate must be exact +/-0.00001)
 output data in udp, axudp or json, view aprs, pr, lorawan, fanet

 -A                 (*) enable frame chaining for ax25 longframes
 -a <afc-speed>     (*)follow frequency drift, 0 off (0.5), on sf<9 (0)
 -b <bandwidth>     kHz 0:7.8 1:10.4 2:15.6 3:20.8 4:31.25 5:41.7 6:62.5 7:125 8:250 9:500 (7)
 -C                 (*)use crc on implicit header
 -c <cr>            (*)coding rate and enable implicit header (4..8) (else from header)
 -D                 (*)if dcd lost go on decoding until frame length limit (for external FEC or monitoring)
 -d                 (*)swith off collision detection (less cpu but loose stronger frames starting in weaker
 -E                 switch off useing crc to repair 1 chirp (crc checks 4 variants) (on)
 -F                 max. block energy FEC off (hamming code fec remains on) (on)
 -f u8|i16|f32      IQ data format
 -g <dB>            add this to measured signal level (0.0)
 -H                 show -v data in ascii if printable else in [hex]
 -h                 this
 -i <file>          IQ-filename or pipe
 -J <x.x.x.x:destport>  send demodulated data(base64) with metadata in json
 -j <file/pipe>     write demodulated data(base64) with metadata in json to file or (unbreakable) pipe
 -L <x.x.x.x:destport>  (*)as -U but AXUDPv2 with metadata for igate
                      may be repeated with same -b but different -s  after -L
 -l <len>           (*)fixed datalen for implicit header else guess datalen from dcd
 -M <MHz>           pass through rx frequency to json metadata -M 433.775
 -N                 if verbous add empty line after data line
 -n <[-]Hz> <[-]Hz> notchfilter baseband from-to Hz (may be repeatet)
 -O <0..1>          (*)optimize on off else automatic on sf/bw (-1)
 -o <Hz>            shift input iq band +-Hz
 -P <+/-ppm>        (*)tune datarate (chirp sampelrate) or preset for auto (-a) in ppm (0)
 -Q                 verbous only for frames with crc and crc ok
 -q                 (*)invers chirps or swapped I/Q (prefer negative spread factor)
 -R                 switch off repairing multipath or if-filter fase distortion
 -r <Hz>            downsample input, give exact input sampelrate in Hz (off)
 -S <level>         (*)modifiy squelch level critical for implicit header frame length guess (automatic)
 -s [-]<sf>         (*)spread factor (5..12) (12) and start a new demodulator
                      negativ value for invers chirps or swapped I/Q
 -t <x.x.x.x:destport>  (*)send raw frame bytes in udp frame only if has crc and crc ok
 -U <x.x.x.x:destport>  (*)send frame in AXUDP
 -u <x.x.x.x:destport>  (*)send raw frame bytes in udp frame
 -V                 very verbous
 -v                 verbous +:no hamming or ok, -:error, h:corrected, ~:weakest chirp replaced, c:try until crc ok
                      ^:bins with maximum power sum used until fitting hamming
 -W <n>             every n*firlen samples update notch filter 0=off, ok:50  (0)
 -w <len>           downsample fir length else automatic (8..4096) (0)
 -X <netid>         (*)filter network-id (sync), 1xx stops decode on wrong id so fast ready for new frame if set -d
                      0 is wildcard, 20 will pass 2*, 03 for *3, 00 pass all (00)
 -Y d|f|b <filename>  iq debug output in float32-iq dechirped or filtered
 -Z <upspeed> <downspeed>  add pulse noise filter (noise blanker) (0.05 0.999)
(*) may be repeated for more demodulators, to start next demodulator apply -s <sf> before other pramaeters

example1: aprs with autonotch for birdies: rtl_sdr -f 433.775m -s 1000000 - | ./lorarx -i /dev/stdin -f u8 -v -N -b 7 -s 12 -w 64 -r 1000000 -W 50
example2: lorawan all modulations: rtl_sdr -f 869.525m -s 1000000 - | ./lorarx -i /dev/stdin -f u8 -v -N -b 7 -s 12 -s 11 -s 10 -s 9 -s 8 -s 7 -s -12 -s -11 -s -10 -s -9 -s -8 -s -7 -Q -w 64 -r 1000000
example3: fanet: rtl_sdr -f 868.215m -s 1000000 - | ./lorarx -i /dev/stdin -f u8 -v -N -b 8 -s 7 -Q -w 128 -r 1000000
example4: sdrtst IQ output with FIR 125kHz in sdrcfg.txt: q 433.775 0 0 0 192000+125000,32
          sdrtst -t 127.0.0.1:1234 -c sdrcfg.txt -r 250000 -s /dev/stdout -k |
          lorarx -i /dev/stdin -f i16 -b 7 -v -s 12 -L 127.0.0.1:2300 -s 10 -L 127.0.0.1:2301
example: decode payload in json with python3: -J 127.0.0.1:5100
import json, base64, socket
IP=("0.0.0.0",5100)
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock.bind(IP)
while True:
  data, addr=sock.recvfrom(1500)
  obj = json.loads(data.decode())
  print(obj)
  try:
    payload=base64.b64decode(obj["payload"])
    print("payload=",payload)
  except: pass

Ausführliche Beschreibung der Parameter

Parameter Beschreibung
a <afc-speed> follow frequency drift, 0 off (0.2), on sf<11 (0)
b <bandwidth> kHz 0:7.8 1:10.4 2:15.6 3:20.8 4:31.25 5:41.7 6:62.5 7:125 8:250 9:500 (7)
C use crc on implicit header
c <cr> coding rate and enable implicit header (4..8) (else from header)
d swith off collision detection (less cpu but loose stronger frames starting in weaker
D if dcd lost go on decoding until frame length limit (for external FEC or monitoring)
F max. block energy FEC off (hamming code fec remains on) (on)
i16|f32 IQ data format
g <dB> add to measured signal level (0.0)
h Hilfetext.
i <file> IQ-filename or pipe
L <x.x.x.x:destport> as -U but AXUDPv2 with metadata for igate. may be repeated with same -b but different -s after -L
l <len> fixed datalen for implicit header else guess datalen from dcd
O <0..1> optimize on off else automatic on sf/bw (-1)
s <sf> spread factor (6..12) (12)
S <level> enable squelch for low SF (0.0)
U <x.x.x.x:destport> send frame in AXUDP
u <x.x.x.x:destport> send raw frame bytes in udp
V Zeige mehr Informationen in der Bildschirmausgabe.
v Zeige Informationen in der Bildschirmausgabe: +:hamming ok, -:error, h:corrected, ~:weakest chirp replaced, ^:bins with maximum power sum used until fitting hamming
X <netid> filter netwok-id (sync pattern), 1xx stops decode on wrong id (12)


Beispielkonfiguration

Eine Beispielkonfiguration des lorarx:

  • Achtung, eigene Pfade beachten und anpassen!
  • Audiopipe wird in Zeile 2 automatisch angelegt
  • updbox ist in dem Beispiel dabei, kann aber auch weggelassen werden. Dann Zielport bei lorarx ODER udpgate4 anpassen.
  • Bitte automatischen Zeilenumbruch bei udpgate4 beachten. Gehört natürlich alles in eine Zeile.
rtl_tcp -a 127.0.0.1 -d0 -p 18100 &
mknod lorapipe p 2> /dev/null
sdrtst -t 127.0.0.1:18100 -r 250000 -s lorapipe -c qrglora.txt -k -v &
lorarx -i lorapipe -f i16 -b 7 -s 12 -L 127.0.0.1:9702 -v &
udpbox -R 127.0.0.1:9702 -l 127.0.0.1:10702 -r 127.0.0.1:9999 -v &
udpgate4 -s MYCALL -R 127.0.0.1:0:10702#LoRa -H 10080 -I 1440 -u 50 -B 60 -n netbeacon.txt -g rotate.aprs2.net:14580#m/1,-t/t -p <PASSCODE> -t 14580 -w 14501 -D /home/pi/dxlAPRS/aprs/www/ -v &

Inhalt qrglora.txt:

p 5 0   # Bei Stick mit Frequenzabweichung passenden Wert hier angeben
p 8 1   # Autogain kann manchmal zu Problemen führen. Ggf. mit fixem Gain arbeiten.
q 433.775 0 0 0 140000+125000,16

Beispiel Bildschirmausgabe lorarx:

bw=125000.0 cr=from header sf=12 optimize=1 driftloop=0.200
12:0:id:12 cr:5 len:71 crc:ok lev:-12dB snr:5.4dB nf:-53.0dB txd:491 q:90% afc:-1748Hz df:120Hz
[++++++++++++++++]<[FF][01]DL1NUX-12>APLT00,WIDE1-1:!5014.06N/01059.01E[165/000/A=001097 !wrx![0A]
12:0:id:12 cr:5 len:81 crc:ok lev:-12dB snr:6.9dB nf:-54.3dB txd:491 q:89% afc:-7173Hz df:-572Hz
[++++++++++++++++++]<[FF][01]DL1NUX-11>APRS:!5014.07N/01059.02E>077/000/A=001100 Batt=3.67V LoRa 1W Tracker
12:0:id:12 cr:5 len:82 crc:ok lev:-12dB snr:5.5dB nf:-53.1dB txd:491 q:90% afc:-1579Hz df:116Hz
[++++++++++++++++++]<[FF][01]DL1NUX-12>APLT00,WIDE1-1:!5014.06N/01059.01E[165/000/A=001076TTGO Attila !w{b![0A]