Wiki source code of Dragino-CloudStudio-Tutorial

Version 134.2 by Mengting Qiu on 2025/08/14 19:00

Show last authors
1 **~ Table of Contents:**
2
3 {{toc/}}
4
5
6
7
8 = 1. Introduction =
9
10
11 This guide provides step-by-step instructions for integrating Dragino LoRaWAN devices with the Cloud Studio IoT platform using The Things Network (TTN) as the network server.Cloud Studio IoT supports other LoRaWAN network servers like ChirpStack, Loriot, AWS IoT, Actility, Helium, and Orbiwise as well.
12
13
14 = 2. Prerequisites =
15
16
17 Before starting, ensure you have:
18
19 * A Dragino LoRaWAN device (e.g., LHT65N, S31-LB, PS-LB, etc.).
20 * An account on The Things Network (TTN).
21 * An account on Cloud Studio IoT.
22
23
24
25 = 3. Register the Device in The Things Network (TTN) =
26
27
28 == 3.1 Create an Application in TTN ==
29
30
31 You must first have an account in The Things Network (TTN). Once logged in, the first step is to create an application in TTN. This creates a space where your devices will be grouped.
32
33 (% style="color:blue" %)**Step 1: **
34
35 Log in to your TTN Console.
36
37 Navigate to Applications in the left menu and click Add application.
38
39 [[image:AD_4nXfHqy9yfnmGJMemFCARh7a1yHir9Sw9e-5dtO5SffOxRDJM2GakvAoct-OZBNDhjXy0E75nGt0nORsdUAWCJcAQ3sh6LIg0KDB9HW35qW4W5pRMopZxcl4nogb3YRxK9gsissGpbQ||height="242" width="927"]]
40
41 (% style="color:blue" %)**Step 2: **
42
43 Fill in the required fields and click Create Application.
44
45 [[image:AD_4nXfyL_g6JiKtkY1r4xEjq_nU6PEeIYtSwcQy0wFnNx5n0dzptYnCgwSKl_FgS0EjND931clQQvaNYPx4wAVwRlD3byx0-OFozQAdqarWAi2C80SMl6-HvWS-32hS4kYaEGMYHB3yvw||height="501" width="556"]]
46
47
48 == 3.2 Register your Dragino device ==
49
50
51 This is a virtual representation in TTN of the physical device you want to integrate.
52
53 (% style="color:blue" %)**Step 1: **
54
55 In your TTN application, go to End devices and click Register end device.
56
57 [[image:AD_4nXeJEQuEERXILO4GWROFEj7eALLLMPfzZAFiD2okV6u2v6ZoYXfjmcx6IHC4TG7mc0edCztyWO24gCiVQtT6r9Wfn5OCFIBDOBAUKMCtGYzMhxqoCL0rG5vrWSz321YewiZMe1_5jg||height="539" width="567"]]
58
59 You can add your device in two ways:
60
61 * Selecting it from the repository (brand, model, hardware version, firmware version, and profile region)
62 * Adding it manually (If your device is not listed, enter the details manually (requires correct frequency plan and LoRaWAN version).
63
64 For this example, we will select it from the repository.
65
66 (% style="color:blue" %)**Step 2: **
67
68 Each Dragino device is shipped with a sticker, and all required credentials are printed on it.
69
70 [[image:1755162968187-879.png||height="268" width="447"]]
71
72 Further down, you'll need to enter the (% style="color:#037691" %)**JoinEUI**(%%) — a unique identifier provided by the manufacturer, used for OTAA (over-the-air activation), the process by which the device joins the LoRaWAN network.
73
74 [[image:AD_4nXfMnziRfzaI4Ynw2z7cntE13mPEe5Lh7Qq1FPbrktzqbw2mY_NJMo0fqfwvq0EuvE38z4SqZ9UFKUXTFpftggS6a1y5bFl255TGrT0L5p-o2n9LDTcEa4FozCbKNjzEfGkHvVtWbQ||height="471" width="978"]]
75
76 (% style="color:blue" %)**Step 3: **
77
78 When you click Confirm, you will see additional fields to complete:
79
80 (% style="color:#037691" %)**JoinEUI:**(%%) AppEUI on the sticker.
81
82 (% style="color:#037691" %)**AppKey:**(%%) Used for OTAA activation.
83
84 (% style="color:#037691" %)**End device ID:**(%%) Created by you to identify the device in the application.
85
86 (% style="color:#037691" %)**Label:**(%%) Optional; for grouping devices by tags.
87
88 Click Register end device.
89
90 [[image:AD_4nXfK8MDKf1sDac6wvjwwIhWWUTUop64icr1iwu-wv3e4QKLk-M0fv_LduKu8tuCKISKD6yTfYflcJhPKmrNzvn0JNEYORK_567Lul9QPy62grCUT0Rgj0LzPZTqmVnn1yzFG3mro||height="603" width="567"]]
91
92 (% style="color:blue" %)**Step 4: **(%%)Power on the device and verify that it sends data by checking Live Data in TTN.
93
94 Once created, you can power on the device and check if it's sending LoRaWAN data. TTN should display the received packets under Live Data.
95
96 [[image:AD_4nXfT4Vt1IXk4znjHjfbzG84fqd1r1G5Vz4JvyVgmUSzMBLj5DJeamkipnMoN1AAdOljjG3EaNMc8hAY9OIFb09VJ4ViHfyIap9ALSewcUIkNwvKxU80MSSNBnjkNGrXpfrPIf9FCFw||height="359" width="756"]]
97
98 [[image:AD_4nXeLxVFDP93c-2Gs3elsHdSm_mntfJJq5RT_GO2ibC21U0cPEtXJFyVFX5iNQuFxqakUqD3xyxE0z6IaQyCAQNfovnVZhlOHiddrRd14k1zyR8soTxvmSL-CKVxsfV8oVALr_yUqUg||height="592" width="602"]]
99
100
101 = 4. Create the integration between TTN and Cloud Studio IoT =
102
103
104 This step allows TTN to forward the received data to Cloud Studio IoT.
105
106
107 == 4.1 Set Up a Webhook in TTN ==
108
109
110 (% style="color:blue" %)**Step 1: **(%%)In your TTN application, go to Webhooks and click "Add webhook".
111
112 [[image:AD_4nXeg_LbwZkwREu_ZHdsBdOuRQJeNyjSGaRQB4RYeMxJjYZ2QuA1rpcLJ3xQgzeRg5aPYMLoY4wRuVpzZssEyBjSpgy1lRtw8Zu4ukxx6MAbYOQe5ZpMJ-C1S7X3HncySJFSsZULRbA||height="293" width="847"]]
113
114 Select Cloud Studio IoT from the list of available webhooks.
115
116 [[image:AD_4nXdo4RFJxKn4xqcpKdEx_pr1d0XWAfWfjXhDTjlgeR-Fwcih7Tb6JUJyFUTsot34LLbt6XqlLq8oBR6SZdqA5g35syZN1wiaNGUATtznI4xV5iZTAPIJwv-26UR6UYkBgNhC2xm3||height="272" width="568"]]
117
118 (% style="color:blue" %)**Step 2:**(%%) Enter the Access Token (generated in Cloud Studio IoT) to authorize data forwarding.
119
120 You will then need to enter the Access token — provided by Cloud Studio IoT — which authorizes TTN to send data to your Cloud Studio account.
121
122 [[image:AD_4nXe2OoVuhYjkHournyI5R_nJUGxnRyqMxMMK96FTXzNl0l5bvEUACHmug4nAVFBDDPk29mwANWIg2rr3ZtU6TywyN6LS4aolNDbZdCuhyT_tE3PBXzLzSb-mShA-Uwn-i-ktzn0j||height="688" width="264"]]
123
124 After generating the token in Cloud Studio IoT, paste it into the corresponding field in TTN when creating the webhook.
125
126 [[image:AD_4nXfalXIosRpqOOko2Cb8q1Y8SjOCMrr-k8uEyyLw7yOCBoANr6DxhdHdph2ZwOTZyALElh2ErNeb5E9C1yWMZH0G05IQD4b86zU9dVRRDAhMFUDb0gjLr3csWpg4DkBJCuGZczF8RA||height="509" width="424"]]
127
128 Click Create Cloud Studio webhook.
129
130 [[image:AD_4nXeE63TPfG-VwlrSOkwWvxDlqkh9xQbyeF4Mc31kNypRn5PRTDl57DW9amFTBX5wYSTyfqxme1mg_MKTBU397l4AoLo79nOK0vuG0z341GEiP8fCXiUleQGCACGXrqO9c5Ts0iKvqw||height="135" width="669"]]
131
132
133 == 4.2 Add the Device in Cloud Studio IoT ==
134
135
136 (% style="color:blue" %)**Step 1: **(%%)Navigate to Manager and add the device.
137
138 In the Cloud Studio IoT application (Gear), under Manager, add the device:
139
140 * Enter the (% style="color:#037691" %)**DevEUI**(%%) you registered in TTN.
141 * Fill in (% style="color:#037691" %)**Latitude **(%%)and(% style="color:#037691" %)** Longitude**(%%) to visualize the device on the Cloud Studio IoT map.
142
143 [[image:AD_4nXeVmw9r-ApdwDx398NG-ohKscIBY734ZEahlPNgf4kI_FmLwZMzkpHsFwsQX49KFYVyhZX1JSOfSAEpjtseHa952Cs-_MKnNUAOUs2Pa17oUxBMbef88c1O9d9bU75fxmkqwEBt0A||height="418" width="871"]]
144
145 [[image:AD_4nXc5RC0Z3FQBLajbSqQ31hJtYXwCWsK_szldtZz3wwG_s5gEMEbyUI9e0RaAVOs6u3qptzbzV8s15RZtwRLQiO5NdAic0h5GdnaKtKwJ1GgIR8XCIp4AW-GGgAfQdUruu2HW7J3CIg||height="425" width="864"]]
146
147
148 (% style="color:blue" %)**Step 2: **
149
150 You can now verify that:
151
152 * The LoRaWAN device is sending uplink data to TTN (uplink_message events under Live Data).
153 * TTN is forwarding data to Cloud Studio IoT via the webhook.
154
155 In Cloud Studio IoT, go to Devices → Real-time log to see messages received from TTN.
156
157 [[image:AD_4nXdMBEPPw1jRk1XMIp8x-pQjaQAREIHnjbqOhrcXyNtyY0sSl9FcpQoxPsZcIbqoPijyyw9YBv8uwnv5dwzewZvYNV-trG_XWhA8vevCXRkXKDmRyYwEzewJjIXl0U_2dTrcVGL_eQ||height="549" width="191"]]
158
159 [[image:AD_4nXdN6ymB6PhlyoUwy3yj9kPXJ2_IN3zRrEychXCQ6xgihuJwwHzmMynRc1nHkV8WwWuabSbYS30nVruNIEAdlpnfliYzgk2RU16QJlbNgQz35s8si2ELKE2cBAIdLii6QzS3uCDD||height="386" width="904"]]
160
161
162 (% style="color:blue" %)**Another situation**
163
164 If your device model is not already registered in Cloud Studio IoT, you can add it by:
165
166 * Clicking Add, entering the brand, model, and optionally attaching an image.
167 * Choosing an icon and clicking Save.
168
169 [[image:AD_4nXe1f-rm_kT1YF6ymiaV7ki_3Kmdj9ef58c5zaH7-FiBrSIaIEmA3k6V2Zgkf3OasVAnn5YO8xHDlEFzYIEH_flLlRfwHFBuPUEM5UZhD69wqlmPZ_NdVD036smVX7leQNNuPxV0Vg||height="349" width="687"]]
170
171 [[image:AD_4nXfcoPEQwiPJNvJGwxv2rsZkgpaPcCAVUqNvbxe2vzZiXOPCdJYpzpjoORDoucGnP2QlYoFzlAz0MadTA85bMOykUrE1-vIVVMZ-UF64aWyodeiWR2tghc9xmcJmFXSVVctqkC5KNw||height="332" width="696"]]
172
173
174 = 5. Configure Payload Decoding =
175
176
177 Next, configure the configuration script and payload converter script:
178
179 * Edit the device
180 * Go to Scripts
181 * Under each script type, click View more to enter the corresponding JavaScript code.
182
183 [[image:AD_4nXdBmlRB1kJHR_TRGbB2LTUK6dbbVPxn4Xkh53wCr1dgTt78ChkL52crfabgXw5IRuW8C8QXKem_cRaay2c9BnIVmchesxJ8B7uAKp63eQq8L747UtRgx2r39Aw67KoR3DpqrDaMBw||height="427" width="842"]]
184
185 [[image:AD_4nXcKri-yTs37xi-q5i495EwnQz7cT1-LBbL03R6iiGkY2A-8Iw6HsyGeThHIDE3myvOpciRkNpRWqFWyVpwu0Ob_yigD45iOwELSFqt6s_PSNrrVCQ_aMsi__4SEdcCnqbW4L4UBBQ||height="393" width="839"]]
186
187 [[image:AD_4nXcuW3TbeJcNFxhfjCWkxf8jPSrk2gvtnCirf5YMQlOqX9xIjkeZRm2k5ePI8wkTwUxTC9mZdyv3rL7DXJ3Pi_ETZoq8dX8ytMc4Zc80vVJS0bMUCs7L4GD5LcpltBqR-YygldYKAQ||height="423" width="843"]]
188
189 [[image:AD_4nXccW7o_9wZKfsbesyLGjnGqVCuS_6Q7F40TjttX3HPAx4rKB7HsFAD45qH0s8ciq0aUw-2R1Fh0kWB-i_bLg7PsU_9D7o1uKSxj8K0DRHlhfXROwvqLRatkyvQYQcoLt70yFA1LdQ||height="424" width="842"]]
190
191
192 = 6. Create a Dashboard =
193
194
195 Cloud Studio IoT offers many widget styles for data visualization.
196
197 To create a dashboard:
198
199 * Go to Dashboards → Add dashboard
200 * Fill in the required fields
201 * Add widgets of your choice from the catalog
202
203 (% style="color:blue" %)**Example:**(%%) A basic visualization of a Dragino LHT65.
204
205 [[image:AD_4nXf81m_KX2GfeABDvbUkvXJaJfdWCe4buihmJSLNMdaSwHMnE0at7tFfr9_nxkq7fvwl-6UO9GVb7kEg1bs1VL90BAnk15OO0ntd-UaMG9KstFBOD5S_f1SSBZTPS3juXP2TtdHETw||height="404" width="830"]]
206
207 [[image:AD_4nXdzYycUKheK_iJgbU5UaHlipMO02gzM5Nu9bBqZ4zN5Evwhgna4_6Py3M1_cvAHHwjP5poqkuZhIIVfNwpiZYKIq08Z5FskOcpKq7B_cxiY-WtmqWSdAz1oZ86meCHIOMSAyausjA||height="389" width="826"]]
208
209 [[image:AD_4nXfceQdP0ZVEO9-2psqvuvPo0dPUZfiv0G8DofvzAncTil3tXSdiXNu4eG2WxK8CdbyUVCLaghEWQi-siWp6AGjbeGmQa_i0D_bjGF27rGeMHoeYMV0xwEUA59JfC3vbqMSxG62xQQ||height="416" width="824"]]
210
211
212 = 7. Send downlink messages =
213
214
215 To send manual downlinks from Cloud Studio IoT to your Dragino:
216
217 Go to Devices, select your Dragino, click the three vertical dots, then Edit.
218 [[image:AD_4nXfTYTRQbeXh1cbJX3DSsgM5Nq-DB1QpYNnaxg_DGaJzx_Fq7g3aZdYJ9WLr4P-8Y_cGWcU1_cFs8_2hbLGCJVjxcs5pmP7gRjT8OqyMACP9AgS9pmVG1gN8JKLLqkccG7wv8LrIPA||height="426" width="823"]]
219
220
221 In the Commands tab:
222
223 (% style="color:blue" %)**Command ID:**(%%) Logical port where your device listens (usually in the datasheet or payload decoder, as f_port).
224
225 (% style="color:red" %)**Note: Dragino devices support receiving downlinks on any port, but in principle should avoid using the same ports reserved for uplink data transmission - check device manual for uplink port assignments.**
226
227 (% style="color:blue" %)**CommandData:**(%%) Payload to send (typically in hexadecimal format; refer to the [[Dragino device manual>>https://wiki.dragino.com/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/]] for supported downlink commands).
228
229 [[image:AD_4nXcIu36Vk-Ld7r5BRNRYL9RG-_9RqN-fwKg7Ilp3dOGCokjP-bVb2X2Snq3WyIWl5Xjzq2GSuHMEt_CWNXDE71s65fha1UOd1tLIWwbgKhIooI0o9D422yTwV90-B7dcVTP7qG997w||height="418" width="829"]]
230
231
232 = 8. Verification =
233
234
235 Ensure successful integration by checking:
236
237 * TTN Live Data: Confirm uplink messages from the Dragino device.
238 * Cloud Studio IoT Real-time Log: Verify received data under Devices → Real-time log.
239 * Dashboard: Confirm widgets display correct sensor readings.
240
241
242
243 = 9. Troubleshooting =
244
245
246
247