Wiki source code of NDS01 - NB-IoT Door Sensor User Manual
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | (% style="text-align:center" %) | ||
2 | [[image:image-20221112113258-1.jpeg]] | ||
3 | |||
4 | |||
5 | |||
6 | |||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | |||
14 | = 1. Introduction = | ||
15 | |||
16 | == 1.1 What is NDS01 NB-IoT Door Sensor == | ||
17 | |||
18 | |||
19 | The Dragino NDS01 is a NB-IOT Door Sensor for Internet of Things solution. It is used to detect the open/close event for door and uplink the event to IoT server via NB-IoT network. | ||
20 | |||
21 | Besides open/close event, NDS01 also has an internal temperature and humidity sensor which can detect the temperature and humidity inside the sensor*. | ||
22 | |||
23 | **NarrowBand-Internet of Things (NB-IoT)** is a standards-based low power wide area (LPWA) technology developed to enable a wide range of new IoT devices and services. NB-IoT significantly improves the power consumption of user devices, system capacity and spectrum efficiency, especially in deep coverage. | ||
24 | |||
25 | NDS01 is powered by 2 x AAA batteries for long term use. | ||
26 | |||
27 | *The measured temperature is 2~~3 degree higher than the actually environment temperature out of NDS01. | ||
28 | |||
29 | |||
30 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image001.png]] | ||
31 | |||
32 | |||
33 | |||
34 | |||
35 | == 1.2 Specifications == | ||
36 | |||
37 | **Common DC Characteristics:** | ||
38 | |||
39 | * | ||
40 | ** | ||
41 | *** | ||
42 | **** Supply Voltage: 2.1v ~~ 3.6v | ||
43 | **** Operating Temperature: -10 ~~ 50°C | ||
44 | |||
45 | |||
46 | |||
47 | **NB-IoT Spec:** | ||
48 | |||
49 | * - B1 @H-FDD: 2100MHz | ||
50 | * - B3 @H-FDD: 1800MHz | ||
51 | * - B8 @H-FDD: 900MHz | ||
52 | * - B5 @H-FDD: 850MHz | ||
53 | * - B20 @H-FDD: 800MHz | ||
54 | * - B28 @H-FDD: 700MHz | ||
55 | |||
56 | |||
57 | |||
58 | **Power Consumption** | ||
59 | |||
60 | * IDEL Mode: 10uA @ 3.3v | ||
61 | * Max transmit power: <500mA@3.3v | ||
62 | |||
63 | | ||
64 | |||
65 | == 1.3 Features == | ||
66 | |||
67 | * NB-IoT Bands: B1/B3/B5/B8/B20/B28 @H-FDD | ||
68 | * Ultra low power consumption | ||
69 | * Door Open / Close Detect | ||
70 | * Device remove alarm | ||
71 | * Uplink Protocol: TCP or UDP | ||
72 | * Uplink on periodically | ||
73 | * Micro SIM card slot for NB-IoT SIM | ||
74 | * 2 x AAA LR03 Batteries | ||
75 | *1. Applications | ||
76 | * Smart Buildings & Home Automation | ||
77 | * Logistics and Supply Chain Management | ||
78 | * Smart Cities | ||
79 | * Smart Factory | ||
80 | |||
81 | |||
82 | |||
83 | |||
84 | = 2. Use NDS01 to communicate with IoT Server = | ||
85 | |||
86 | == 2.1 How it works == | ||
87 | |||
88 | The NDS01 is equipped with a NB-IoT module, the pre-loaded firmware in NDS01 will get environment data from sensors and send the value to local NB-IoT network via the NB-IoT module. The NB-IoT network will forward this value to IoT server via the protocol defined by NDS01. | ||
89 | |||
90 | |||
91 | The diagram below shows the working flow in default firmware of NDS01: | ||
92 | |||
93 | |||
94 | |||
95 | |||
96 | == 2.2 Configure the NDS01 == | ||
97 | |||
98 | === 2.2.1 Test Requirement === | ||
99 | |||
100 | |||
101 | To use NDS01 in your city, make sure meet below requirements: | ||
102 | |||
103 | * Your local operator has already distributed a NB-IoT Network there. | ||
104 | * The local NB-IoT network used the band that NDS01 supports. | ||
105 | * Your operator is able to distribute the data received in their NB-IoT network to your IoT server. | ||
106 | |||
107 | |||
108 | Below figure shows our testing structure. Here we have NB-IoT network coverage by China Mobile, the band they use is B8. The NDS01 will use UDP(120.24.4.116:5601) or TCP(120.24.4.116:5600)protocol to send data to IoT server. | ||
109 | |||
110 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image002.png]] | ||
111 | |||
112 | |||
113 | |||
114 | === 2.2.1 Insert SIM card === | ||
115 | |||
116 | Insert the NB-IoT Card get from your provider. | ||
117 | |||
118 | |||
119 | User need to take out the NB-IoT module and insert the SIM card like below: | ||
120 | |||
121 | |||
122 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image003.png]] | ||
123 | |||
124 | |||
125 | 1. | ||
126 | 11. | ||
127 | 111. Configure NDS01 | ||
128 | |||
129 | |||
130 | User need to configure NDS01 via serial port to set the **Server Address** / **Uplink Topic** to define where and how-to uplink packets. NDS01 support AT Commands, user can use a USB to TTL adapter to connect to NDS01 and use AT Commands to configure it, NDS01 needs to be in the wake-up state when using AT commands,as below. | ||
131 | |||
132 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image004.png]] | ||
133 | |||
134 | |||
135 | |||
136 | Connection: | ||
137 | |||
138 | USB TTL GND <~-~-~-~-> GND | ||
139 | |||
140 | USB TTL TXD <~-~-~-~-> UART_RXD | ||
141 | |||
142 | USB TTL RXD <~-~-~-~-> UART_TXD | ||
143 | |||
144 | |||
145 | |||
146 | In the PC, use below serial tool settings: | ||
147 | |||
148 | * Baud: **115200** | ||
149 | * Data bits:** 8** | ||
150 | * Stop bits: **1** | ||
151 | * Parity: **None** | ||
152 | * Flow Control: **None** | ||
153 | |||
154 | After powering on the NDS01, the following information will be printed | ||
155 | |||
156 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image005.png]] | ||
157 | |||
158 | AT command set | ||
159 | |||
160 | 1. Set and query the communication protocol | ||
161 | |||
162 | Send: AT+PRO=<val> Val: 0:TCP 1:UDP | ||
163 | |||
164 | Reply: OK | ||
165 | |||
166 | Send: AT+PRO? ~/~/Inquire | ||
167 | |||
168 | Reply: +PRO:0 | ||
169 | |||
170 | OK | ||
171 | |||
172 | 1. Set and query the server address | ||
173 | |||
174 | Send: AT+SERVADDR=<server>,<port> | ||
175 | |||
176 | Reply: OK | ||
177 | |||
178 | Send: AT+SERVADDR? ~/~/Inquire | ||
179 | |||
180 | Reply: +SERVADDR:<server>,<port> | ||
181 | |||
182 | OK | ||
183 | |||
184 | 1. Set and query the TDC | ||
185 | |||
186 | Send:AT+TDC=<value>~/~/Heartbeat time, in seconds, the default is 86400s,which is 24 hours | ||
187 | |||
188 | Reply:OK | ||
189 | |||
190 | Send:AT+TDC? ~/~/Inquire | ||
191 | |||
192 | Reply: +TDC:<value> | ||
193 | |||
194 | OK | ||
195 | |||
196 | 1. Query parameters | ||
197 | |||
198 | Send:AT+CFG? | ||
199 | |||
200 | Reply:+PRO:0 | ||
201 | |||
202 | +SERVADDR:120.27.12.119,2023 | ||
203 | |||
204 | +TDC:86400 | ||
205 | |||
206 | +CSQ:31 | ||
207 | |||
208 | +IMEI:868163049937383 | ||
209 | |||
210 | +ICCID:898604611619C0854626 | ||
211 | |||
212 | +IMSI:460048118204626 | ||
213 | |||
214 | OK | ||
215 | |||
216 | 1. Set and query the APN | ||
217 | |||
218 | Send: AT+APN="<apn>" ~/~/Set APN | ||
219 | |||
220 | Reply: OK | ||
221 | |||
222 | Send: AT+APN? ~/~/Inquire | ||
223 | |||
224 | Reply: +APN:"cmiot" | ||
225 | |||
226 | OK | ||
227 | |||
228 | 1. Alarm and Silencer | ||
229 | |||
230 | Send:AT+ALARM=<value> ~/~/0~~1,0: mute 1: buzzer alarm (note that no data will be reported, only the buzzer and the red light are on, if it is in silent mode, only the red light is on) | ||
231 | |||
232 | Reply: OK | ||
233 | |||
234 | |||
235 | |||
236 | |||
237 | 1. | ||
238 | 11. | ||
239 | 111. Use UDP protocol to uplink data (Default protocol) | ||
240 | |||
241 | |||
242 | * **AT+PRO=1 ** ~/~/ Set to use UDP protocol to uplink | ||
243 | * **AT+SERVADDR=119.91.62.30,1999 **~/~/ to set UDP server address and port | ||
244 | |||
245 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image006.png]] | ||
246 | |||
247 | |||
248 | |||
249 | * | ||
250 | *1. | ||
251 | *11. Use TCP protocol to uplink data | ||
252 | * **AT+PRO=0 ** ~/~/ Set to use TCP protocol to uplink | ||
253 | * **AT+SERVADDR=119.91.62.30,2002 **~/~/ to set TCP server address and port | ||
254 | |||
255 | |||
256 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image007.png]] | ||
257 | |||
258 | |||
259 | |||
260 | |||
261 | |||
262 | |||
263 | |||
264 | |||
265 | |||
266 | 1. | ||
267 | 11. | ||
268 | 111. Change Update Interval | ||
269 | |||
270 | User can use below command to change the **uplink interval**. | ||
271 | |||
272 | **AT+TDC=86400 **~/~/ Set Update Interval to 86400s | ||
273 | |||
274 | |||
275 | **NOTE:** | ||
276 | |||
277 | 1. By default, the device will send an uplink message every 24 hour (86400s). | ||
278 | |||
279 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image008.png]] | ||
280 | |||
281 | |||
282 | |||
283 | |||
284 | 1. | ||
285 | 11. Uplink Payload | ||
286 | |||
287 | |||
288 | registration package, uplink payload includes in total 61 bytes | ||
289 | |||
290 | |||
291 | |((( | ||
292 | **Size** | ||
293 | |||
294 | **(bytes)** | ||
295 | )))|**2**|**1**|**1**|**1**|**1**|**15**|**15**|**20**|**1**|**1**|**3** | ||
296 | |**Value**|head|Version|data type|Data length|device type|device ID|IMSI|ICCID|BAT|Signal|tail | ||
297 | |||
298 | |||
299 | The payload is ASCII string, representative same HEX: 0x4B5710013401383639393735303334343431303832343630313133313138373433373332 | ||
300 | |||
301 | 38393836313132303232343031343339383736321E15494F54 where: | ||
302 | |||
303 | * Head: 0x4B57(fixed) | ||
304 | * Version: 0x10=”V1.0” | ||
305 | * Data type: 0x01=1(1:register,2:data sending) | ||
306 | * Data length: 0x34=52(Valid data is 52 bytes) | ||
307 | |||
308 | * Device type: 0x01 = 1(Representative NDS01) | ||
309 | * Device ID:0x383639393735303334343431303832=869975034441082(ASCII) | ||
310 | * IMSI: 0x343630313133313138373433373332 = 460113118743732(ASCII) | ||
311 | * ICCID: 0x3839383631313230323234303134333938373632=89861120224014398762(ASCII) | ||
312 | * Bat: 0x1E = 30/10=3.0V | ||
313 | * Signal: 0x15=21 | ||
314 | |||
315 | **0** -113dBm or less | ||
316 | |||
317 | **1** -111dBm | ||
318 | |||
319 | **2...30** -109dBm... -53dBm | ||
320 | |||
321 | **31** -51dBm or greater | ||
322 | |||
323 | **99** Not known or not detectable | ||
324 | |||
325 | * Tail:0x494F54(fixed) | ||
326 | |||
327 | |||
328 | data upload, uplink payload includes in total 32 bytes | ||
329 | |||
330 | |((( | ||
331 | **Size** | ||
332 | |||
333 | **(bytes)** | ||
334 | )))|**2**|**1**|**1**|**1**|**1**|**15**|**1**|**1**|**1**|**1**|**1**|**1**|**1**|**1**|**3** | ||
335 | |**Value**|head|Version|data type|Data length|device type|device ID|event type|Door magnetic state|BAT|Signal|((( | ||
336 | Temp | ||
337 | |||
338 | integer | ||
339 | )))|((( | ||
340 | Temp | ||
341 | |||
342 | decimal | ||
343 | )))|((( | ||
344 | Hum | ||
345 | |||
346 | integer | ||
347 | )))|((( | ||
348 | Hum | ||
349 | |||
350 | decimal | ||
351 | )))|tail | ||
352 | |||
353 | |||
354 | The payload is ASCII string, representative same HEX: 0x4B5710021401383639393735303334343431303832010020151c552312494F54 where: | ||
355 | |||
356 | * Head: 0x4B57(fixed) | ||
357 | * Version: 0x10=”V1.0” | ||
358 | * Data type: 0x02=2(1:register,2:data sending) | ||
359 | * Data length: 0x14=20(Valid data is 20 bytes) | ||
360 | |||
361 | * Device type: 0x01 = 1(Representative NDS01) | ||
362 | * Device ID:0x383639393735303334343431303832=869975034441082(ASCII) | ||
363 | * Event type:0x01 | ||
364 | |||
365 | 01:TDC | ||
366 | |||
367 | 02:alarm | ||
368 | |||
369 | 03:remove alarm | ||
370 | |||
371 | 04:dismantling alarm | ||
372 | |||
373 | 05:remove demolition alarm | ||
374 | |||
375 | 06:low voltage | ||
376 | |||
377 | 07:remove low voltage | ||
378 | |||
379 | * Door magnetic state: 0x00 | ||
380 | |||
381 | 00:Door sensor is close | ||
382 | |||
383 | 01:Door sensor is open | ||
384 | |||
385 | * Bat: 0x20 = 32/10=3.2V | ||
386 | * Signal: 0x15=21 | ||
387 | |||
388 | **0** -113dBm or less | ||
389 | |||
390 | **1** -111dBm | ||
391 | |||
392 | **2...30** -109dBm... -53dBm | ||
393 | |||
394 | **31** -51dBm or greater | ||
395 | |||
396 | **99** Not known or not detectable | ||
397 | |||
398 | * Temp integer:0x1c=28 | ||
399 | * Temp decimal:0x55=85 | ||
400 | |||
401 | Temp =Temp integer+(Temp decimal)/100=28+85/100=28.85℃ | ||
402 | |||
403 | * Hum integer:0x23=35 | ||
404 | * Hum decimal:0x12=18 | ||
405 | |||
406 | Hum =Hum integer+(Hum decimal)/100=35+18/100=35.18**%rh** | ||
407 | |||
408 | * Tail:0x494F54(fixed) | ||
409 | |||
410 | |||
411 | |||
412 | |||
413 | 1. | ||
414 | 11. Node-Red Example | ||
415 | |||
416 | Please refer to this link for the use of Node-RED: | ||
417 | |||
418 | [[http:~~/~~/8.211.40.43:8080/xwiki/bin/view/Main/Node-RED/>>url:http://8.211.40.43:8080/xwiki/bin/view/Main/Node-RED/]] | ||
419 | |||
420 | Please visit this link to download the Node-RED process: | ||
421 | |||
422 | [[https:~~/~~/github.com/dragino/dragino-end-node-decoder/tree/main/Node-RED>>url:https://github.com/dragino/dragino-end-node-decoder/tree/main/Node-RED]] | ||
423 | |||
424 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image009.png]] | ||
425 | |||
426 | |||
427 | |||
428 | |||
429 | |||
430 | |||
431 | |||
432 | |||
433 | |||
434 | |||
435 | |||
436 | |||
437 | |||
438 | |||
439 | 1. | ||
440 | 11. Buttons and LED and Mode | ||
441 | |||
442 | Operating mode | ||
443 | |||
444 | (1) In the self-check mode (the default is the self-check mode when power on for the first time), the state change of the tamper switch does not trigger an alarm; | ||
445 | |||
446 | (2) In normal working mode, the state change of the tamper switch triggers an alarm; | ||
447 | |||
448 | (3) In silent mode (the default is non-silent mode when power on for the first time), the buzzer is silent. | ||
449 | |||
450 | |||
451 | led lights | ||
452 | |||
453 | (1) After the device is powered on, the green light flashes once; | ||
454 | |||
455 | (2) The device does not set server parameters or cannot connect to the server, and the green light flashes quickly; | ||
456 | |||
457 | (3) SIM card recognition fails, the green light is always on for 20s; | ||
458 | |||
459 | (4) The equipment signal is poor, and the green light flashes once every 3 seconds; | ||
460 | |||
461 | (5) When the device sends data, the green light flashes twice; | ||
462 | |||
463 | (6) The communication of the equipment is normal, and the green light flashes 3 times continuously; | ||
464 | |||
465 | (7) Trigger the tamper switch, the red light is always on for 30s, and goes out when the alarm is canceled; | ||
466 | |||
467 | (8) Trigger the door magnetic alarm, the red light is always on for 30s, and goes out when the alarm is canceled; | ||
468 | |||
469 | |||
470 | buzzer | ||
471 | |||
472 | (1) When the door magnetic alarm is triggered, the buzzer will sound for 30s; after the alarm is restored, the buzzer will be silenced; | ||
473 | |||
474 | (2) Enter the normal working mode (the tamper switch is closed for more than 5s or the door sensor is locked for more than 5s), the buzzer will sound for 1500ms; | ||
475 | |||
476 | (3) After entering the normal working mode, the tamper switch does not close, the buzzer sounds for 30s, the tamper switch is closed, and the buzzer sounds 1 time; | ||
477 | |||
478 | (4) When the door sensor does not alarm, press the button to trigger the alarm, and the buzzer will sound for 30s; when the door sensor alarms, press it once to cancel the alarm, and the buzzer will be silenced. | ||
479 | |||
480 | |||
481 | button | ||
482 | |||
483 | (1) When there is no alarm, press it once to trigger the alarm, and the buzzer will sound; when it alarms, press the buzzer to silence the sound. | ||
484 | |||
485 | (2) Press twice to silence the buzzer; | ||
486 | |||
487 | (3) Press the button three times or more, when the mute function is turned off, the mute function is turned on, and the green light flashes once; when the mute function is turned on, the mute function is turned off, and the green light flashes once. | ||
488 | |||
489 | |||
490 | data pack | ||
491 | |||
492 | (1) The device needs to send a registration packet and a heartbeat packet every time it is powered on and registered; | ||
493 | |||
494 | (2) The heartbeat time is reported once every 24 hours by default. | ||
495 | |||
496 | 1. FAQ | ||
497 | 11. How to Upgrade Firmware | ||
498 | |||
499 | User can upgrade the firmware for 1) bug fix, 2) new feature release. | ||
500 | |||
501 | Burning software please go to this link to download: | ||
502 | |||
503 | Note: | ||
504 | |||
505 | Disconnect one battery before starting the upgrade | ||
506 | |||
507 | Please use 1.8V USB TO TTL serial port | ||
508 | |||
509 | Connection: | ||
510 | |||
511 | USB TTL GND <~-~-~-~-> GND | ||
512 | |||
513 | USB TTL TXD <~-~-~-~-> UART_RXD | ||
514 | |||
515 | USB TTL RXD <~-~-~-~-> UART_TXD | ||
516 | |||
517 | 1. Double-click "FlashTool.exe" to start the program | ||
518 | |||
519 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image010.png]] | ||
520 | |||
521 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image011.png]] | ||
522 | |||
523 | 1. Select burn serial port and firmware package to complete the upgrade | ||
524 | |||
525 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image012.png]] | ||
526 | |||
527 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image013.png]] | ||
528 | |||
529 | 1. Install the battery to the node, and the upgrade will start at this time | ||
530 | |||
531 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image014.png]] | ||
532 | |||
533 | 1. The following screenshot appears, indicating that the upgrade has been successful | ||
534 | |||
535 | [[image:file:///C:/Users/93456/AppData/Local/Temp/msohtmlclip1/01/clip_image015.png]] | ||
536 | |||
537 | |||
538 | 1. Order Info | ||
539 | |||
540 | Part Number: **NDS01** | ||
541 | |||
542 | 1. Packing Info | ||
543 | |||
544 | |||
545 | **Package Includes**: | ||
546 | |||
547 | * NDS01 NB-IoT Door Sensor | ||
548 | |||
549 | |||
550 | **Dimension and weight**: | ||
551 | |||
552 | * Device Size: | ||
553 | * Device Weight: | ||
554 | * Package Size / pcs : | ||
555 | * Weight / pcs : |