GSM/GPS Tracker scripts for a backup HAB tracker and gateway to the HAB map
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
LICENSE Initial commit May 30, 2018 Added gateway, readme May 30, 2018 Added gateway, readme May 30, 2018 Added gateway, readme May 30, 2018

GSM/GPS Tracker And HAB Gateway

This system consists of 2 Raspberry Pi boards, one as a tracker with GSM/GPS board, and the other as a gateway with GSM modem. The tracker gets its position from the GSM/GPS device, and sends it as text messages to your phone and the gateway.

There are 2 Python 2 scripts, one for the tracker and one for the gateway, that together place the position of the tracker on the live HAB map (

See my blog post for more information.



The tracker requires a combined GSM/GPS device e.g. SIM868. I used the Waveshare HAT and a PI Zero. You also need a suitable power supply for these; remember that GSM can briefly take a lot of current so dont skimp here.


The script connects to the GSM/GPS device, firstly to retrieve the current position and secondly to send that position to your mobile phone and (optionally) the gateway (see below). It is written in Python 2 and uses the library.

You should autostart the script so that it runs after power-up.

The script takes two or three parameters:

    • Payload ID, which is what the payload will appear on the map as
    • Number of your mobile phone
    • (optional) Number of your gateway.

There are some hard-coded parameters near the top of the script to help it decide when to send texts to the above number(s) - e.g. on movement, or after a timeout. Adjust as required.

Remember to disable serial login on the Pi, but keep the serial port enable, in raspi-config.

Remember to switch the Pi HAT on after the Pi is powered up - hold the button for a second - because it DOES NOT AUTOSTART.

Remember to use a SIM card with enough credit for the number of texts you expect to be sent.



The gateway needs an internet connection and a GSM modem - e.g. a USB dongle. I used a Huawei E173 which is very common, but pretty much anything will do. That needs a SIM card but as it only receives then you can use a card with no credit on it. Many carriers give these away for free.


The script connects to the GSM modem, polling it for incoming messages. Each received message is checked for format and, if it looks like a position message from the tracker, a UKHAS-standard message is created and uploaded to

Payload Document

As with other trackers uploaded, you need to have a payload document to match what is uploaded. Use to create a document, with the "callsign" set to the "payload ID" you used for the tracker, plus the following fields:

  • sentence_id: Integer
  • time: Time
  • latitude: Coordinate (dd.dddd)
  • longitude: Coordinate (dd.dddd)
  • altitude: Integer