Continuous Asset Tracking with External GPS and Immediate Location Sync
Introduction
This sample app aims to provide guidance for developers who are designing asset tracking functionality into their connected products. Specifically, how to build a responsive cloud-connected asset tracker that ignores power management and instead focuses on low-latency of both ascertaining GPS location values and syncing collected location data with the cloud.
Wireless Connectivity with Blues
This sample app is built around the Blues Notecard and Blues Notehub.
The Blues Notecard is the easiest way for developers to add secure, robust, and affordable pre-paid wireless connectivity to their microcontroller or single-board computer of choice. Notecard is a System-on-Module (SoM) that combines pre-paid data, low-power hardware (~8μA-12μA when idle), and secure communications. It acts as a device-to-cloud data pump to communicate with the Blues cloud service Notehub.
Notehub is the Blues cloud service for routing Notecard-provided data to third-party cloud applications, deploying OTA firmware updates, and securely managing fleets of Notecards. Notehub allows for secure communications between edge devices and the cloud without certificate management or manual provisioning of devices.
General Information
System Hardware
Component | Purpose |
---|---|
Blues Notecard Cellular WBGLW | Wireless connectivity module enabling device-to-cloud data syncing. |
Blues Notecarrier A | Carrier board for connecting Notecard to GPS/GNSS breakout module. |
Adafruit Ultimate GPS Breakout or Quectel L86 | Examples of compatible external GPS/GNSS module. |
Tadiran TLP-93111 Li-SOCl2 Battery | Example of a portable high capacity power source. |
Note: There are no strict requirements on the above components. For instance, any Notecard Cellular or Notecard Cell+Wi-Fi may be substituted.
List of Acronyms
Acronym | Definition |
---|---|
SoM | System-on-Module |
GPS | Global Positioning System, a satellite-based radio navigation system |
GNSS | Global Navigation Satellite System is a generic term describing any satellite constellation that provides location services |
Summary
Asset tracking is one of the more common and time-tested mobile IoT use cases. Often built with off-the-shelf components including a low-power host MCU, GPS/GNSS module, and some type of ubiquitous wireless connectivity option, asset trackers are becoming commoditized in the industry, yet still generally have a high cost of ownership due to recurring wireless connectivity fees.
The Notecard is a unique SoM to build around for asset tracking, as it incorporates not only a cellular and/or Wi-Fi radio module, but is extremely low power in nature, idling at ~8μA-12μA. The Notecard API is also flexible enough to allow for programming of the Notecard's onboard STM32 microprocessor to perform asset tracking functions without the usage of an external host MCU. This makes it an ideal candidate for low-cost and low-power asset tracking scenarios where the asset may not move for hours or days at a time.
Another convenient feature of the Notecard Cellular or Cell+WiFi is its integrated GPS/GNSS module. However, in low latency scenarios such as this, it's important to note the cellular radio and GPS/GNSS module cannot be enabled concurrently. Hence the usage of a separate, external, GPS/GNSS module in this sample app.
Requirements
- Ascertain the location of an asset that is either in motion or has recently completed motion within 1-2 minutes.
- Relay accumulated location data points to a cloud endpoint immediately, on a consistent cadence.
- Assume power consumption is not an issue. While options vary, power source options include line power via USB, LiPo battery with supplemental solar power, and/or usage of a Tadiran Li-SOCl2 battery.
Technical Implementation
Hardware Wiring
The external GPS/GNSS module must be wired to the Notecarrier via the following pins:
Notecard | External GPS/GNSS Module |
---|---|
VMAIN | 3V3 |
GND | GND |
AUXRX | TX |
AUXTX | RX |
As this scenario does not require coding of firmware for deployment to a connected host MCU, the following is a set of Notecard API commands used to configure a Notecard directly using either the Notecard CLI or the In-Browser Terminal.
When scaling deployment of Notecard API commands to fleets of devices, use of the Notecard CLI with a setup script is highly recommended.
Link Notecard to Notehub Project
Every Notecard must be associated with a
cloud-based Notehub project. This is accomplished using
the hub.set API. The
arguments in this command tell the Notecard to place the cellular radio into a
continuously connected state, thus reducing latency when connecting to the
cloud, and to sync any pending stored data every 1 minute (the outbound
argument). The inbound
argument is optional and tells the Notecard how often,
in minutes, to query for any inbound commands/data from Notehub.
{"req":"hub.set","mode":"continuous","product":"<your-product-uid>","outbound":1,"inbound":240}
The card.aux.serial API tells the Notecard to look for, and use, an external GPS/GNSS module via TX/RX.
{"req":"card.aux.serial","mode":"gps"}
Next, the Notecard needs to know that the location should be sampled and updated continuously, but only when the device is in motion.
{"req":"card.location.mode","mode":"continuous"}
Whether or not a device is idle is automatically determined by the Notecard's onboard accelerometer. The sensitivity of measurement can optionally be configured with the card.motion.mode API to be more or less sensitive to movement based on the products' needs.
As soon as a change in location is recorded on the Notecard, initiate a cloud
connection with Notehub and sync data via the
_track.qo Notefile. In addition,
set a heartbeat
to occur every 4 hours, which will make sure the Notecard
continues to "phone home" at least once every 4 hours if the device is idle for
an extended period.
{"req":"card.location.track","start":true,"heartbeat":true,"hours":4,"sync":true}
Potential Issues
- GPS/GNSS module antennas generally need a clear view of the sky for optimal functionality.
- Cellular connectivity can vary based on physical enclosure and geographic region. Consult this guide on Diagnosing Cellular Connectivity Issues for more information.
Expected Results
With the Notecard properly configured and deployed in a location with cellular connectivity and a clear view of the sky, data should begin syncing with Notehub on a regular cadence (while the device is moving).
For example:
{
"body": { ... },
"best_location_type": "gps",
"best_olc": "86JQQ972+FQ2H",
"best_when": 1674749529,
"best_lat": 42.2636375,
"best_lon": -84.24809765624,
"best_location": "Lansing MI",
"best_country": "US",
"best_timezone": "America/Detroit",
"where_olc": "86JQQ972+FQ2H",
"where_when": 1674749529,
"where_lat": 42.2636375,
"where_lon": -84.24809765624,
"where_location": "Lansing MI",
"where_country": "US",
"where_timezone": "America/Detroit",
}
Routing Data to a Cloud Application
A key value of Notehub is the ability to route data to third-party cloud applications. Consult the Routing Data with Notehub documentation for more information on creating cloud-based dashboards and visualizations of accumulated data.