GPS Locator

This example Thing is a GPS locator running on a Raspberry Pi using a Sixfab cellular modem to connect to the Internet. The Sixfab cellular modem also provides the GPS coordinates.

Thing's user interface shows a map view with a pin at Thing's current location. The location is checked and updated every minute. We'll use Thing Prime running on a VM to view the map, giving us access to Thing, regardless of it's physical location.

Hardware Setup

Parts list below. If you don't have the hardware, there is a demo mode so you can run Thing in software-only mode. (See Running below).

Parts List:

  • Rapsberry Pi (any model except Pico)

  • Sixfab Raspberry Pi 4G/LTE Cellular Modem Kit

I'm using the Telit LE910CF-NF (North America) LTE module option, $125 for the kit

It includes a SIM card for $2/month + data

Software Setup

  • Files for this example are located in examples/gps/ and examples/telit.

  • Thing Prime runs on a cloud VM. I'm using a Linode VM to host Thing Prime.

  • Sixfab core software is installed on Raspberry Pi and SIM is activated.


Same build procedure for both Thing on Raspberry Pi and Thing Prime on VM:

$ cd merle

$ ./build examples/gps


There are a few command line options to make running Thing and Thing Prime from the same binary easier:

$ cd merle

$ ~/go/bin/gps -help

Usage of /home/merle/go/bin/gps:

-TLS uint

TLS port


Run in Demo mode


Run as Thing Prime

-rhost string

Remote host

-ruser string

Remote user (default "merle")

Thing on Raspberry Pi

Now start Thing on the Raspberry Pi, specifying the remote host to connect to the the Thing Prime VM. Replace with the Domain Name of your VM. (Or the IP address of the VM).

$ cd merle

$ ~/go/bin/gps -rhost

Demo Mode

If you don't have the hardware setup, run in demo mode:

$ cd merle

$ ~/go/bin/gps -demo -rhost

This will rotate the map though world cities, refreshing once a minute.

Thing Prime on VM

Start Thing Prime on the VM. Turning on HTTPS on port :443. (Only turn HTTPS on when there is a Domain Name for the VM', so Let's Encrypt can auto-generate a TLS certificate). The Domain Name for the VM is

$ cd merle

$ ~/go/bin/gps -prime -TLS 443

View Map

Browse to to view Thing. (If VM does not have a Domain Name, use http://<ip addr>).

It may take a bit to lock onto the GPS satellites. If GPS coordinates are unavailable, the map will center on [0, 0] lat, long (middle of the ocean somewhere). Once the GPS coordinates are known, the map updates to center to the GPS coordinates. Thing will continue tracking and updating GPS coordinates every minute.

The AT commands to the Telit modem check for new GPS coordinates. After a bit, once the Telit modem locks on to the GPS satellites, the AT$GPSACP command will return with the GPS coordinates. These coordinates are broadcast on the Thing message bus.

2022/06/11 06:39:30 Telit modem response ["AT$GPSACP" "$GPSACP:" ",,,,,1,,,,,," "OK"]

2022/06/11 06:40:30 Telit modem response ["AT$GPSACP" "$GPSACP:" ",,,,,1,,,,,," "OK"]

2022/06/11 06:41:31 Telit modem response ["AT$GPSACP" "$GPSACP:" "054130.000,4732.4788N,12712.6275W,500.0,948.5,2,305.6,0.0,0.0,110622,03,00" "OK"]

[dc_a6_32_7a_a3_82] Broadcast: {"Msg":"Update","Lat":47.54114666666667,"Long":-127.21044166666667}

2022/06/11 06:42:31 Telit modem response ["AT$GPSACP" "$GPSACP:" "054231.000,4732.4341N,12712.5751W,500.0,676.6,3,305.6,0.0,0.0,110622,02,00" "OK"]

[dc_a6_32_7a_a3_82] Broadcast: {"Msg":"Update","Lat":47.54056833333333,"Long":-127.209585}

2022/06/11 06:43:32 Telit modem response ["AT$GPSACP" "$GPSACP:" "054241.000,4732.4285N,12712.5667W,500.0,631.6,3,305.6,0.0,0.0,110622,02,00" "OK"]

[dc_a6_32_7a_a3_82] Broadcast: {"Msg":"Update","Lat":47.540475,"Long":-127.209445}