iPhoneSat Communications

Based on the PhoneSat project, which uses Android as the operating system, I decided to pursue an iPhoneSat, which would be a similar project, but based on iOS and using an iPhone rather than Android. Mostly this becomes an excuse to combine my interest in Space settlement with my interest in iOS development

I decided to start with the communications protocol between the space elements and the ground station. This is likely to be a relatively low-bandwidth transport layer, so maximizing the compression in the messaging protocol is important. So I chose ASN.1 unaligned PER. This is a densely packed protocol. There are good open source and commercial tools available to convert compile the message definition into C, C++ or Java source code that can be readily linked into another project. For this effort I am using the open source asn1c compiler.

My next step after compiling into C source from the ASN.1 notation is to wrap the C source in Objective-C objects, making the communications layer into a static library readily added to an iOS application With a different project it could also be made into an OS-X application, possibly for a ground station.

My iPhoneSat project is hosted on GitHub.

The message definition looks as follows:

Module-order DEFINITIONS AUTOMATIC TAGS ::=

BEGIN

 

Message ::= CHOICE {

    request Request,

    response Response,

    …

}

 

Request ::= SEQUENCE {

 

}

 

Response ::= SEQUENCE {

    health System-health,

    location Location,

    …

}

 

System-health ::= ENUMERATED {

    nominal(0),

    …

}

 

Location ::= SEQUENCE {

    latitude INTEGER (-90000000..90000000),

    longitude INTEGER(-180000000..180000000),

    altitude INTEGER(-500..36000000),

    …

}

 

END

A message is either a request or a response.

A request is sent to the satellite from the ground station requesting a response. Currently the Request object contains no data, but that will be changing in the next version. A Request could be a request for location, a request for location and a photo, or a request for location and video. These require further examination and development.

Besides location, a response contains a System-health value, which is currently only nominal. This will be extended as my understanding of the possibilities advance.

A Location object contains latitude, longitude and altitude. All three are INTEGER types. Notice that latitude and longitude are in degrees times one million. each increment is equivalent to one millionth of a degree, less than one centimeter. Altitude is from 500 meters below the WGS-84 datum to 36,000 kilometers above the datum. This is slightly above a geostationary orbit altitude. Future versions of Location will also include velocity and attitude.

Interestingly, the asn1c compiler uses angle brackets (“<“ and “>”) around all #include’s. This creates a problem for the C compiler, which insists that files in the same directory should use quotes instead, so one of the necessary steps before getting a successful compilation of the project is to replace the angle brackets with quotes of all the asn1c generated files included in other generated files. The other interesting action is that in some files the compiler generates a RETURN macro, and in other cases a DEBUG macro. The C compiler objects to both, and I modify the macro, and macro calls by appending a “_”, so RETURN becomes RETURN_ and DEBUG becomes DEBUG_.

My next step, already started with Location.m, is to construct the Objective-C wrappers for Location, Request, Response and Message.

This entry was posted in iPhoneSat and tagged , , , . Bookmark the permalink.

Comments are closed.