Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

decode SMS reporting GPS positions of Lions in Kenya

Tags:

The Mara-Naboisho Lion Project has asked for our help decoding and plotting the positions of lions fitted with GPS collars.

They receive SMSes from the collars:

Collar07854_100806210058.SMS

074952494449554d0000000000000000000000000000000000000000000000040f33303030333430313232393738393000000000000000000000000000000000f10a0806100028008c13ef348a0039d0fe000de871004cc92b5ca92d6213ef26640039d108000de86b004cc92d5ca92d5d13ef18620039d101000de865004cc92c5ca92d5813ef0a930039d0fc000de864004cc9311c682d5413eefc170039d045000de7d4004cc95b7c692c5013eeee280039d0ff000de85f004cc92a7c692d6fffffffffffffffffffffffffffffffffffffffffff

Collar07854_100807060011.SMS

074952494449554d0000000000000000000000000000000000000000000000040f33303030333430313232393738393000000000000000000000000000000000f10a0807020038008c13efb2eb0039d0ed000de853004cc92e3cea2d8813efa5060039d0fb000de860004cc9291c6a2d8413ef96fd0039d0fc000de85e004cc92d5c6a2d7f13ef88e00039d0f6000de85a004cc92b5c6a2d7b13ef7ad80039d0fa000de85a004cc9327c6a2d77ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff

These are presumably SMS PDUs, although simple online decoders don't seem to make much sense of them. There's the ASCII text "IRIDIUM" in them, presumably being the SMSC or sender or something string, as IRIDIUM is a satellite telephone system and presumably the bearer when the collars send up their positions.

UPDATE: They have some KML files that correspond to these collars; I've uploaded the KML here and here. The collars are probably made by Vectronic-Aerospace.

What format is it, and how do we decode it?

(This is a giving code project; perhaps you want to help them, or look at other issues there?)

like image 427
Will Avatar asked Sep 10 '12 08:09

Will


1 Answers

I've been able to translate the lat/lon positions! After looking at the website from the collar developers I've seen they are using x/y/z ECEF coordinates.

The first line of the first message:

13ef 348a 0039 d0fe 000d e871 004c c92b 5ca9 2d62

Is translated as:

0039 d0fe = X = 3789054
000d e871 = Y = 911473
004c c92b = Z = 5032235

This translates into:

Lat: 52.43067054630929
Lon: 13.525755535406619
Height: 88.99500464554876

This results into a location in Germany... which sounds wrong for a Kenya reserve, but in fact it is the street of the company which makes these collars: check their website

The code to translate the coordinates has been found online:

public static double[] xyz2LLH(double x, double y, double z)
{
    double[] llh = new double[3];
    double da = 0.0; // datum parameter
    double df = 0.0; // datum parameter
    double a = 6378137 - da;
    double f = 1 / 298.2572235630 - df;
    double b = (1 - f) * a;
    double e2 = 2 * f - f * f;
    double E2 = (a * a - b * b) / (b * b);
    double p = Math.sqrt(x * x + y * y);
    llh[0] = Math.atan2(y, x);
    double theta = Math.atan((z * a) / (p * b));
    llh[1] = Math.atan((z + E2 * b * Math.pow(Math.sin(theta), 3)) / (p - e2 * a * Math.pow(Math.cos(theta), 3)));
    double N = a / Math.sqrt(1 - e2 * Math.sin(llh[1]) * Math.sin(llh[1]));
    llh[2] = p / Math.cos(llh[1]) - N;
    llh[0] = Math.toDegrees(llh[0]);
    llh[1] = Math.toDegrees(llh[1]);
    return llh;
}

So the only code left to decypher is the last bit: 5ca9 2d62.

Another clue from the website suggests these bytes hold the main voltage/backup voltage and temperature.

like image 132
Roy van Rijn Avatar answered Sep 29 '22 19:09

Roy van Rijn