Step 1. Visit The Things Network website and sign up for a new account
Step 2. After logging in, click your profile and select Console
- Step 3. Select a cluster to start adding devices and gateways
- Step 4. Click Go to applications
- Step 5. Click + Add application
- Step 6. Fill Application ID and click Create application
Note: Here Application name and Description are not compulsory fields. If Application name is left blank, it will use the same name as Application ID by default
- Step 7. Click + Register end device
- Step 8. Click Enterenddevicespecificsmanually, andselect the Frequency plan according to your region. Also, make sure you use the same frequency as the gateway in which you will connect this device to. Select LoRaWANSpecification 1.0.2 as the LoRaWAN® version and RP001RegionalParameters1.0.2revisionB as the Regional Parameters version. These settings are according to the LoraWAN® stack of Wio-E5.
Step 9. While the Wio-E5 module is still accessible over the serial console, send the following AT commands on the serial monitor:
AT+ID=DevEui
to get your Device EUIAT+ID=AppEui
, to get your App EUIAT+KEY=APPKEY,"2B7E151628AED2A6ABF7158809CF4F3C"
to set the App Key
The output will be as follows:
Tx: AT+ID=DevEui
Rx: +ID: DevEui, 2C:F7:F1:20:24:90:03:63
Tx: AT+ID=AppEui
Rx: +ID: AppEui, 80:00:00:00:00:00:00:07
Tx: AT+KEY=APPKEY,"2B7E151628AED2A6ABF7158809CF4F3C"
Rx: +KEY: APPKEY 2B7E151628AED2A6ABF7158809CF4F3C
- Step 10. Copy and paste the above information into JoinEUI, AppEUI and AppKey fields. End device ID field will be automatically filled when we fill DevEUI. Finally click Register end device
Note: The JoinEUl (formerly called AppEUI) is a 64 bit extended unique identifier used to identify the Join Server during activation.
Step 11. Register your LoRaWAN® Gateway with TTN Console. Please refer to the instructions shown here
Step 12. Type the following AT commmands to connect to TTN
// If you are using US915
AT+DR=US915
AT+CH=NUM,8-15
// If you are using EU868
AT+DR=EU868
AT+CH=NUM,0-2
AT+MODE=LWOTAA
AT+CLASS=A
AT+ID
AT+LOG=DEBUG
AT+DR=US915
AT+CH=NUM,8-15
AT+JOIN
The output on serial monitor will be as follows:
Tx: AT+DR=US915
Rx: +DR: US915
Tx: AT+CH=NUM,8-15
Rx: +CH: NUM, 8-15
Tx: AT+MODE=LWOTAA
Rx: +MODE: LWOTAA
Tx: AT+JOIN
Rx: +JOIN: Start
+JOIN: NORMAL
+LOG: DEBUG 39325 LW ch 11
+LOG: DEBUG 39325 LORA TX, 904500000, SF7, 125KHz, 8, 20
+LOG: DEBUG 39326 LORA TX, 004648676E697369527F9B004220F1F72C059919FE1613
+LOG: DEBUG 44386 LORA RX, 925100000, SF7, 500KHz, 84
+LOG: DEBUG 44406 LORA RX, 202A3B887461ADDAB92932AF1275FBC501, -55, 10
+JOIN: Network joined
+JOIN: NetID 000013 DevAddr 26:0B:E8:E9
+JOIN: Done
If you see +JOIN: Network joined on your serial console, that means your device has successfully connected to TTN!
You can also check your device status on the End devices page
- Step 13. Type the following AT commands to send data to TTN
// send string "HELLO" to TTN
Tx: AT+MSG=HELLO
Rx: +LOG: WARN 62228 LW tx 9, 48454C4C4F(5)
+MSG: Start
+LOG: DEBUG 62229 LW ch 15
+LOG: DEBUG 62229 LORA TX, 905300000, SF10, 125KHz, 8, 20
+LOG: DEBUG 62229 LORA TX, 4073E10B2680000009ABC353E64E77D4C7E6
+LOG: DEBUG 67560 LORA RX, 927500000, SF10, 500KHz, 14
+LOG: DEBUG 67660 LORA RX, 6073E10B268A00000330020071033000FF01157CBF7F, -67, 7
+LOG: DEBUG 67660 LW MACCMD, RX, 0330020071033000FF01
+MSG: FPENDING
+MSG: RXWIN1, RSSI -67, SNR 7.0
+MSG: Done
// send hex "0101101"
Tx: AT+CMSGHEX="0101101"
Rx: +LOG: WARN 55830 LW tx 9, 00101101(4)
+CMSGHEX: Start
+CMSGHEX: Wait ACK
+LOG: DEBUG 55831 LW ch 13
+LOG: DEBUG 55831 LORA TX, 904900000, SF10, 125KHz, 8, 20
+LOG: DEBUG 55831 LORA TX, 80E9E80B26800000096D68B06077383AB2
+LOG: DEBUG 61162 LORA RX, 926300000, SF10, 500KHz, 14
+LOG: DEBUG 61262 LW MACCMD, RX, 0310020071031000FF0106
+LOG: DEBUG 61262 LORA RX, 60E9E80B26AB00000310020071031000FF0106FA613910, -74, 7
+CMSGHEX: FPENDING
+CMSGHEX: ACK Received
+CMSGHEX: RXWIN1, RSSI -74, SNR 7.0
+CMSGHEX: Done
For more information about AT Commands, please refer to LoRa-E5 AT Command Specification
Upload Data from TTN to DatacakeCreate a Datacake Account
1) Create a new account, website: https://datacake.co/
2)Add the Wio-E5 on Datacake
3)Choose “LoRaWAN”.
4)Select New Product
5) Click the “Account Setting” → “API Token” → Get API token
In this par we will show you how you connect the The Things Stack LNS, which powers The Things Network v3 and The Things Industries, to Datacake and how you set up the configuration for both Uplinks
6)Create Integration on TTI
On your TTI Application select Integrations on the Side-Bar
7)Navigate into the "Webhook" Section of the Integrations on your Application
Add a new Webhook by clicking the Button "+ Add webhook"
8)This will show you a list of available webhook-templates you can chose from:
9)Chose the "Datacake" Webhook Template
10)Your browser will show you the following page
Now we need to create an API Key on Datacake for Webhook Authentication
Navigate over to your Datacake Workspace and select "Members" from Sidebar:
In the members section you select "API Users" from Tab-Bar
After switching to the API Users Tab you click on the upper right Button "Add API User"
This will show you the following dialog:
First of all enter a name for your API User (like "TTI Webhook API User")Next select "Devices" from Workspace Permissions List
Click on "Add Permission for all Devices in Workspace"
The following element will be added to the modal:
Here you select "Can record measurements"
Press "Save" to create the Token
This API Token is now valid for all devices in your workspace. Everytime you create a new device, this Token does automatically work for that device.
If you are interested in creating a Token for selected Devices only, you can navigate into the device and select the token from there. But you have to leave out the "All devices in workspace"-Permission here.
Next copy the Token from Datacake (click on the "Show" Button to see and copy the Token)
Now switch back to your Application on TTI:
Paste the copied Token into the field "Token"
Create Datacake Webhook on TTI by clicking on the "Create datacake webhook" Button
DownlinksIn order to be able to queue up Downlinks on your TTI Application you need to provide additional detail on your Datacake-Device. To set the configuration please move into the LoRaWAN settings on the corresponding device:
When you scroll down a little bit you get to the following section.
As mentioned in the screenshot please click on "Change" to open up the configuration for Downlink Configuration. This will bring up the following dialog:
In this Dialog you need to fill in the 4 textboxes with Information that you find on the TheThingsStack Console.
TTI Dev-ID
This is the ID of your Device in your TTI Application. You find it here:
TTI Server URL
This is the URL of your TTI Instance as available to the public.
For public TTNv3: eu1.cloud.thethings.network
Example: datacake.eu1.cloud.thethings.industries
(Datacake TTI URL)
TTI Application IDThis is the ID of your Application on TTI:
TTI Api Key
Create TTI API Key
To create a new API Key on TTI head over to the "API keys" page using the left sidebar:
Now click on "Add API Key"
The following dialog will appear:
Set a custom name (like "datacake-api-key")
And set corresponding rights to allow queuing up downlinks
Create the API Key by clicking on "Create API key"
After you created your API Key you will see the above notification
Please copy your key to your clipboard as it will only be shown once!
Paste this key into the device settings on Datacake
Final Settings
When you are done copying the dialog show look something like this:
Update and Save
Please don't forget to press the Update button when done setting the new Downlink Settings:
Copy your Payload Decoder to here.
The data sent using the AT command is uploaded to the DATACAKE platform.
Comments