Wiki source code of How to Uplink -NB and -CB series devices data by MQTT with Thingseye
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | **Table of Contents:** | ||
| 2 | |||
| 3 | {{toc/}} | ||
| 4 | |||
| 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 | |||
| 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.. | ||
| 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 | |||
| 20 | = (% style="color:#333333; font-family:inherit; font-size:max(23px, min(29px, 12.3333px + 1.38889vw))" %)3. Configure Thingseye's Integration(%%) = | ||
| 21 | |||
| 22 | == 3.1 Creat new MQTT integration == | ||
| 23 | |||
| 24 | In the left navigation, click **Integrations center**, and then click **Integrations**. | ||
| 25 | |||
| 26 | On the **Integrations** page, click on the '**+**' button. | ||
| 27 | |||
| 28 | [[image:1743578691561-822.png]] | ||
| 29 | |||
| 30 | |||
| 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 | ||
| 38 | * **Name**: MQTT integration | ||
| 39 | * **Enable integration**: YES | ||
| 40 | * **Debug mode**:YES | ||
| 41 | * **Allows create devices or assets**: YES | ||
| 42 | |||
| 43 | Click **Next** button. | ||
| 44 | |||
| 45 | [[image:1743578960106-916.png||height="549" width="547"]] | ||
| 46 | |||
| 47 | |||
| 48 | **Uplink/downlink data converter:** | ||
| 49 | |||
| 50 | * ((( | ||
| 51 | Next, directly select to create a new Uplink data converter . | ||
| 52 | ))) | ||
| 53 | |||
| 54 | Click **Next** button. | ||
| 55 | |||
| 56 | [[image:1743581191958-140.png||height="547" width="543"]] | ||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | **Downlink data converter:** | ||
| 61 | |||
| 62 | * Next, directly select to create a new Uplink data converter . | ||
| 63 | |||
| 64 | Click **Skip** button. | ||
| 65 | |||
| 66 | [[image:1743581287837-189.png||height="547" width="542"]] | ||
| 67 | |||
| 68 | |||
| 69 | **Connection:** | ||
| 70 | |||
| 71 | * **Host**: [[lns1.thingseye.io>>url:http://lns1.thingseye.io/]] | ||
| 72 | * **Port**: 8883 | ||
| 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 | ||
| 75 | * **Enable SSL**: YES | ||
| 76 | * **Topic: ** **It needs to align with the device's topic.** | ||
| 77 | * **QoS:** 0-At most once or an MQTT QoS level | ||
| 78 | |||
| 79 | Click **Skip** button. | ||
| 80 | |||
| 81 | [[image:1743579352961-586.png||height="507" width="502"]] | ||
| 82 | |||
| 83 | [[image:1743584347047-327.png]] | ||
| 84 | |||
| 85 | |||
| 86 | Click on the **Add** button. | ||
| 87 | |||
| 88 | You should see that the newly added integration is listed on the **Integrations** page. | ||
| 89 | |||
| 90 | Since we haven't received data from a device yet, the integration **Status** is shown as **Pending, Active instead if it have.** | ||
| 91 | |||
| 92 | [[image:1743580606618-281.png||height="495" width="504"]] | ||
| 93 | |||
| 94 | |||
| 95 | = 4. Configure Thingseye's Data Converters = | ||
| 96 | |||
| 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]]. | ||
| 98 | |||
| 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. | ||
| 100 | |||
| 101 | == 4.1 Uplink == | ||
| 102 | |||
| 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 | |||
| 117 | == 4.2 Downlink == | ||
| 118 | |||
| 119 | * ((( | ||
| 120 | **Downlink Converter** | ||
| 121 | ))) | ||
| 122 | |||
| 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 | |||
| 131 | == 4.3 Simulate with MQTT.fx == | ||
| 132 | |||
| 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"]] | ||
| 134 | |||
| 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"]] | ||
| 136 | |||
| 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 | |||
| 162 | **AT Commands** | ||
| 163 | |||
| 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** | ||
| 172 | |||
| 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 | |||
| 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: | ||
| 179 | |||
| 180 | |||
| 181 | |||
| 182 | Go to **"Device" ** -> ** "Search Device"**, enter the ** IMEI** of the device to find the device. | ||
| 183 | |||
| 184 | |||
| 185 | |||
| 186 |