How To Implement AWS Integration for WisGate Edge V2

KHM-08-00.png

Overview

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 V2 series
  • A node from the RAK WisNode or WisBlock series, or another LoRaWAN-compatible node
  • An AWS account
đź“ť NOTE: For this tutorial, the RAK7204 WisNode Sense is used as the end-node, and RAK7268V2 WisGate Edge Lite 2 is for the gateway.

Set Up Environment for Evaluation

Set Up the Build-in Network Server

All WisGate Edge V2 gateways are pre-configured in the Network Server mode of operation. If you want to make modifications, create the application, and add the device needed for this demonstration, refer to the WisGate OS 2 User Manual. It shows the details of the Built-in Network server configuration.

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, 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 All devices > Things and select Create Things.

KHM-08-01.png

You can choose to add a single device or multiple ones. For this demonstration, select Create single thing and click Next.

KHM-08-02.png

Give your thing a name in the Thing name field and click Next.

KHM-08-03.png

To generate certificates for your thing, select the Auto-generate a new certificate (recommended) and click Next.

KHM-08-04.png

A policy is needed for your thing. Click Create policy.

KHM-08-05.png

You’ll be automatically redirected to Security > Policies in a new window.

KHM-08-06.png

Fill in the following fields, then click Create.

  • Name: A name for your policy. For this example, the name will be My_policy.
  • Policy effect: Mark Allow.
  • Policy action: Choose * for all actions.
  • Policy resource: Type *.

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.

KHM-08-07.png

In the opened window, download all the certificates and keys, then click Done.

đź“ť NOTE: Save the downloaded certificates and keys, as they cannot be downloaded again if needed.

KHM-08-08.png

Your thing is created.

KHM-08-09.png

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 > Configuration > Integration Interface Parameters. Click on Enable Integration Interface and choose AWS IoT Core for the Integration Mode.

KHM-08-010.png

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.

KHM-08-011.png

  • 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).

KHM-08-012.png

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 > MQTT test client tab in the AWS IoT console.

In the Subscription topic 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 > Applications > Your_application > Configuration > Payload format.

In the Payload type drop-down menu choose Cayenne LPP, then enable Only forward the parsed data object to receive only the data of the sensor. Click Save changes.

Send messages to the device

To send messages to the end-node, in the AWS IoT console, navigate to Test > MQTT test client > Publish to a topic.


Here you need to fill in the following:

Specify a topic to publish to, e.g. myTopic/1 â€“ 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/application_name/device/eui/tx, where:

  • application_name – This is the name of your application.
  • eui – This is the device’s EUI.

An example of a downlink topic would be application/My_application/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 to topic.

KHM-08-016.png

The message can be seen in the Live Device Data of the node in the Web UI of the gateway.

KHM-08-017.png

Updated