If you are having issues with the exercises, please create a ticket on DevZone:
Click or drag files to this area to upload. You can upload up to 2 files.

nRF91 simple tracker solution

This presents one possible solution to the project description described in the previous topic. The code for this project can be found in the GitHub repository for this course, found in lesson8/nrf91_simple_tracker of whichever version directory you are using (v2.2.0-v2.3.0 or v2.4.0-v2.x.x).

In this project, CoAP/DTLS is used as a transport layer to carry the GPS coordinates to a CoAP server.

The data sent to the server is shown in the table below:  

DataPermitted CoAP methods (nRF91 Series device)Permitted CoAP methods (client)Comments
Latitude, longitudePOSTGETLatitude and longitude in degrees
AccuracyPOSTGETPosition accuracy (2D 1-sigma) in meters.
Last seen timePOSTGETDate and time of last satellite fix (in UTC time)

Sample data:

  • [Latitude, longitude]: 59.919568,10.686956
  • [Accuracy]: 10.1 m
  • [Last seen time]: 2022-09-15 12:45:00

The nRF91 Series device acts as a CoAP client that sends POST requests with GPS data at regular intervals to a CoAP server. A user can use any web browser on any device to access the data. Alternatively, a CoAP client running on a PC, smartphone, or tablet can send a GET request for the data posted by the nRF91 Series SiP.

By default, the project uses the public CoAP sandbox server, which is the same one used on the exercises in Lesson 5. However, the project works on any other CoAP server of your choosing as long as you update its address and PSK information in the application configuration file through Kconfig.


Your device will create its own resource on the CoAP server. The name of the resource created by your board is set by the Kconfig CONFIG_COAP_DEVICE_NAME. Set your own device name in Kconfig or prj.conf and make sure that your device name starts with cali. as this is a requirement from the CoAP sandbox server (for example the device name: cali.Ali.nrf9160)

How it works

The application starts by activating the GNSS receiver and searching for GPS satellites in the sky. As we covered in Lesson 6, your board needs to have visible access to the sky in order to get a fix. Once a GPS fix is obtained (enough satellites were found to generate valid GPS coordinates), the LTE modem is activated and data is sent over CoAP to the CoAP server. After that, the LTE modem is deactivated and the device goes to sleep for the interval set by CONFIG_TRACKER_PERIODIC_INTERVAL (default to 120 seconds). Once that interval time has passed, the cycle will repeat itself as shown in this flowchart: 


Since we are manually switching the LTE modem on and off, this provided solution is an implementation that works regardless of whether your SIM card and/or network provider supports power-saving techniques (PSM and eDRX).

Pressing button 1 on your device will show you the status of the tracker device through the LEDs. Pressing button 1 twice switches off the LEDs to save power.

The table below shows what the different LEDs on the device indicate:

StatusnRF960 DKThingy:91
No LTE (error)LED1Red LED
Searching for GPS signalLED2Green LED
GPS fix foundLED3Blue LED

How to get the data

Your development kit will create its own resource on the CoAP server. The name of this resource is set by the Kconfig CONFIG_COAP_DEVICE_NAME. Again, make sure that your device name starts with cali. as this is a requirement from the CoAP server.

nRF91 simple tracker web app

We also have an open-source web app to parse the coordinates sent over CoAP and visualize it live on a map.

Go to this website: and enter the full URL (coap:// or coaps://) of your nRF91 simple tracker CoAP resource. Then click Connect and you will see your location visualized on the map. Please note that it is case sensitive, so make sure to match whatever you set CONFIG_COAP_DEVICE_NAME to.

The web app is configured to draw the last 10 coordinates received (20 minutes time window assuming a CONFIG_TRACKER_PERIODIC_INTERVAL = 120), and the old ones will automatically be removed from the map.

Clicking on a pin will give you details of the coordinates with the time when it was captured and converted from UTC format to your browser time zone.

The web app expects valid data to be available on the resource. If there are none, the web app will throw an error message and ask you to reconnect.

In browser

You can use a browser on any device to obtain the GPS data, by using a CoAP crawler hosted by, found at this address:

Scroll down to locate your own device name, in our case cali.Ali.nRF9160, with the /echo/ prefix. Then click on this link to access the data.

Find the link with your device name
Click on it to observe the GPS data

Desktop program

There are other options to receive the raw data as well. If you are using a PC, you can download the desktop program cf-browser (you need Java Runtime Environment installed on your machine), like we did when testing Lesson 5 Exercise 1 and 2. Then connect to the CoAP server and locate your resource name as shown in the illustration below:

Desktop program: cf-browser

Chrome extension

Another option is to use the chrome extension Copper for Chrome (Cu4Cr) CoAP. Then connect to the CoAP server and locate your resource name as shown in the illustration below:

Chrome extension: Copper for Chrome (Cu4Cr) CoAP

Mobile app

If you are using an Android device, there are several CoAP clients that you can download from the Play Store, for example CoAP Client. There are also CoAP iOS apps available in the App Store.

Android app: CoAP Client
Register an account
Already have an account? Log in
(All fields are required unless specified optional)

  • 8 or more characters
  • Upper and lower case letters
  • At least one number or special character

Forgot your password?
Enter the email associated with your account, and we will send you a link to reset your password.