Description
AWS IoT Core Integration is a software service that enables your LoRaWAN gateway to work with AWS IoT Core. This document will show you how to set up a LoRaWAN end-node and view its data on the AWS IoT Console. In addition, it’ll show you how to send a message from AWS IoT Console to the end-node as well.
Prerequisites
- A gateway from the RAK WisGate Edge series
- A node from the RAK WisNode or WisBlock series, or another LoRaWAN compatible node
- An AWS account
đź“ť NOTE: For this tutorial, the RAK7200 WisNode Track Lite is used as the end-node and RAK7268 WisGate Edge Lite 2 for the gateway. |
Set Up Environment for Evaluation
Set Up the Built-in Network Server
All the WisGate Edge Gateways are pre-configured in the Network Server mode of operation. If you want some modifications, creating the application and adding the device needed for this demonstration, refer to the Built in LoRa Server tutorial. It shows the detailed way on how to configure your gateway.
Integrate AWS IoT Core
AWS IoT Core is a cloud-based service that connects your "things" (devices, sensors, etc.) to other devices and AWS cloud services. AWS IoT provides software that can help you integrate your IoT devices into AWS IoT-based solutions. If your devices can connect to AWS IoT, the AWS IoT can connect them to the cloud services that AWS provides.
Create a Thing
To create a thing (add a device) in the AWS IoT console, navigate to Manage > Things and select Create Things.
You can choose to add a single device or multiple ones. For this demonstration, select Create single thing and click Next.
Give your thing a name and click Next.
To generate certificates for your thing, select the Auto-generate a new certificate (recommended) and click Next.
A policy is needed for your thing, hence click Create policy.
You’ll be automatically redirected to a new window. Click Secure then Policies.
Fill in the following fields, then click Create.
-
Name: A name for your policy. For this example, the name will be
My_policy
. -
Action: Type
iot:*
-
Resource ARN: Type
*
- Effect: Mark Allow.
Return to the previous window and refresh it by clicking the Refresh button. You will then see the newly created policy pop up in the list. Choose it and click Create Thing.
In the opened window, download all the certificates and keys, then click Done.
⚠️ WARNING: Save the downloaded certificates and keys, as they cannot be downloaded again if needed. |
Your thing is created. Now, you need to attach the policy you’ve created to it. Click on the name of your thing and navigate to Certificates.
Click on the Certificate ID. In the Actions drop-down menu, choose Attach policy.
Select the previously created policy and click Attach.
Configure Global Integration for the AWS Proxy
Now, you need to configure the global integration of the gateway for the AWS IoT Core. To do so, in the gateway's Web UI, navigate to LoRa Network > Global Integration. Then choose AWS IoT Core for the Integration Mode.
Fill in the following information:
- AWS URL - The URL for your things can be found in the Settings menu under the Endpoint in the AWS IoT console.
-
AWS Port – The port for the AWS IoT core. Fill the field with port
8883
. - CA Certificate – The certificate you've downloaded (see Figure 15).
- Vendor Certificate – The certificate you've downloaded (see Figure 15).
- Vendor Key – The key you've downloaded (see Figure 15).
Verify a Successful Integration
See messages from the device in the AWS IoT console
To see the messages from the end-node, navigate to the Test tab in the AWS IoT console.
In the Topic filter field, subscribe to all topics by typing #
to see the data (join, uplink, downlinks, etc.) from the node.
RAKwireless provides a decoder for all WisNode devices that are based on RUI. All WisNode devices support Cayenne LPP payload format, and it can be activated via the Web UI of the gateway. Navigate to LoRa Network > Application > Your_application > Edit > Payload Formats.
In the Payload Format drop-down menu, choose Cayenne LPP, then enable Only forward the parsed data object to receive only the data of the sensor. Click Save & Apply.
Send Messages to the Device
To send messages to the end-node, in the AWS IoT console, navigate to Test > Publish to a Topic.
Here you need to fill in the following:
-
Topic Name – The name of the topic to which you want to publish a message. Here is a template of the downlink topic the RAK Gateway uses
application/id/device/eui/tx
, where:- id – This is the ID of your application. It can be found in the LoRa Network > Application tab of the gateway’s UI.
- eui – This is the device’s EUI.
An example of a downlink topic would be application/6/device/60c5a8fffeXXXXXX/tx
.
-
Message Payload – The message that you want to send to the end-node. It must be in the format
{"confirmed":true,"data":"SGVsbG8=","fPort":10}
, where:- Confirmed can be true or false.
- The content of the data is the information you want to send. The information must be base64 encoded. This can be done with a converter.
- fPort is the port number where you send the data. The number can be 1-255.
You can send the message by clicking Publish.
The message can be seen in the Live Device Data of the node in the Web UI of the gateway.
Updated