Learn how to set up a LoRaWAN® end device with the RAK7268V2 Gateway to enable uplinks and downlinks with Amazon AWS IoT Core for IoT data and control.
Uplinks can be used to send sensor data, including temperature, motion, GPS, or energy readings. In contrast, downlinks enable remote control, configuration updates, alerts, and smart actions, such as switching relays or modifying device behavior based on cloud logic.
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
For this tutorial, the RAK19007 and a RAK4631 from the WisBlock Family as the End Node, and the RAK7268V2 WisGate Edge Lite 2 for the gateway.
Set Up Environment for Evaluation
Configure the Built-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. It offers software to help you integrate your IoT devices into AWS IoT-based solutions. If your devices can connect to AWS IoT, they can also connect to the cloud services provided by other providers.
1. To go to the IoT Core, from your Console Home, type in the search bar IoT and select the option IoT Core.
Create a Thing
2. To create a thing (add a device) in the AWS IoT console, use the navigation panel on the left side. In the Manage section, click the All Devices dropdown and then choose Things.
3. Click on the button Create things.
4. Select the number of things to add. For this demonstration, select Create single thing and click Next.
5. Enter a name for your item in the Thing Name field, then click Next.
6. To generate certificates for your thing, select Auto-generate a new certificate (recommended) and click Next.
7. A policy is required for your item. Click Create Policy.
8. You will be automatically redirected to the Security > Policies section in a new window.
9. Fill in the following fields, then click Create:
- Name: Enter a name for your policy. For this example, use RAK_Policy.
- Policy effect: Select Allow.
- Policy action: Choose * for all actions.
- Policy resource: Enter *.
10. Return to the previous window and refresh it by clicking the Refresh button. You will then see the newly created policy appear in the list. Select it and click Create Thing.
11. Select the newly created policy.
12. In the open window, download all the certificates and keys, then click Done.
Save the downloaded certificates and Public and Private keys, as they cannot be downloaded again if needed.
Your thing has been successfully created.
Configure Global Integration for the AWS Proxy
1. Configure the global integration of the gateway for AWS IoT Core.
2. In the gateway's web UI, navigate to LoRa > Configuration > Integration Interface Parameters.
3. Click on Enable Integration Interface and select AWS IoT Core as the Integration Mode.
4. Fill in the following information:
- AWS URL: You can now configure the endpoint and manage it, along with other domain settings, in a centralized location under the Connect section of the AWS IoT navigation. This information can be found in the Domain Configuration section.
- AWS Port: Enter port 8883 for the AWS IoT Core.
- CA Certificate: Use the certificate you downloaded (see Figure 15).
- Vendor Certificate: Use the certificate you downloaded (see Figure 15).
- Vendor Key: Use the key you downloaded (see Figure 15).
Firmware Configuration for the End Device
In this section, RAK19007 and RAK4631 are used from the WisBlock Family as the End Device.
1. Navigate to the examples in Arduino and search for LoRaWan_OTAA. The path is: Examples > RAK WisBlock RUI examples > Example > LoRaWan_OTAA.
2. Write your LoRaWAN parameters as follows:
- OTAA_BAND: The band used in your country; in this case, it is AU912.
- OTAA_DEVEUI: This can be found on the device itself, specifically on the RAK4631.
- OTAA_APPEUI: In this case, it is the same as the DEVEUI.
- OTAA_APPKEY: This key can be found on the LNS of the gateway.
3. After uploading the firmware, you will see how the end devices send data to the gateway and then to the AWS Console.
4. On the AWS topics, you can verify the connection by using the # topic, where the Uplinks will be displayed on the console.
Verify a Successful Integration
See Messages from the Device in the AWS IoT Console
1. To view 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 view the data (join, uplink, downlinks, etc.) from the node.
RAKwireless offers a decoder for all WisNode devices based on RUI. All WisNode devices support the Cayenne LPP payload format, which can be activated through the gateway's Web UI.
2. To do this, navigate to LoRa > Applications > Your_application > Configuration > Payload format.
3. In the Payload Type drop-down menu, select Cayenne LPP. Then, enable the option to Only forward data object to receive only the sensor data. Click Save Changes.
4. To send messages to the end node, navigate to the AWS IoT console and select Test > MQTT test client > Subscribe to a topic.
You need to fill in the following:
Specify a topic to publish to, for example, myTopic/1. This is the name of the topic to which you want to publish a message. Below is the template for the downlink topic used by the RAK Gateway: 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 is:
application/RAK_AWS/device/ac1f09fffe06XXXX/tx
Message Payload: This is the message you want to send to the end node. It must be in the following format:
{"confirmed":true,"data":"SGVsbG8gRnJvbSBSQUs=","fPort":10}
Where:
- Confirmed can be either true or false.
- Data: This represents the message content, which in this case is "Hello From RAK." The content must be base64 encoded. You can use a converter for this purpose.
-
fPort is the port number used to send the data, which can range
from 1 to 255.
5. Once everything is set up correctly, go to Publish a Topic to send the message.
6. The message can be viewed in the Live Device Data section of the node within the gateway's web UI.
If the process is done correctly, you can check that the downlink message appears on the end device in the Arduino Console.
|
|
Harold Duarte Harold is an electronics engineer and senior technical content writer at RAKwireless. He is passionate about learning and developing new solutions for IoT, making it #IoTMadeEasy. |
Changelog
-
Version 1 - How to Implement AWS Integration for WisGate Edge V2
- Date Published: 02/15/2023
-
Version 2 - How to Implement AWS Integration for WisGate Edge V2
- Author: Harold Duarte
- Reviewer: Caryl Enanor
- Date Published: 08/12/2025
Updated