DEV Community

Takahiro-Y01
Takahiro-Y01

Posted on • Edited on

3 2

How to connect "The Things Network(TTN V3)" and "AWS IoT Core".

This article will show you how to connect "The Things Network V3" and "AWS IoT Core".

1. TTN Settings

  • Select the application to connect from TTN, and select "AWS IoT" from "Integrations".
  • Then click on the "Deployment Guide".

Image description

  • Scroll down.
  • For "Select your AWS region", select your region.
  • Then click "Deploy for The Things Network" under "Community".

Image description

2. AWS Settings

  • Enter the TTN cluster address or TTN application ID.

Image description

  • See below for cluster address and application ID

Image description

Creating an API key

  • Select "API keys" from the TTN application and click "Add API key".

Image description

  • Make the settings as shown in the image.

Image description

  • Copy the created API key and paste it into the aws settings screen.

Image description

Image description

  • When the stack is created by aws, it will be as follows.
  • Creating the stack will take a few minutes.

Image description

3. Set up with AWS IoT Core

  • Log in to the aws IoT Core.
  • And if you check "Things", you can see that a new device has been added.

Image description

  • Let's check if the data can be obtained.
  • Enter "lorawan / #" in "MQTT test client".

Image description

  • After waiting for a while, the data will be earned.

Image description

  • However, this alone is not enough to extract only the variables you want.
  • Let's add a rule for the data format.
  • I use a distance sensor, so I try to get only the distance.

Image description

Image description

  • Edit the SQL statement.

Image description

  • These are the SQL statements I used.
SELECT end_device_ids.device_id AS device, received_at AS r_date, uplink_message.decoded_payload.distance AS distance FROM 'lorawan/A840414/uplink' WHERE uplink_message.decoded_payload.distance > 20
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Image description

Image description

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay