These scripts are written in perl, released GPLv3 and are considered very alpha. They work most of the time but I would not consider them reliable. They are a work in progress and I have probably changed more things since being posted here.


# GPLv3 Matt Skorina May 2011
# Converts SPOT Tracker position to APRS format and sends it to APRS-IS.

# Make sure you clear previous tracks before starting.

# Currently this will not work if there is only 1 entry in the XML feed
# says the only solution is to check, or to not use XML::Simple.
# Also we can just leave some enteries in the XML feed and the latest
# will be beaconed to APRS when the script is started, which would
# probably be okay

$spot_id = "0QZIFd8RylVQv5cZvHG7oInqW7ZvBK1Yt"; # Shared key for SPOT device
$check_interval = 60; # How often to check for new data (seconds)
$spot_callsign = "KF7DXI-12"; # Callsign of beacon
$spot_symbol = "/I"; # /I = TCPIP Internet Station
$software = "SPOT01"; # Digipath for SPOT position
$comment = "*TESTING* SPOT Tracker"; # Comment for message in addition to time stamp

use LWP::Simple;
use XML::Simple;
use Ham::APRS::FAP;
use IO::Socket;

$last_packet = "";
$spot_url = "$spot_id&completeXml=true";

while(1==1) {
$spot_data = get($spot_url);
$xml = new XML::Simple;
$spot_xml = $xml->XMLin("$spot_data");

print @spot_xml;

if ($spot_xml->{totalCount} != 0) {
$latitude = "$spot_xml->{message}->[0]->{latitude}";
$longitude = "$spot_xml->{message}->[0]->{longitude}";
$time = "$spot_xml->{message}->[0]->{timeInGMTSecond}";

$timestamp = Ham::APRS::FAP::make_timestamp($time,0);
$position = Ham::APRS::FAP::make_position($latitude,$longitude,-1,0,-10000,$spot_symbol,0,0);

$packet = "$spot_callsign>$software,TCPIP*:=$position$timestamp $comment";

if ($packet ne $last_packet) {
	print "$packet\n";
  my $sock = new IO::Socket::INET (
    PeerAddr => '',
    PeerPort => '14580',
    Proto => 'tcp',
  die "Could not connect to server: $!\n" unless $sock;
  print $sock "user KF7DXI-2 pass 22441\n";
  print $sock "$packet\n";
	$last_packet = $packet;
print "Done\n";


# GPLv3 Matt Skorina May 2011
# This script will scrape the API of the Instamapper (
# cellular tracking service and send position reports to APRS-IS to be
# collected by any APRS internet connected client.

# Make sure you clear previous tracks before starting.

# Running a test for several hours we had the script fail after awhile
# with an error of "malformed JSON string, neither array, object,..."
# which failed on the "$decode = decode_json($raw);" line
# I don't know the input that caused the error but we need the script to
# keep going in the event of non-parasable errors because we can't
# restart it in the field. Or we need to be able to restart it in the
# field.

$api_key = "9867058974684447968";
$check_interval = 5; # How long to wait between checks, minimum per API terms is 10s
$igate = "KF7DXI-3"; # Callsign to gate packet to APRS-IS
$pass = "22441"; # APRS passcode for igate callsign (passcode CALLSIGN on *nix systems)
$aprs_server = ""; # APRS-IS server to connect to
$aprs_port = "14580"; # Port of APRS-IS server normally 14580
$callsign = "KF7DXI-13"; # Callsign for cellular tracker
$software = "INSTAM"; # What type of device this is
$symbol = "/I"; # APRS symbol, /I is TCPIP
$comment = "WWCC Balloon Cell Tracker"; # APRS comment, so people know what this is

use LWP::Simple;
use JSON;
use Ham::APRS::FAP;
use IO::Socket;

$last_packet = "";
$url = "$api_key&format=json";

while (1==1) { # There is probably a better way to do this...
$raw = get($url);
$decode = decode_json($raw);

$latitude = $decode->{positions}->[0]->{latitude};
$longitude = $decode->{positions}->[0]->{longitude};
$altitude = $decode->{positions}->[0]->{altitude};
$speed_meter = $decode->{positions}->[0]->{speed}; # Instamapper gives speed in m/s
$speed_kph = $speed_meter*3.6; # APRS wants speed in kph
$course = $decode->{positions}->[0]->{heading};
$time = $decode->{positions}->[0]->{timestamp};

$timestamp = Ham::APRS::FAP::make_timestamp($time,0); # To double check time, probably a better way to do this
$position = Ham::APRS::FAP::make_position($latitude,$longitude,$speed_kph,$course,$altitude,$symbol,0,0);

$packet = "$callsign>$software,TCPIP*:=$position$timestamp $comment";

if ($packet ne $last_packet) {
  print "$packet\n"; # So you can see what's going on

  $sock = new IO::Socket::INET ( # One time connection to server for each packet
    PeerAddr => "$aprs_server",
    PeerPort => "$aprs_port",
    Proto => "tcp",
  die "Could not connect to server\n" unless $sock;
  print $sock "user $igate pass $pass\n";
  print $sock "$packet\n";

  $last_packet = $packet; # So we don't send duplicate packets
sleep($check_interval); # So we don't swamp the API
print "Done\n";