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.

Project description

The goal for this project is to create a simple GPS tracker, using the nRF91 Series SiP and LTE-M or NB-IoT to send the data to a server. You can use any application protocol (MQTT, CoAP). However, we highly recommend using CoAP to ensure compatibility over both NB-IoT and LTE-M and also to achieve a high level of power/data efficiency.

You will need to use the following nRF Connect SDK software modules to build your tracker application:

  • LTE link controller (lesson 2)
  • nRF Modem library (lesson 3)
  • Socket API (lesson 3)
  • MQTT library (lesson 4) or CoAP library (lesson 5)
  • GNSS interface (lesson 6)

Establish an LTE link

The simple GPS tracker needs to establish an LTE link to be able to send data to a server. Use the LTE link controller library to define an event handler for the link controller, and then use an API function to register the handler.

Hint: Take a look at what you did in Lesson 2 Exercise 2.

Connect to a server

To be able to send the GPS data, the application needs to connect to a server. Here you need to decide if you want to use MQTT or CoAP as the application protocol (or some other application protocol not covered in this course).

In Lesson 4 we covered using the MQTT library to establish a connection with an MQTT broker. If you want to use MQTT as the application protocol, take a look at what we did in Lesson 4 Exercise 1.

For CoAP, we covered how to connect to a CoAP server in Lesson 5. This is not implemented in the CoAP library, so you need to get the IP address of the CoAP server, open a UDP socket and connect to the CoAP server. This was covered in Lesson 3 Exercise 1, and again in Lesson 5 Exercise 1.

Get a GPS fix

Before sending GPS data, we must first get a GPS fix. This entails enabling GNSS mode, defining and registering the GNSS event handler and starting the GNSS receiver to search for satellites and eventually get a valid fix.

In Lesson 6 Exercise 1 we practiced how to get a valid fix when the LTE modem was deactivated, and in Lesson 6 Exercise 2 we covered how to get a fix while the LTE modem is active, using the power saving techniques PSM and/or eDRX.

Depending on what you have available via your local network provider, you can either use what we did in Lesson 6 Exercise 1 and manually turn the LTE modem on when you want to send GPS data. Or, if you have either of the power saving techniques available, use what we did in Lesson 6 Exercise 2 to get a valid GPS fix while the LTE modem is active and sleeping.

Send data to a server

The implementation of sending data to the server depends on which application protocol you are using.

With MQTT, you need to publish the GPS data to a specific topic on the MQTT broker. With CoAP, you send a POST request to a specific resource in the CoAP server with the data.

Adding security

You can also encrypt the communication between your device and the server to make sure third parties cannot read the GPS data.

If you’re using MQTT, enable and configure the TLS functionality in the MQTT library and write the certificates to the mode, like we did in Lesson 4 Exercise 2.

For CoAP you will need to open a DTLS socket instead of a UDP socket, and write the PSK and the PSK identity to the modem, like we did in Lesson 5 Exercise 2.

Possible enhancements

Here are some suggestions for possible enhancements to your tracker, that we have not covered extensively in this course.

  • Faster TTFF: Assisted GPS (A-GPS) enables a faster TTFF. Implement A-GPS in your project to improve your trackers TTFF.
  • Faster TTFF and lower power consumption: Predicted GPS (P-GPS) provides up to two weeks of predicted assistance data to the device. It enables a faster TTFF, and also offers power saving by reducing the frequency of requesting new assistance data. Use P-GPS to improve your trackers TTFF and reduce its power consumption.
  • Make your tracker work indoors: GPS does not work inside buildings as it is difficult to get a GPS signal indoors. Modify the code to trigger cell-Based location services when the GPS modem fails to get a fix. You could use either Single-Cell LTE Location (SCELL) which gets the location of the closest cell to the tracker (accuracy 1000m) or Multi-Cell LTE Location (MCELL) which searches for all nearby cells to the tracker and triangulates it (accuracy 300m)
  • Remotely control the tracking frequency: Control the frequency of tracking remotely through CoAP. Create another CoAP resource on the server and program your nRF91 Series DK or Thingy:91 to observe this resource and update the tracking frequency accordingly.

We have several samples in our SDK that show you how to use A-GPS, P-GPS, SCELL, and MCELL

Submit project

Now that we’ve laid out all the building blocks, and some enhancement suggestions, spend some time trying to build the firmware yourself. If you need help, take a look at the next topic where we will show you one possible implementation of building such a tracker.

We encourage you to build on top of the knowledge you accumulated in this course and contribute to the community by sharing your project and tagging Nordic Semiconductor on social media or submitting it through the submit assignment button below.

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.