AWS Partner Network (APN) Blog
Building an Asset Tracking Solution Using LoRaWAN with Semtech LoRa Cloud and AWS IoT Core for LoRaWAN
By Gaurav Gupta, Principal Partner Solutions Architect, IoT – AWS
By Richard Fuller, Sr. Principal Engineer – Semtech
Semtech |
LoRaWAN is a leading protocol utilizing Semtech’s LoRa long-range communications technology for Low Power Wide Area Network (LPWAN) in battery-operated, remote monitoring, and control applications.
AWS IoT Core for LoRaWAN offers a fully-managed LoRaWAN network server and delivers highly scalable, reliable services for a wide variety of use cases.
LoRaWAN has been applied to a variety of applications including smart water metering, smart buildings, safety and compliance monitoring, smart agriculture, health monitoring, smart electrical metering, construction and mining monitoring, and smart homes.
One of the most critical applications where the low-power, battery-operated advantages of this approach is of greatest value is asset tracking. The low power and long range of LoRaWAN lend themselves to asset tracking applications in a complementary fashion.
Semtech’s LoRa Edge (LR11xx) chipset provides a comprehensive solution which solves for indoor and outdoor location by incorporating both GNSS for outdoor and Wi-Fi scanning for indoor location. It achieves this with 10x lower power than traditional GNSS-based solutions, using a combination of compute on the chip and cloud.
For GNSS, a partial almanac is automatically downloaded over the air and the balance is stored in the cloud. The device looks only for the satellites in the approximate geographic area where it is located (county, state). The geolocation solver chip-to-cloud solution splits the functionality of calculating the device’s position by scanning and sending the data to the cloud where it calculates the device location.
For Wi-Fi, the LoRa Edge solution scans for Wi-Fi SSIDs and sends these to LoRa Cloud, which returns a latitude/longitude value or resolves to a table of private indoor Wi-Fi SSIDs.
In this post, you will learn the core elements in an asset tracking application and how Amazon Web Services (AWS) and Semtech help lower the barrier to entry for developers looking to deploy solutions.
From the initial component outline, we’ll delve into the specific elements in each system that provide capabilities with little or no coding to show assets on a map. The operation of an example system will be shown using Semtech’s LoRa Cloud Geolocation Service that is built from generally available AWS services, and show you a complete asset tracking application with off-the-shelf hardware and connectivity options.
Introduction to Semtech LoRa Cloud
Semtech is an AWS Partner and leading supplier of analog and mixed-signal semiconductors for high-end consumer, computing, and communications applications.
Semtech’s LoRa Cloud includes modem and geolocation services with a Join Server to offer enhanced LoRaWAN device management and streamlined operations. The modem and geolocation services are composed of tools that help developers and system operators administer devices easily by handling many of the repetitive tasks, such as power consumption monitoring and firmware revision tracking, automatically and centrally.
In addition to modem and geolocation services, the Join Server streamlines the provisioning process by utilizing built-in cryptographic keys in the LoRa Edge chip itself to enable secure and fast onboarding of devices. While the focus here is primarily on the geolocation services, it’s important to note that LoRa Cloud capabilities extend beyond the location determination capability.
Figure 1 – LoRa Cloud services as part of the LoRa Edge asset management platform.
Integration with AWS IoT Core for LoRaWAN
By combining AWS IoT Core for LoRaWAN with Semtech LoRa Cloud, the development time and effort required to build a complete asset tracking application can be minimized.
A typical location application would employ a LoRaWAN network server, payload decoder, and application to call LoRa Cloud APIs, database, mapping, and application logic. Although you can piece together these building blocks yourself using different services and components, AWS IoT Core for LoRaWAN offers many of the essential components in one place. This collection of components can help you build applications faster and more reliably.
To make it easier to integrate LoRa Cloud with AWS IoT Core for LoRaWAN, Semtech has open-source sample code. The following diagram shows an example of integrating AWS IoT Core for LoRaWAN using its serverless functionality.
Figure 2 – Asset tracking architecture using AWS IoT Core for LoRaWAN and Semtech LoRa Cloud.
The sample application outlined above has three main functions:
- Provision tracker devices and LoRaWAN gateways.
- Process tracker device data into location solutions.
- Display location data for the end user.
The sample code addresses the processing of tracker device data. For more information on provisioning devices, see the AWS IoT Core for LoRaWAN documentation for device onboarding. To learn more about adding gateways, see the documentation. For more details on displaying data on a map, see Amazon Location Service.
As provided in the sample code, tracker devices are provisioned on AWS IoT Core for LoRaWAN and report their data through the attached gateway(s). An IoT rule is set up to pass data for the tracker devices to an AWS Lambda referred to as Application Server, which parses the message and determines whether it needs to be processed by the Semtech LoRa Cloud modem and geolocation services.
Messages are processed by the Semtech LoRa Cloud modem and geolocation services and returns a location estimate that is sent through an Amazon API Gateway to Amazon DynamoDB. Amazon API Gateway is then used to access and plot the location data on a dashboard, showing the status of the tracking device. This example shows how various AWS serverless tools can be used together to provide an end-to-end tracking system with LoRa Edge enabled devices.
Using Serverless to Develop a LoRa Cloud Asset Manager Solution
One of the main advantages of this approach is that the entire system can be brought to market in a completely serverless approach, where no direct infrastructure is employed. The power of this approach is that it can scale as needed.
During development, when the number of users is small, the costs go by individual usage. There are no up-front costs for establishing the servers or network necessary to begin your development. Also, when there is no usage of the system, the costs ramp down as well, unlike with fixed infrastructure.
After deployment, the capabilities will scale with load. There are no concerns about sharp increases in usage causing servers to overload or fail. This is all handled by the serverless architecture on AWS.
About Semtech LoRa Cloud Locator
Typically, to evaluate Semtech’s LoRa Edge solution you have to build a complete application just to see the “dot on the map.” This can be cumbersome, especially for those with limited cloud application development experience.
To help its customers easily try out LoRa Edge hardware, Semtech developed an application (LoRa Cloud Locator) to provide a simple application where you can purchase an off-the-shelf LoRa Edge sensor, sign up for the service, and quickly configure hardware on a LoRaWAN network.
The following examples will use the LoRa Cloud Locator user interface (UI) as an example to showcase building such an application using AWS managed and serverless services.
Adding a Gateway to the System
This system can provision any gateway qualified for AWS IoT Core for LoRaWAN. The list of supported gateways grows regularly and can be found in the AWS Partner Device Catalog’s supported gateways.
Adding a gateway in the Semtech LoRa Cloud Locator is quite simple:
- Click the Add New Gateway button.
- Fill in the required information for the gateway name/EUI and frequency band.
Figure 3 – Add gateway UI in Semtech LoRa Cloud Locator.
- Click the Create button to provision the gateway on the AWS IoT Core for LoRaWAN system. This generates the certificate and configuration information for the gateway and finally enable the download of the gateway configuration data.
- Download the certificate, private key, and server trust files to set up the target gateway with the instructions provided by the manufacturer.
Figure 4 – Download the gateway configuration data from Semtech LoRa Cloud Locator.
Once the gateway is provisioned and configured, it can be turned on and will connect to the network. When the gateway successfully makes its connection with the AWS IoT Core for LoRaWAN, its connection status will go from red to green.
Figure 5 – Connection status of gateway from Semtech LoRa Cloud Locator.
Adding a Tracking Device to the System
In a similar manner to a gateway, a tracking device can be added to this system. The list of supported devices will be added over time. The currently supported list of trackers can be found at locator.loracloud.com.
To add a device:
- Click Add New Device button.
- Fill in the required information; this includes but is not limited to its DevEUI, JoinEUI, AppKey (or PIN for LoRa Cloud Join Server), and Device Profile.
Figure 6 – Download the gateway configuration data from Semtech LoRa Cloud Locator.
- Click the Create button to complete the setup. The information is then used to provision the device on the AWS IoT Core for LoRaWAN.
Resolving Location with AWS IoT Core for LoRaWAN and Semtech LoRa Cloud
The LoRa Edge system works with LoRa Cloud where LoRa Edge tracking devices scan GNSS, Wi-Fi, or LoRa signals and report the measurements results to an LoRaWAN network server. From the LoRaWAN network server, scan data is passed to LoRa Cloud via application server. If a position can be computed, it’s returned to the application server.
For GNSS scans (involving GNSS NAV message), the process is described in the figure below.
Figure 7 – Call-flow of LoRa Edge tracking devices using GNSS scans.
Wi-Fi and LoRa scan information looks very similar to the above overall flow. It’s important to note in the case of GNSS scans that, along with the location data, the response can include aiding information that aids in future GNSS scan information.
Visualizing Trackers on the Asset Manager Dashboard
Once the device has joined the LoRaWAN network and the scan information is processed and sent to the LoRa Cloud via the application server, the position solution can be rendered. In this specific implementation, the server can render GNSS or Wi-Fi based solutions, with control over which is viewed (GNSS-only, Wi-Fi-only or both).
Connecting lines between the points can also be shown or hidden. Finally, you can control which devices are displayed or hidden.
Figure 8 – Asset Manager dashboard.
Conclusion
In the preceding sections of this post, the main elements of an asset tracking solution were outlined and how all of these elements could be developed with existing tools and services from AWS and Semtech.
An example solution was outlined that was developed using AWS serverless architecture and Semtech LoRa Cloud. This solution allows seamless scaling from concept design through development to large-scale deployment, without any concerns for the infrastructure to support it.
The sample application shown offers a flexible and simple solution that can be extended to asset management. By following the links to the setup and documentation, you can develop your own asset management solution easily.
Semtech – AWS Partner Spotlight
Semtech is an AWS Partner and leading supplier of analog and mixed-signal semiconductors for high-end consumer, computing, and communications applications.