Because of its accuracy, GPS/GNSS has long been the de facto standard for device and asset tracking. But GPS/GNSS can struggle in indoor locations, where it may have trouble finding the necessary satellite signals to use to calculate a location.
That’s where Wi-Fi triangulation, a newer technology that uses the signal strength of known Wi-Fi access points to triangulate a location, can help. Unlike GPS/GNSS, Wi-Fi triangulation works indoors, and in many cases is more accurate indoors, as its triangulation becomes more accurate as it is able to detect more access points.
Together GPS/GNSS and Wi-Fi triangulation provide a robust tracking offering that works nearly everywhere—indoors and outdoors.
Here at Blues we make the Notecard Cell + WiFi, a system on module that offers not only cellular connectivity, but also GPS/GNSS and Wi-Fi triangulation in one offering.
In this article we’ll look at how to use both GPS/GNSS and Wi-Fi triangulation with the Notecard, and the best way to combine the two to get the most accurate location of your device. Let’s start with how GPS/GNSS works on the Notecard.
The Notecard Cellular and Notecard Cell+WiFi both have integrated GPS/GNSS modules for retrieving a satellite-based location.
GPS/GNSS is off on the Notecard by default, but you can enable it with two simple API requests. The first,
card.location.mode, configures how often to take GPS/GNSS readings. The example below configures the Notecard to take readings every five minutes.
card.location.track, starts and stops the GPS/GNSS tracking process. The example below starts GPS/GNSS tracking.
Once enabled, you’ll begin to see
_track.qo events in Notehub.
If you double click to view the details of an individual event, you’ll see the full data associated with the event, which includes the GPS/GNSS fields appear with a
where_ prefix, for example
And, that’s all required to set up GPS/GNSS tracking on a Notecard! There’s a lot more you can do to configure how GPS/GNSS works, but with those two simple commands you can have a fully functional GPS/GNSS-based tracker up and running.
The way Wi-Fi triangulation works with Blues depends on the type of Notecard you have. If you’re using a Notecard WiFi or Notecard Cell+WiFi, Wi-Fi triangulation is enabled by default and just works.
If you’re using the Notecard Cellular you must use an external Wi-Fi module and the Notecard’s
card.triangulation request. This documentation article walks through the process of setting that up.
Once enabled, you’ll first see a
_geolocate.qo Note appear in Notehub in your Events view. The Note will have information about all Wi-Fi access points and their signal strength.
Once Notehub has this access point data it’ll perform a Wi-Fi triangulation, and subsequent Notes will include the device’s triangulated location. For example, the same
_track.qo Note from earlier in this article also includes a triangulated location under fields with a
tri_ prefix, such as
Once you have the basics of Wi-Fi triangulation working, there are a few settings you may want to tweak for your projects.
First, depending on your requirements you may also need to change the frequency at which triangulation data is processed on Notehub. The default is “Daily”, which means at most Notehub will calculate the triangulated location of your device once per day. This option is available in the Settings of your Notehub project.
Wi-Fi triangulation in Notehub is provided as a technical preview feature that is free for use today, but may use Consumption Credits in the future. Blues reserves the right to rate limit excessive Wi-Fi triangulation requests at our discretion.
Second, by default Notehub only triangulates a device’s location when that device is not in motion (as determined by the Notecard’s onboard accelerometer). You can override the Notecard’s default behavior with the
Finally, Notehub only triangulates a device’s location at the beginning of a new Session. If your Notecard is operating in periodic mode this is determined by your device’s
outbound value, and if your Notecard is operating in continuous mode this is determined by your device's configured
Once you have your settings configured as you like, let’s next look at how to put everything together and use multiple locations in one project.
Once you have both GPS/GNSS and Wi-Fi triangulation configured, all events in Notehub will include both a satellite- and Wi-Fi-derived location in their metadata.
For some applications you may wish to store and display both locations. For those apps getting your location data is as simple as routing the data to your cloud service of choice, and retrieving the GPS/GNSS data out of each event’s
where_ fields, and the Wi-Fi triangulated data out of the event’s
In other applications you may not care about having multiple locations, and instead want to know which one is “best”. For these situations Notehub provides a
best_ field on all events. For example, notice how the event below contains both a GPS/GNSS location (
where_), a Wi-Fi triangulated location (
tri_), and a “best” location (
In this example the best location is the GPS/GNSS-derived location, and as such the
best_ fields are identical to the
where_ fields, and the
best_location_type is set to
Notehub’s algorithm for determining the best location is to choose GPS/GNSS location, then triangulated location, and then the location of the cell tower that handled the request (
tower_). However, if enough time has passed (a few days by default) Notehub will consider a location stale. For example, if a device’s last-reported GPS/GNSS location was from four days ago, and the device has a recent triangulated location, Notehub will select the triangulated location as best.
If you don’t want to rely on Notehub’s algorithm you can do a time-based comparison yourself to determine which location makes the most sense for your project to use. For example, if you want to use the most recently retrieved location (regardless of type), you could use the following JSONata on your route.
"best_lat": tri_when > where_when ? tri_lat : where_lat,
"best_lon": tri_when > where_when ? tri_lon : where_lon
Overall, the Notecard makes it trivial to retrieve both the GPS/GNSS and Wi-Fi triangulated location of a device in an incredibly configurable way. And by combining the two technologies you can build a resilient tracker that works whether a device is indoors, outdoors, or some combination of the two.