Wiki source code of How to Uplink -NB and -CB series devices data by MQTT with Thingseye
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
2.1 | 1 | **Table of Contents:** |
2 | |||
![]() |
4.1 | 3 | {{toc/}} |
4 | |||
![]() |
1.1 | 5 | = 1. Introduction = |
6 | |||
7 | This document guides you on integrating Dragino **-NB** and **-CB** series devices data with Thingseye. | ||
8 | |||
9 | The **NB series** devices end with the suffix **-NB**, and the **CB series** devices end with the suffix **-CB**. For example, **S31B-NB** is an **NB device**, and **S31-CB** is a **CB device**. | ||
10 | |||
11 | = 2. Prerequisites = | ||
12 | |||
13 | To complete this tutorial, you need to have certificate files. [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]] is the Dragino's MQTT broker, which requires a CA certificate file, Certificate file, and the Private key file to use. | ||
14 | |||
![]() |
2.2 | 15 | If customers need to use this MQTT connection with Thingseye, they need to contact TE team to obtain three license files or click this [[link>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]] to download the certificates.. |
![]() |
1.1 | 16 | |
17 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/ThingsBoard/ins1.png?width=500&height=310&rev=1.1||alt="ins1.png" height="310" width="500"]] | ||
18 | |||
19 | |||
![]() |
7.1 | 20 | = (% style="color:#333333; font-family:inherit; font-size:max(23px, min(29px, 12.3333px + 1.38889vw))" %)3. Configure Thingseye's Integration(%%) = |
![]() |
1.1 | 21 | |
![]() |
7.1 | 22 | == 3.1 Creat new MQTT integration == |
![]() |
1.1 | 23 | |
24 | In the left navigation, click **Integrations center**, and then click **Integrations**. | ||
25 | |||
26 | On the **Integrations** page, click on the '**+**' button. | ||
27 | |||
![]() |
2.2 | 28 | [[image:1743578691561-822.png]] |
29 | |||
30 | |||
![]() |
1.1 | 31 | The **Add integration** window appears. |
32 | |||
33 | In the **Add integration** window, configure the following settings: | ||
34 | |||
35 | **Basic settings:** | ||
36 | |||
37 | * **Integration type**: MQTT | ||
![]() |
2.2 | 38 | * **Name**: MQTT integration |
![]() |
1.1 | 39 | * **Enable integration**: YES |
![]() |
2.2 | 40 | * **Debug mode**:YES |
![]() |
1.1 | 41 | * **Allows create devices or assets**: YES |
42 | |||
43 | Click **Next** button. | ||
44 | |||
![]() |
2.2 | 45 | [[image:1743578960106-916.png||height="549" width="547"]] |
![]() |
1.1 | 46 | |
47 | |||
![]() |
2.2 | 48 | **Uplink/downlink data converter:** |
![]() |
1.1 | 49 | |
![]() |
2.2 | 50 | * ((( |
51 | Next, directly select to create a new Uplink data converter . | ||
52 | ))) | ||
53 | |||
![]() |
1.1 | 54 | Click **Next** button. |
55 | |||
![]() |
2.2 | 56 | [[image:1743581191958-140.png||height="547" width="543"]] |
![]() |
1.1 | 57 | |
![]() |
2.2 | 58 | |
59 | |||
![]() |
1.1 | 60 | **Downlink data converter:** |
61 | |||
![]() |
2.2 | 62 | * Next, directly select to create a new Uplink data converter . |
![]() |
1.1 | 63 | |
64 | Click **Skip** button. | ||
65 | |||
![]() |
2.2 | 66 | [[image:1743581287837-189.png||height="547" width="542"]] |
![]() |
1.1 | 67 | |
![]() |
2.2 | 68 | |
![]() |
1.1 | 69 | **Connection:** |
70 | |||
![]() |
2.2 | 71 | * **Host**: [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]] |
![]() |
1.1 | 72 | * **Port**: 8883 |
![]() |
2.2 | 73 | * **Credentials **: PEM(Paste 3 certificates to boxs below)Click this [[link>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]] to download the certificates. |
74 | * **Password:** Password or nothng | ||
![]() |
1.1 | 75 | * **Enable SSL**: YES |
![]() |
2.2 | 76 | * **Topic: ** **It needs to align with the device's topic.** |
77 | * **QoS:** 0-At most once or an MQTT QoS level | ||
![]() |
1.1 | 78 | |
![]() |
2.2 | 79 | Click **Skip** button. |
![]() |
1.1 | 80 | |
![]() |
2.2 | 81 | [[image:1743579352961-586.png||height="507" width="502"]] |
![]() |
1.1 | 82 | |
![]() |
7.1 | 83 | [[image:1743584347047-327.png]] |
![]() |
1.1 | 84 | |
85 | |||
![]() |
2.2 | 86 | Click on the **Add** button. |
![]() |
1.1 | 87 | |
![]() |
2.2 | 88 | You should see that the newly added integration is listed on the **Integrations** page. |
![]() |
1.1 | 89 | |
![]() |
2.2 | 90 | Since we haven't received data from a device yet, the integration **Status** is shown as **Pending, Active instead if it have.** |
![]() |
1.1 | 91 | |
![]() |
7.1 | 92 | [[image:1743580606618-281.png||height="495" width="504"]] |
![]() |
1.1 | 93 | |
94 | |||
![]() |
7.1 | 95 | = 4. Configure Thingseye's Data Converters = |
![]() |
1.1 | 96 | |
![]() |
7.1 | 97 | First, you need to download the [[**MQTT uplink/downlink JS** **code**>>url:https://www.dropbox.com/scl/fo/d5s1wf36f4syv30a8laup/AK8FjVpNXYXCWodRnnQ1Hig?rlkey=jrz1ip0f0xwwq5z2m2gu1tuij&e=1&st=kl4caub0&dl=0]]. |
![]() |
1.1 | 98 | |
![]() |
7.1 | 99 | In **Thingseye**, **Data Converters** are components used to transform incoming or outgoing data between different formats, typically to convert raw telemetry data from devices into a structured format that Thingseye can understand, or vice versa. |
![]() |
1.1 | 100 | |
![]() |
7.1 | 101 | == 4.1 Uplink == |
![]() |
1.1 | 102 | |
![]() |
2.2 | 103 | * **Uplink Converter** |
104 | |||
105 | The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. | ||
106 | |||
107 | Go to the **Integrations center** -> **Data converters** page, and find that MQTT uplink converter that was newly created when the integration was created. | ||
108 | |||
109 | [[image:1743581830822-223.png]] | ||
110 | |||
111 | |||
112 | Enter edit mode and apply **MQTT uplink JS code** to this uplink converter. | ||
113 | |||
114 | [[image:1743581965585-763.png]] | ||
115 | |||
116 | |||
![]() |
7.1 | 117 | == 4.2 Downlink == |
![]() |
2.2 | 118 | |
![]() |
7.1 | 119 | * ((( |
120 | **Downlink Converter** | ||
121 | ))) | ||
122 | |||
![]() |
2.2 | 123 | Go to the **Integrations center** -> **Data converters** page, and find that MQTT downlink converter that was newly created when the integration was created. |
124 | |||
125 | |||
126 | Enter edit mode and apply **MQTT downlink JS code** to this downlink converter. | ||
127 | |||
128 | [[image:1743582084494-111.png]] | ||
129 | |||
130 | |||
![]() |
7.1 | 131 | == 4.3 Simulate with MQTT.fx == |
![]() |
2.2 | 132 | |
![]() |
7.1 | 133 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126191118-18.png?width=835&height=605&rev=1.1||alt="image-20241126191118-18.png"]] |
![]() |
1.1 | 134 | |
![]() |
7.1 | 135 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126193252-25.png?width=803&height=663&rev=1.1||alt="image-20241126193252-25.png"]] |
![]() |
1.1 | 136 | |
![]() |
7.1 | 137 | |
138 | = 5. Configure Physical NB-IoT Sensor = | ||
139 | |||
140 | First you need to configure the certificate to the -NB node. Follow the instructions in this **[[link>>url:https://wiki.dragino.com/xwiki/bin/view/Dragino%20NB%20device%20connection%20to%20AWS%20platform%20instructions/#H4.1.2Configurecertificate]]** to configure the certificate. | ||
141 | |||
142 | Screenshot of successful certificate configuration: | ||
143 | |||
144 | * Configuring the CA Certificate | ||
145 | |||
146 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126192009-19.png?width=697&height=431&rev=1.1||alt="image-20241126192009-19.png" height="431" width="697"]] | ||
147 | |||
148 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126192130-21.png?width=694&height=426&rev=1.1||alt="image-20241126192130-21.png" height="426" width="694"]] | ||
149 | |||
150 | * Configure client certificate | ||
151 | |||
152 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126192246-22.png?width=693&height=397&rev=1.1||alt="image-20241126192246-22.png" height="397" width="693"]][[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126192315-23.png?width=645&height=402&rev=1.1||alt="image-20241126192315-23.png" height="402" width="645"]] | ||
153 | |||
154 | * Configure client private key | ||
155 | |||
156 | [[image:https://wiki.dragino.com/xwiki/bin/download/Main/General%20Configure%20to%20Connect%20to%20IoT%20server%20for%20-NB%20%26%20-NS%20NB-IoT%20models/WebHome/image-20241126192415-24.png?width=737&height=435&rev=1.1||alt="image-20241126192415-24.png" height="435" width="737"]] | ||
157 | |||
158 | When the certificate is configured, burn the boot program, burn the working firmware, and then restart the device. | ||
159 | |||
160 | Then configure the -NB node to connect to the ThingsEye platform: | ||
161 | |||
![]() |
1.1 | 162 | **AT Commands** |
163 | |||
![]() |
7.1 | 164 | * **AT+PRO=3,5 **~/~/ Use MQTT Connection & Json Payload |
165 | * **AT+SERVADDR=lns1.thingseye.io,8883** | ||
166 | * **AT+SUBTOPIC=8899 **~/~/ Consistent with the Topic of MQTT integration created by ThingsEye | ||
167 | * **AT+PUBTOPIC=8899 **~/~/ Consistent with the Topic of MQTT integration created by ThingsEye | ||
168 | * **AT+CLIENT=NULL** | ||
169 | * **AT+UNAME=NULL** | ||
170 | * **AT+PWD=NULL** | ||
171 | * **AT+TLSMOD=1,2** | ||
![]() |
1.1 | 172 | |
![]() |
8.1 | 173 | (% class="box warningmessage" %) |
174 | ((( | ||
175 | Be careful, “ Topic” should be same of device & serve. If your device not belongs Dragino, address should be same of the broker which using. | ||
176 | ))) | ||
177 | |||
![]() |
7.1 | 178 | Test Uplink by click the button for 1~~3 seconds, the MQTT integration in ThingsEye allows you to view the data upstream from the device: |
![]() |
1.1 | 179 | |
180 | |||
![]() |
7.1 | 181 | |
182 | Go to **"Device" ** -> ** "Search Device"**, enter the ** IMEI** of the device to find the device. | ||
183 | |||
184 | |||
185 | |||
![]() |
8.1 | 186 |