HF APRS location with raspberry pi

GLM.JPG

UPDATE: Since usb-audio handling of Raspberry Pi have improved on recent OS updates, it will happily run jPSKmail, Fldigi and Xastir together and usb audio still works well.

Summary:

- To transmit location data over HF, you can use Fldigi, jPSKmail and Xastir together on receiving side, and AndPskmail on transmitting side.
-Receiving side software runs on Raspberry Pi, but load is too high for successfully decode incoming audio.
-This python-program can be used instead of jPSKmail for gathering location data from Fldigi. This lowers cpu load and decoding in Fldigi starts working.
-Location data is then send to Xastir to be shown on map, or used on APRS-Igate.

Picture:By the way: si4735-chip works on 10 meter band also, even specs everywhere seems to claim highest receiving frequency to be something like 26mhz. I have even used it to receive location information on 10 meter AM. It worked surprisingly well. I have also received local ssb-cb-trafic by injecting "carrier" from ad9850 -dds chip.

I wanted to receive location data on 10 meter band with raspberry pi.

On transmitting side I used AndPskmail, which is handy android-applet for sending APRS-packets for example in robust THOR-modes. (One transmitting gear is briefly introdused on "arduino rsid-section".)

AndPskmail is meant to use with jPSKmail at receiving side, which use fldigi-software as modem. jPSKmail can send received location data to Xastir, which handles mapping. (jPSKmail do much more also.)

Fldigi, jPSKmail and Xastir can all run on raspi. But in reality raspberry have not enough processing power to let Fldigi really decode audio properly if jPSKmail is running. jPSKmail is java-based. I tried all kind of tricks to make this Fldigi-jPSKmail-Xastir chain working, but failed. They run together on raspi, but raspi can not really decode much of incoming audio. It seems Java is just too much.

So I ended up to make tiny python-program which looks location packets directly from Fldigis log file. and send data to Xastir. it is so little that it even has no name. So little that Fldigi on raspberry really starts to decode incoming audio.

A little warning! This is not "real" aprs-program. It is made for local single-user use. But you may copy-paste it to Idle on your raspberry and use it as a starting point. But if you use igate on Xastir, please do not use my hamcall which is part of code. Xastir accepts location data only from valid hamcall ass "sender". even if sender is same computer where Xastir itself is running.

Don't take this too serious. This is about first thing I have made with python.

If you want to try use the code:
Install Fldigi and Xastir. I will not give any details here, but it is easy.
-Copy-paste it to Idle 2.7 and run it.
-It looks if there is log file from fldigi available, if not it may try to start fldigi (and this may cause some troubles for your raspi :).
-It looks for keyword. Put keyword on entry field, and click "aseta". Otherwise it will look for "tarmo".
- Put same keyword on "comment field" on AndPskmail's APRS-tab. You can choose what kind of mark you want to be shown on xastir's map by putting right character before keyword. For example " [ " shows pedestrian symbol if I remember right. These symbol marks are defined on APRS-"standard". WA8LMF have good information page.
-Remember to put fldigi "log all tx/rx -text"
-If keyword is found, it compose aprs-packet and use data it founds. There is nothing error-detection, it just assumes everything is on expected place on characters before keyword. It sends composed packet to xastir with "xastir_udp_client"-program, which is part of xastir. Then it clears logfile. There will be last receiving time of keyword on entry field now.
-"Lopeta" is just a quit-button.
- Do not expect this work on remote desktop use. There will be too much load on usb - incoming audio will most likely fail.

2013-07-28-173919_656x512_scrot.png

The most interesting part in code is under "#fldigin lokitiedoston käsittely" APRS-packet is composed there and sent to xastir with xastir_upd_client.
# -*- coding: utf-8 -*-
 
from Tkinter import *
import sys
import datetime
import os
 
#Laskee fldigin lokitiedoston nimen, fldigYYYYMMDD.log
global loki
now = datetime.datetime.now()
yyyymmdd=now.strftime("%Y%m%d")
loki='/home/pi/.fldigi/fldigi'+yyyymmdd+'.log'
root = Tk()
 
#global sana2
sana2='tarmo'
 
def lopeta():
    root.destroy()
    sys.exit(0)
 
 
def lue2():
 
 
 
    global sana2
    sana2 = str(Entry.get(entry2))
    Label(root, text="                   ").grid(row=12, sticky=W)
    Label(root, text=sana2).grid(row=12, sticky=W)
    Entry.delete(entry2, 0, END)
    texti.insert(END, "\n+++Odotetaan merkkijonoa: ")
    texti.insert(END, sana2)
    #Entry.insert(tuloste, 0, tulos)
 
 
def seuraa():
    root.after(2000,seuraa) #jotta homma rullaisi
 
 
 
#fldigin lokitiedoston käsittely
    try:
        f = open (loki,"r")
        data = f.read()
 
        x=data.find(sana2)
        if x != (-1):
            rxe=data[(x-11):x-2]
            rxn=data[(x-20):(x-11)]
            rxsym=data[(x-1):(x+5)]
            Entry.delete(entry2, 0, END)
            now = datetime.datetime.now()
            mmddhhmm=now.strftime("%m%d%H%M")
            entry2.insert(0, mmddhhmm)
            texti.insert(INSERT, '\n---ajassa ')
            texti.insert(INSERT, mmddhhmm)
            texti.insert(END, ' kuultu! ')
            texti.insert(END, ' ')
            texti.insert(END, "\""+rxsym[1:]+">PSKAPR:="+rxn+rxe+rxsym+"\"")
            f.close()
            f = open(loki, 'w')
            f.write('')
            aprs="xastir_udp_client localhost 2023 OH6ECF-7 18857"+" \""+rxsym[1:]+">PSKAPR:="+rxn+rxe+rxsym+"\"&"
            os.system(aprs)
            texti.insert(END, '\n')
            texti.insert(END,aprs)
 
        f.close()
 
    except IOError:
        Label(root, text="Fldigin lokitiedostoa ei löydy.Käynnistetään Fldigi").grid(row=8, sticky=W)
        fldigi()
 
 
def fldigi():
    os.system("fldigi&")
    return
 
#---------------------------------
#Etsittävä merkkijono
 
 
 
texti = Text(root,height=10)
texti.insert(END, "+++Odotetaan merkkijonoa: ")
texti.insert(END, sana2)
texti.grid(row=0,column=0,columnspan=4, rowspan=10)
 
label2=Label(root, text=sana2).grid(row=12, sticky=W)
 
 
 
entry2 = Entry(root)
 
 
entry2.grid(row=12, column=3)
 
Label(root, text=loki).grid(row=17, sticky=W)
 
 
 
 
var2=IntVar()
 
 
b_apply = Button(root, text="lopeta", command=lopeta)
b_apply.grid(row=17, column = 3)
b_apply = Button(root, text="Fldigi", command=fldigi)
b_apply.grid(row=17, column = 2)
 
b2apply = Button(root, text="aseta", command=lue2)
b2apply.grid(row=12, column = 2)
 
 
 
root.after(3000,seuraa)
 
root.mainloop()