Last modified by Xiaoling on 2024/05/16 15:23

Show last authors
1 (% style="text-align:center" %)
2 [[image:image-20231110085342-2.png||height="481" width="481"]]
3
4
5
6
7
8
9
10
11 **Table of Contents:(% style="display:none" %) (%%)**
12
13 {{toc/}}
14
15
16
17
18
19
20 = 1. Introduction =
21
22 == 1.1 What is LoRaWAN Smart Distance Detector ==
23
24
25 The Dragino (% style="color:blue" %)**DS20L is a smart distance detector**(%%) base on long-range wireless LoRaWAN technology. It uses (% style="color:blue" %)**LiDAR sensor**(%%) to detect the distance between DS20L and object, then DS20L will send the distance data to the IoT Platform via LoRaWAN. DS20L can measure range between 3cm ~~ 200cm.
26
27 DS20L allows users to send data and reach extremely long ranges via LoRaWAN. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current 
28 consumption. It targets professional wireless sensor network applications such smart cities, building automation, and so on.
29
30 DS20L has a (% style="color:blue" %)**built-in 2400mAh non-chargeable battery**(%%) for long-term use up to several years*. Users can also power DS20L with an external power source for (% style="color:blue" %)**continuous measuring and distance alarm / counting purposes.**
31
32 DS20L is fully compatible with (% style="color:blue" %)**LoRaWAN v1.0.3 Class A protocol**(%%), it can work with a standard LoRaWAN gateway.
33
34 [[image:image-20240122174214-1.png||height="421" width="787"]]
35
36
37 == 1.2 ​Features ==
38
39
40 * LoRaWAN Class A protocol
41 * LiDAR distance detector, range 3 ~~ 200cm
42 * Periodically detect or continuously detect mode
43 * AT Commands to change parameters
44 * Remotely configure parameters via LoRaWAN Downlink
45 * Alarm & Counting mode
46 * Firmware upgradable via program port or LoRa protocol
47 * Built-in 2400mAh battery or power by external power source
48 (% style="display:none" %) (%%)
49
50 == 1.3 Specification ==
51
52
53 (% style="color:#037691" %)**LiDAR Sensor:**
54
55 * Operation Temperature: -40 ~~ 80 °C
56 * Operation Humidity: 0~~99.9%RH (no Dew)
57 * Storage Temperature: -10 ~~ 45°C
58 * Measure Range: 3cm~~200cm @ 90% reflectivity
59 * Accuracy: ±2cm @ (3cm~~100cm); ±5% @ (100~~200cm)
60 * ToF FoV: ±9°, Total 18°
61 * Light source: VCSEL
62 (% style="display:none" %) (%%)
63
64 == 1.4 Power Consumption ==
65
66
67 (% style="color:#037691" %)**Battery Power Mode:**
68
69 * Idle: 0.003 mA @ 3.3v
70 * Max : 360 mA
71
72 (% style="color:#037691" %)**Continuously mode**:
73
74 * Idle: 21 mA @ 3.3v
75 * Max : 360 mA
76 (% style="display:none" %) (%%)
77
78 == 1.5 Use Case ==
79
80
81 **Regular Distance Detect**
82
83 [[image:image-20231214100011-1.png]]
84
85
86 **Counting / Alarm**
87
88 [[image:image-20231214100036-2.png]]
89
90 [[image:image-20231214100057-3.png]]
91
92
93 == 1.6 LiDAR probe position ==
94
95
96 [[image:1701155390576-216.png||height="285" width="307"]]
97
98 The black oval hole in the picture is the LiDAR probe.
99
100
101 == 1.7 Interface Definition ==
102
103
104 [[image:image-20231128151132-2.png||height="305" width="557"]]
105
106
107 == 1.8 Program Cable Pin Mapping ==
108
109
110 [[image:image-20240314102509-1.jpeg||height="292" width="659"]]
111
112 **Usage For the Program Cable:**
113
114 1) Configure DS20L via AT Command
115
116 2) Update Firmware
117
118 3) Input for external interrupt
119
120 4) Input for external power
121
122
123 == 1.9 Mechanical ==
124
125 [[image:image-20240515104600-1.png]]
126
127 [[image:image-20240515104614-2.png]]
128
129
130 = 2. Configure DS20L to connect to LoRaWAN network =
131
132 == 2.1 How it works ==
133
134
135 The DS20L is configured as (% style="color:#037691" %)**LoRaWAN OTAA Class A**(%%) mode by default. It has OTAA keys to join LoRaWAN network. To connect a local LoRaWAN network, you need to input the OTAA keys in the LoRaWAN IoT server and press the button to activate the DS20L. It will automatically join the network via OTAA and start to send the sensor value. The default uplink interval is 20 minutes.
136
137
138 == 2.2 ​Quick guide to connect to LoRaWAN server (OTAA) ==
139
140
141 Following is an example for how to join the [[TTN v3 LoRaWAN Network>>url:https://console.cloud.thethings.network/]]. Below is the network structure; we use the [[LPS8v2>>url:https://www.dragino.com/products/lora-lorawan-gateway/item/228-lps8v2.html]] as a LoRaWAN gateway in this example.
142
143 The LPS8v2 is already set to connected to [[TTN network >>url:https://console.cloud.thethings.network/]], so what we need to now is configure the TTN server.(% style="display:none" %)
144
145 [[image:image-20240122174214-1.png||height="427" width="798"]](% style="display:none" %)
146
147
148 === Step 1: Create a device in TTN with the OTAA keys from DS20L. ===
149
150 Each DS20L is shipped with a sticker with the default device EUI as below:
151
152 [[image:image-20230426084152-1.png||alt="图片-20230426084152-1.png" height="233" width="502"]]
153
154
155 You can enter this key in the LoRaWAN Server portal. Below is TTN V3 screenshot:
156
157
158 (% style="color:blue" %)**Register the device**
159
160 [[image:image-20231207144600-2.png||height="703" width="756"]]
161
162
163 (% style="color:blue" %)**Add DevEUI and AppKey**
164
165 [[image:image-20231207145121-5.png||height="540" width="756"]]
166
167
168 === Step 2: Activate on DS20L ===
169
170
171 [[image:image-20231128133704-1.png||height="189" width="441"]]
172
173 Press the button for 5 seconds to activate the DS20L.
174
175 The switch is switched to **E** and the external power supply is used.
176
177 The switch is switched to **I** and DS20L will be power by the built-in battery.
178
179 (% style="color:green" %)**Green led**(%%) will fast blink 5 times, device will enter (% style="color:blue" %)**OTA mode**(%%) for 3 seconds. And then start to JOIN LoRaWAN network. (% style="color:green" %)**Green led**(%%) will solidly turn on for 5 seconds after joined in network.
180
181 After join success, it will start to upload messages to TTN and you can see the messages in the panel.
182
183
184 == 2.3 ​Uplink Payload ==
185
186 === 2.3.1 Device Status, FPORT~=5 ===
187
188
189 Users can use the downlink command(**0x26 01**) to ask DS20L to send device configure detail, include device configure status. DS20L will uplink a payload via FPort=5 to server.
190
191 The Payload format is as below.
192
193 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:510px" %)
194 |=(% style="width: 60px;background-color:#4F81BD;color:white" %)(((
195 **Size(bytes)**
196 )))|=(% style="width: 100px; background-color: #4F81BD;color:white;" %)**1**|=(% style="width: 100px; background-color: #4F81BD;color:white;" %)**2**|=(% style="background-color: #4F81BD;color:white; width: 100px;" %)**1**|=(% style="background-color: #4F81BD;color:white; width: 100px;" %)**1**|=(% style="background-color: #4F81BD;color:white; width: 50px;" %)**2**
197 |(% style="width:62.5px" %)Value|(% style="width:110px" %)Sensor Model|(% style="width:48px" %)Firmware Version|(% style="width:94px" %)Frequency Band|(% style="width:91px" %)Sub-band|(% style="width:60px" %)BAT
198
199 Example parse in TTNv3
200
201 [[image:image-20231206151412-3.png||height="157" width="938"]]
202
203 (% style="color:blue" %)**Sensor Model**(%%): For DS20L, this value is 0x21
204
205 (% style="color:blue" %)**Firmware Version**(%%): 0x0100, Means: v1.0.0 version
206
207 (% style="color:blue" %)**Frequency Band**:
208
209 0x01: EU868
210
211 0x02: US915
212
213 0x03: IN865
214
215 0x04: AU915
216
217 0x05: KZ865
218
219 0x06: RU864
220
221 0x07: AS923
222
223 0x08: AS923-1
224
225 0x09: AS923-2
226
227 0x0a: AS923-3
228
229 0x0b: CN470
230
231 0x0c: EU433
232
233 0x0d: KR920
234
235 0x0e: MA869
236
237 (% style="color:blue" %)**Sub-Band**:
238
239 AU915 and US915:value 0x00 ~~ 0x08
240
241 CN470: value 0x0B ~~ 0x0C
242
243 Other Bands: Always 0x00
244
245 (% style="color:blue" %)**Battery Info**:
246
247 Check the battery voltage.
248
249 Ex1: 0x0B45 = 2885mV
250
251 Ex2: 0x0B49 = 2889mV
252
253
254 === 2.3.2 Uplink Payload, FPORT~=2 ===
255
256
257 ==== (% style="color:red" %)**AT+MOD~=1 (Case: Regular Report Distance)**(%%) ====
258
259
260 Regularly detect distance and report. When the distance exceeds the limit, the alarm flag is set to 1, and the report can be triggered by external interrupts.
261
262 **Uplink Payload totals 10 bytes.**
263
264 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:510px" %)
265 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:130px" %)**1**|(% style="background-color:#4f81bd; color:white; width:70px" %)**2**|(% style="background-color:#4f81bd; color:white; width:100px" %)**1**|(% style="background-color:#4f81bd; color:white; width:120px" %)**4**
266 |(% style="width:91px" %)Value|(% style="width:41px" %)BAT|(% style="width:176px" %)MOD+ Alarm+ Interrupt|(% style="width:74px" %)Distance|(% style="width:100px" %)Sensor State|(% style="width:119px" %)Interrupt Count
267
268 **MOD+ Alarm+ Interrupt:**
269
270 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:510px" %)
271 |(% style="background-color:#4f81bd; color:white" %)**Size(bit)**|(% style="background-color:#4f81bd; color:white" %)**[bit7:bit6]**|(% style="background-color:#4f81bd; color:white" %)**bit5**|(% style="background-color:#4f81bd; color:white" %)**bit4**
272 |Value|MOD|Digital Interrupt|(((
273 Distance Alarm
274 0: No Alarm;
275 1: Alarm
276 )))
277
278 Example parse in TTNv3
279
280 [[image:image-20231206195704-6.png||height="238" width="999"]]
281
282 (% style="color:blue" %)**Battery Info:**
283
284 Check the battery voltage for DS20L
285
286 Ex1: 0x0E10 = 3600mV
287
288
289 (% style="color:blue" %)**MOD & Alarm & Interrupt:**
290
291 (% style="color:red" %)**MOD:**
292
293 **Example: ** (0x60>>6) & 0x3f =1
294
295 **0x01:**  Regularly detect distance and report.
296 **0x02: ** Uninterrupted measurement with counting(external power supply).
297
298 **0x03:  **Uninterrupted measurement with distance alarm(external power supply).
299
300 (% style="color:red" %)**Alarm:**
301
302 When the detection distance exceeds the limit, the alarm flag is set to 1.
303
304 (% style="color:red" %)**Interrupt:**
305
306 Whether it is an external interrupt.
307
308
309 (% style="color:blue" %)**Distance info:**
310
311 **Example**:
312
313 If payload is: 0708H: distance = 0708H = 1800 mm
314
315
316 (% style="color:blue" %)**Sensor State:**
317
318 Ex1: 0x00: Normal collection distance
319
320 Ex2 0x0x: Distance collection is wrong
321
322
323 (% style="color:blue" %)**Interript Count:**
324
325 If payload is:000007D0H: count = 07D0H =2000
326
327
328 ==== (% style="color:red" %)**AT+MOD~=2 (Continuously Measure with Counting)**(%%) ====
329
330
331 The power consumption of uninterrupted measurement is high, and the device needs to use external power supply.(The switch is switched to E and the external power supply is used.)
332
333 [[image:image-20231214102129-1.png||height="146" width="340"]]
334
335
336 ===== (% style="color:blue" %)**Example: Measure with Counting**(%%) =====
337
338 * **Set the person or object count mode: AT+MOD=2,0,50,200**
339
340 Continuous measurement and counting, detect and count passing people or objects in distance limit mode.
341
342 **Uplink Payload totals 13 bytes.**
343
344 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:510px" %)
345 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:30px" %)**2**|(% style="background-color:#4f81bd; color:white; width:170px" %)**1**|(% style="background-color:#4f81bd; color:white; width:77px" %)**4**|(% style="background-color:#4f81bd; color:white; width:63px" %)**4**|(% style="background-color:#4f81bd; color:white; width:110px" %)**2**
346 |(% style="width:91px" %)Value|(% style="width:53px" %)BAT|(% style="width:128px" %)MOD+Collection mode|(% style="width:77px" %)Counting|(% style="width:63px" %)Pulse Time|(% style="width:91px" %)Collection Threshold
347
348 **MOD+Collection mode + Count flag:**
349
350 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:303px" %)
351 |(% style="background-color:#4f81bd; color:white; width:76px" %)**Size(bit)**|(% style="background-color:#4f81bd; color:white; width:90px" %)**[bit7:bit6]**|(% style="background-color:#4f81bd; color:white; width:137px" %)**bit5**
352 |(% style="width:76px" %)Value|(% style="width:90px" %)MOD|(% style="width:127px" %)(((
353 Collection mode
354 )))
355
356 Example parse in TTNv3
357
358 [[image:image-20240311135925-2.png||height="241" width="986"]]
359
360
361 (% style="color:blue" %)**BAT & MOD & Collection mode & Interrupt Flag & Counting & Pulse_time & Collection_threshold:**
362
363 (% style="color:red" %)**BAT:**
364
365 The current total battery voltage of the node.
366
367 **Example: **0x0c 36(hex) =  3126(DEC)/1000 = 3.126V
368
369
370 (% style="color:red" %)**MOD:**
371
372 **Example: ** (0x80>>6) & 0x3f =2
373
374 **0x01:**  Regularly detect distance and report.
375
376 **0x02: ** Uninterrupted measurement with counting(external power supply).
377
378 **0x03:  **Uninterrupted measurement with distance alarm(external power supply).
379
380
381 (% style="color:red" %)**Collection mode:**
382
383 Interrupt pin input level signal flag.
384
385 **Example: **(bytes[2] >> 7) & 0x01 = 1
386
387 **0x00**: Low level acquisition.
388
389 **0x01**: High level acquisition.
390
391
392 (% style="color:red" %)**Counting:**
393
394 The total count from startup to this moment.
395
396 **Example:**0x 00 00 10 10(HEX) = 4112(DEC)
397
398
399 (% style="color:red" %)**Collection_threshold:**
400
401 Within the set pulse detection time, collection starts when the object or person enters the set detection range.
402
403 **Example: 0x00 32(hex) = 50(DEC)(unit: mm)**
404
405 (% style="color:red" %)**Note: The minimum threshold is 10 and the maximum is 2000.(Unit:mm)**
406
407
408 (% style="color:red" %)**Pulse_time:**
409
410 Within the set pulse detection time, the object or person enters the detection range and starts collecting.
411
412 **Example: 0x00 00 00 C8(hex) = 200(DEC)(unit: ms)**
413
414 (% style="color:red" %)**Note: This threshold is unlimited.**
415
416
417
418 ==== (% style="color:red" %)**AT+MOD~=3 (Distance Alarm with Counting)(Since firmware v1.0.2)**(%%) ====
419
420 The power consumption of uninterrupted measurement is high, and the device needs to use external power supply.(The switch is switched to E and the external power supply is used.)
421
422 [[image:image-20231214102129-1.png||height="146" width="340"]]
423
424
425 ===== (% style="color:blue" %)**Example: Measure with Distance**(%%) =====
426
427 * **Set the distance or object count mode: AT+MOD=3,0,50,200**
428
429 Continuous measurement and distance, Detect the distance of a person or object in distance limit mode.
430
431 **Uplink Payload totals 6 bytes.**
432
433 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:491px" %)
434 |(% style="background-color:#4f81bd; color:white; width:60px" %)**Size(bytes)**|(% style="background-color:#4f81bd; color:white; width:46px" %)**2**|(% style="background-color:#4f81bd; color:white; width:146px" %)**1**|(% style="background-color:#4f81bd; color:white; width:119px" %)**2**|(% style="background-color:#4f81bd; color:white; width:120px" %)**1**
435 |(% style="width:91px" %)Value|(% style="width:46px" %)BAT|(% style="width:126px" %)MOD+Interrupt flag+alarm flag|(% style="width:109px" %)distance_mm|(% style="width:110px" %)distance state
436
437 **MOD+Collection mode + Count flag:**
438
439 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:368px" %)
440 |(% style="background-color:#4f81bd; color:white; width:76px" %)**Size(bit)**|(% style="background-color:#4f81bd; color:white; width:89px" %)**[bit7:bit6]**|(% style="background-color:#4f81bd; color:white; width:88px" %)**bit5**|(% style="background-color:#4f81bd; color:white; width:115px" %)**bit4**
441 |(% style="width:76px" %)Value|(% style="width:89px" %)MOD|(% style="width:88px" %)(((
442 Alarm flag
443 )))|(% style="width:105px" %)Interrupt flag
444
445 Example parse in TTNv3
446
447 [[image:image-20240411160810-1.png||height="153" width="926"]]
448
449
450 (% style="color:blue" %)**BAT & MOD & Interrupt flag & alarm flag & distance & distance state:**
451
452 (% style="color:red" %)**BAT:**
453
454 The current total battery voltage of the node.
455
456 **Example: **0x0c 36(hex) =  3126(DEC)/1000 = 3.126V
457
458
459 (% style="color:red" %)**MOD:**
460
461 **Example: ** (0xC0>>6) & 0x3f =3
462
463 **0x01:**  Regularly detect distance and report.
464
465 **0x02: ** Uninterrupted measurement counting(external power supply).
466
467 **0x03:  **Uninterrupted measurement with distance alarm(external power supply).
468
469
470 (% style="color:red" %)**Interrupt flag:**
471
472 **Example: ** (0xC0>>4) & 0x01 = 0
473
474 **0x00:**  The pin is in a low state.
475
476 **0x01: ** The pin is in a high state.
477
478
479 (% style="color:red" %)**Alarm flag:**
480
481
482 **Example: ** (0xC0>>5) & 0x01 = 0
483
484 **0x00:**  Not in alarm state.
485
486 **0x01: ** In alarm state.
487
488
489 (% style="color:red" %)**Distance info:**
490
491 **Example**:
492
493 If payload is: 0708H: distance = 0708H = 1800 mm
494
495
496 (% style="color:red" %)**Distance state:**
497
498 Ex1: 0x00: Normal collection distance
499
500 Ex2 0x0x: Distance collection is wrong
501
502
503 == 2.4 Decode payload in The Things Network ==
504
505
506 While using TTN network, you can add the payload format to decode the payload.
507
508 [[image:image-20231206143515-1.png||height="534" width="759"]]
509
510
511 (((
512 The payload decoder function for TTN is here:
513 )))
514
515 (((
516 DS20L TTN Payload Decoder:  [[https:~~/~~/github.com/dragino/dragino-end-node-decoder>>https://github.com/dragino/dragino-end-node-decoder]]
517 )))
518
519
520 == 2.5 ​Show Data in DataCake IoT Server ==
521
522
523 (((
524 [[DATACAKE>>url:https://datacake.co/]] provides a human friendly interface to show the sensor data, once we have data in TTN, we can use [[DATACAKE>>url:https://datacake.co/]] to connect to TTN and see the data in DATACAKE. Below are the steps:
525 )))
526
527
528 (((
529 (% style="color:blue" %)**Step 1**(%%)**: Be sure that your device is programmed and properly connected to the network at this time.**
530 )))
531
532 (((
533 (% style="color:blue" %)**Step 2**(%%)**: To configure the Application to forward data to DATACAKE you will need to add integration. To add the DATACAKE integration, perform the following steps:**
534 )))
535
536
537 [[image:image-20231207153532-6.png||height="539" width="825"]]
538
539
540 [[image:image-20231207155940-8.png||height="458" width="825"]]
541
542 For more detailed instructions, refer to the following instructions: [[Welcome - Datacake Docs>>url:https://docs.datacake.de/]]
543
544 [[image:image-20231207160733-11.png||height="429" width="759"]]
545
546
547 (% style="color:blue" %)**Step 3**(%%)**: Create an account or log in Datacake.**
548
549 (% style="color:blue" %)**Step 4**(%%)**: Search the DS20L and add DevEUI.**
550
551 [[image:image-20231207160343-10.png||height="665" width="705"]]
552
553
554 After added, the sensor data arrive TTN V3, it will also arrive and show in Datacake.
555
556 [[image:image-20231129100454-2.png||height="501" width="928"]]
557
558
559 == 2.6 Frequency Plans ==
560
561
562 The DS20L uses OTAA mode and below frequency plans by default. Each frequency band use different firmware, user update the firmware to the corresponding band for their country.
563
564 [[http:~~/~~/wiki.dragino.com/xwiki/bin/view/Main/End%20Device%20Frequency%20Band/>>http://wiki.dragino.com/xwiki/bin/view/Main/End%20Device%20Frequency%20Band/]]
565
566
567 = 3. Configure DS20L =
568
569 == 3.1 Configure Methods ==
570
571
572 DS20L supports below configure method:
573
574 * AT Command via UART Connection : See [[UART Connection>>http://wiki.dragino.com/xwiki/bin/view/Main/UART%20Access%20for%20LoRa%20ST%20v4%20base%20model/#H2.5UARTConnectionforDS20Lmotherboard]].
575
576 * LoRaWAN Downlink.  Instruction for different platforms: See [[IoT LoRaWAN Server>>http://wiki.dragino.com/xwiki/bin/view/Main/]] section.
577
578 == 3.2 General Commands ==
579
580
581 These commands are to configure:
582
583 * General system settings like: uplink interval.
584
585 * LoRaWAN protocol & radio related command.
586
587 They are same for all Dragino Devices which support DLWS-005 LoRaWAN Stack. These commands can be found on the wiki:
588
589 [[End Device AT Commands and Downlink Command>>http://wiki.dragino.com/xwiki/bin/view/Main/End%20Device%20AT%20Commands%20and%20Downlink%20Command/]]
590
591
592 == 3.3 Commands special design for DS20L ==
593
594
595 These commands only valid for DS20L, as below:
596
597
598 === 3.3.1 Set Transmit Interval Time ===
599
600
601 (((
602 Feature: Change LoRaWAN End Node Transmit Interval.
603 )))
604
605 (((
606 (% style="color:blue" %)**AT Command: AT+TDC**
607 )))
608
609 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
610 |=(% style="width: 156px;background-color:#4F81BD;color:white" %)**Command Example**|=(% style="width: 137px;background-color:#4F81BD;color:white" %)**Function**|=(% style="background-color:#4F81BD;color:white" %)**Response**
611 |(% style="width:156px" %)AT+TDC=?|(% style="width:137px" %)Show current transmit Interval|(((
612 30000
613 OK
614 the interval is 30000ms = 30s
615 )))
616 |(% style="width:156px" %)AT+TDC=60000|(% style="width:137px" %)Set Transmit Interval|(((
617 OK
618 Set transmit interval to 60000ms = 60 seconds
619 )))
620
621 (((
622 (% style="color:blue" %)**Downlink Command: 0x01**
623 )))
624
625 (((
626 Format: Command Code (0x01) followed by 3 bytes time value.
627 )))
628
629 (((
630 If the downlink payload=0100003C, it means set the END Node's Transmit Interval to 0x00003C=60(S), while type code is 01.
631 )))
632
633 * (((
634 Example 1: Downlink Payload: 0100001E  ~/~/ Set Transmit Interval (TDC) = 30 seconds
635 )))
636 * (((
637 Example 2: Downlink Payload: 0100003C  ~/~/ Set Transmit Interval (TDC) = 60 seconds
638 )))
639
640 === 3.3.2 Set Interrupt Mode ===
641
642
643 Feature, Set Interrupt mode for pin of GPIO_EXTI.
644
645 When AT+INTMOD=0 is set, GPIO_EXTI is used as a digital input port.
646
647 (% style="color:blue" %)**AT Command: AT+INTMOD**
648
649 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
650 |=(% style="width: 155px;background-color:#4F81BD;color:white" %)**Command Example**|=(% style="width: 197px;background-color:#4F81BD;color:white" %)**Function**|=(% style="width: 158px;background-color:#4F81BD;color:white" %)**Response**
651 |(% style="width:154px" %)AT+INTMOD=?|(% style="width:196px" %)Show current interrupt mode|(% style="width:157px" %)(((
652 0
653 OK
654 The mode is 0 =Disable Interrupt
655 )))
656 |(% style="width:154px" %)(((
657 AT+INTMOD=3
658
659 (default)
660 )))|(% style="width:196px" %)(((
661 Set Transmit Interval
662 0. (Disable Interrupt),
663 2. (Trigger by falling edge)
664 3. (Trigger by rising edge)
665 )))|(% style="width:157px" %)OK
666
667 (% style="color:blue" %)**Downlink Command: 0x06**
668
669 Format: Command Code (0x06) followed by 3 bytes.
670
671 This means that the interrupt mode of the end node is set to 0x000003=3 (rising edge trigger), and the type code is 06.
672
673 * Example 1: Downlink Payload: 06000000  ~/~/  Turn off interrupt mode
674
675 * Example 2: Downlink Payload: 06000003  ~/~/  Set the interrupt mode to rising edge trigger
676
677 (% style="color:red" %)**Note:**
678
679 (% style="color:red" %)**1. This interrupt only takes effect in mode 1.**
680
681 (% style="color:red" %)**2. After INTMOD=1 is set, the interrupt mode will not work properly because the rising edge and falling edge cannot exist at the same time, which will affect the low power consumption of the motherboard and increase battery consumption.**
682
683
684 === 3.3.3 Set work mode ===
685
686
687 Feature: Switch working mode((% style="color:red" %)**Note: After the modified mode is issued, the node will automatically reset and restart**(%%))
688
689 (% style="color:blue" %)**AT Command: AT+MOD**(%%)  (1: Regular Measurement , 2: Continuous Measuring & Couting, 3: Distance Alarm)
690
691 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:510px" %)
692 |(% style="background-color:#4f81bd; color:white; width:159px" %)**Command Example**|(% style="background-color:#4f81bd; color:white; width:196px" %)**Function**|(% style="background-color:#4f81bd; color:white; width:155px" %)**Response**
693 |(% style="width:159px" %)AT+MOD=?|(% style="width:196px" %)Get the current working mode.|(% style="width:159px" %)OK
694 |(% style="width:159px" %)AT+MOD=1|(% style="width:196px" %)Set the working mode to Regular measurements.|(% style="width:159px" %)OK
695 Attention: Take effect after ATZ
696 |(% style="width:159px" %)(((
697 (((
698 AT+MOD=2,0,50,200
699 )))
700
701 (((
702
703 )))
704 )))|(% style="width:196px" %)Set the working mode to
705 Continuous measurement with counting.|(% style="width:159px" %)(((
706 OK
707 Attention: Take effect after ATZ
708 )))
709 |(% style="width:159px" %)AT+MOD=3,0,1800,200|(% style="width:196px" %)Set the working mode to
710 Continuous measurement with distance alarm.|(% style="width:159px" %)OK
711 Attention: Take effect after ATZ
712
713 **Explanation of MOD=2**
714
715 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:515px" %)
716 |(% style="background-color:#4f81bd; color:white; width:178px" %)**Command Example**|(% style="background-color:#4f81bd; color:white; width:157px" %)**Parameters**|(% style="background-color:#4f81bd; color:white; width:180px" %)**Explanation**
717 |(% colspan="1" rowspan="4" style="width:178px" %)(((
718
719
720
721
722
723
724
725
726 AT+MOD=AA,BB,CC,DD
727 )))|(% style="width:192px" %)(((
728 AA: Mode choice
729 )))|(% style="width:391px" %)(((
730 (% style="color:red" %)**1:**(%%) Regular testing
731 (% style="color:red" %)**2:**(%%) Continuous Measuring & Counting
732
733 (% style="color:red" %)**3: **(%%)Continuous measurement with distance alarm
734 )))
735 |(% style="width:192px" %)(((
736 BB: Counting Condition
737 )))|(% style="width:391px" %)(((
738 (% style="color:red" %)**0:**(%%) Count while detect value (% style="color:blue" %)**Smaller**(%%) than Distance Settings(Parameters CC)
739 (% style="color:red" %)**1:**(%%) Count while detect value** (% style="color:blue" %)Bigger(%%)** than Distance Settings(Parameters CC)
740 )))
741 |(% style="width:192px" %)CC: Distance setting|(% style="width:391px" %)10mm~~2000mm
742 |(% style="width:192px" %)DD: Min Counting Time|(% style="width:391px" %)(((
743 Count only when Smaller or bigger distance last for more than DD. (Unit: ms)
744 (% style="color:blue" %)**Example:**(%%) for command AT+MOD=2,0,50,200. DS20L will count + 1 only when it detects a distance smaller than 50mm and this detect last for more than 200ms.
745 )))
746
747 (% style="color:blue" %)**Downlink Command:**
748
749 Format: Command Code (0x0A) followed by 6 bytes.
750
751 * **Example: **0A 01  ~/~/  Same as AT+MOD=1
752
753 * **Example:** 0A 02 00 00 32 00 00 00 C8  ~/~/  Same as AT+MOD=2,0,50,200
754
755 **Explanation of MOD=3**
756
757 (% border="1" cellspacing="3" style="background-color:#f2f2f2; width:515px" %)
758 |(% style="background-color:#4f81bd; color:white; width:178px" %)**Command Example**|(% style="background-color:#4f81bd; color:white; width:157px" %)**Parameters**|(% style="background-color:#4f81bd; color:white; width:180px" %)**Explanation**
759 |(% colspan="1" rowspan="4" style="width:178px" %)(((
760
761
762
763
764
765
766
767
768 AT+MOD=AA,BB,CC,DD
769 )))|(% style="width:192px" %)(((
770 AA: Mode choice
771 )))|(% style="width:391px" %)(((
772 (% style="color:red" %)**1:**(%%) Regular testing
773 (% style="color:red" %)**2:**(%%) Continuous Measuring & Couting
774
775 (% style="color:red" %)**3: **(%%)Continuous measurement with distance alarm
776 )))
777 |(% style="width:192px" %)(((
778 BB: Counting Condition
779 )))|(% style="width:391px" %)(((
780 (% style="color:red" %)**0:**(%%) Count while detect value (% style="color:blue" %)**Smaller**(%%) than Distance Settings(Parameters CC)
781 (% style="color:red" %)**1:**(%%) Count while detect value** (% style="color:blue" %)Bigger(%%)** than Distance Settings(Parameters CC)
782 )))
783 |(% style="width:192px" %)CC: Distance setting|(% style="width:391px" %)10mm~~2000mm
784 |(% style="width:192px" %)DD: Min alarm Time|(% style="width:391px" %)(((
785 alarm only when Smaller or bigger distance last for more than DD. (Unit: ms)
786 (% style="color:blue" %)**Example:**(%%) for command AT+MOD=2,0,50,200. DS20L will alrm only when it detects a distance smaller than 50mm and this detect last for more than 200ms.
787 )))
788
789 (% style="color:blue" %)**Downlink Command:**
790
791 Format: Command Code (0x0A) followed by 6 bytes.
792
793 * **Example: **0A 01  ~/~/  Same as AT+MOD=1
794
795 * **Example:** 0A 03 00 00 32 00 00 00 C8  ~/~/  Same as AT+MOD=2,0,50,200
796
797 === 3.3.4 Set threshold and threshold mode ===
798
799
800 Feature, Set threshold and threshold mode
801
802 When (% style="color:#037691" %)**AT+DOL=0,0,0,0,400**(%%) is set, No threshold is used, the sampling time is 400ms.
803
804 (% style="color:blue" %)**AT Command: AT+DOL**
805
806 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
807 |(% style="background-color:#4f81bd; color:white; width:162px" %)**Command Example**|(% style="background-color:#4f81bd; color:white; width:240px" %)**Function**|(% style="background-color:#4f81bd; color:white; width:108px" %)**Response**
808 |(% style="width:172px" %)AT+ DOL =?|(% style="width:279px" %)Get the current threshold mode and sampling time|(% style="width:118px" %)(((
809 0,0,0,0,400
810 OK
811 )))
812 |(% style="width:172px" %)AT+ DOL =1,1800,100,0,400|(% style="width:279px" %)Set only the upper and lower thresholds|(% style="width:118px" %)OK
813
814 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
815 |(% style="background-color:#4f81bd; color:white" %)**Command Example**|(% style="background-color:#4f81bd; color:white" %)**Function**|(% style="background-color:#4f81bd; color:white" %)**Parameter**
816 |(% colspan="1" rowspan="9" %)(((
817
818
819
820
821
822
823
824
825 (% style="color:blue" %)**AT+DOL=1,1800,3,0,400**
826 )))|(% colspan="1" rowspan="4" %)The first bit sets the limit mode|0: Do not use upper and lower limits
827 |1: Use upper and lower limits
828 |2: Less than the upper limit
829 |3: Greater than the lower limit
830 |The second bit sets the upper limit value|3~~2000MM
831 |The third bit sets the lower limit value|3~~2000MM
832 |(% colspan="1" rowspan="2" %)The fourth bit sets the over-limit alarm or person or object count.|0 Over-limit alarm, DO output is high
833 |1 Person or object counting statistics
834 |The fifth bit sets the sampling time|100~~10000ms
835
836 (% style="color:blue" %)**Downlink Command: 0x07**
837
838 Format: Command Code (0x07) followed by 9 bytes.
839
840 If the downlink payload=**07 01 0708 0064 00 0190**, it means set the END Node's limit mode to 0x01,upper limit value to 0x0708=1800(mm), lower limit value to 0x0064=100(mm), to over-limit alarm(0x00), the sampling time to 0x0190=400(ms), while type code is 0x07.
841
842 * Example 0: Downlink Payload: 07 00 0000 0000 00 0190  **~-~-->**  AT+DOL=0,0,0,0,400
843 * Example 1: Downlink Payload: 07 01 0708 0064 00 0190  **~-~-->**  AT+DOL=1,1800,100,0,400
844
845 (% style="color:red" %)**Note: The over-limit alarm is applied to MOD1.**
846
847 **For example:**
848
849 * **AT+MOD=1**
850
851 **AT+DOL=1,500,244,(% style="color:blue" %)0(%%),300**
852
853 Send data according to the normal TDC time. If the mode limit is exceeded, the alarm flag is set to 1:
854
855 [[image:image-20231214111618-1.png||height="237" width="884"]]
856
857 = 4. Case Study =
858
859 == 4.1 Detect the level for rabbish bin ==
860
861 === 4.1.1 Case Description ===
862
863 DS20L's ToF FoV angle: ±9°, total 18°, very suitable for object height acquisition. This case describes how to set up DS20L to calculate the amount of garbage in the trash can.
864
865 As shown in the figure below, DS20L detects the distance regularly. When the garbage in a trash can reaches the set capacity, it will issue a warning and regularly report the status of the trash can at that time.
866
867 Note: This mode uses scheduled collection, has very low power consumption and is powered
868
869 [[image:image-20240423203547-4.png]]
870
871 [[image:image-20240423203532-3.png]]
872
873
874 === 4.1.2 Software Configuration ===
875
876 * Open the serial port assistant tool, enter the key, and set  **AT+MOD=1 and AT+DOL=2,200,10,400**
877 * or send downlink command **0A 01 and 07 02 00 C8 00 0A 01 90**
878
879 Every 20 minutes, DS20L will check rabish level of the trash can. If it exceeds the set threshold, it will alarm.
880
881 Detail explain for this command please see [[Working Mode>>||anchor="H3.3.3Setworkmode"]] .
882
883 (% style="color:red" %)**Notice: To save battery life, user can ignore the alarm setting ( AT+DOL).**
884
885
886 === 4.1.3 Test Result ===
887
888 [[image:image-20240423204346-7.png||height="417" width="1117"]]
889
890
891 == 4.2 Uses DS20L to Count object pass in the machine ==
892
893 === 4.2.1 Case Decription ===
894
895
896 DS20L has angle of ToF FoV: ±9°, Total 18°, which is good to use it for object counting. This case descript how to set up DS20L to count how many PCBA pass in the SMT machine.
897
898 As show below, DS20L keep checking the detect distance,  when there is a PCB pass the rail, the distance shown in DS20L will become a small value and DS20L will count PCB +1.
899
900 (% style="color:red" %)**Notice: To continously count object, user need to use external power source to power DS20L, Use battery is not enough **
901
902 [[image:image-20240407214105-1.png||height="230" width="475"]]
903
904 [[image:image-20240407214346-2.png]]
905
906
907 === 4.2.2 Software Configuration ===
908
909
910 * Open the serial port assistant tool, enter the key, and set  **AT+MOD=2,0,50,200**
911 * or send downlink command **0A 02 00 00 32 00 00 00 CB**
912
913 This command will continouse read distance, if distance read below 5cm and last for more than 200ms. Counting + 1.
914
915 Detail explain for this command please see [[Working Mode>>||anchor="H3.3.3Setworkmode"]] .
916
917
918 === 4.2.3 Test Result ===
919
920 [[image:image-20240407221644-6.png||height="532" width="1059"]]
921
922
923 == 4.3 Distance Alarm ==
924
925 === 4.3.1 Case description ===
926
927 DS20L's ToF FoV angle: ±9°, total 18°, very suitable for object distance detection. This case describes how to set up DS20L to determine whether people enter prohibited areas.
928
929 As shown in the figure below, DS20L continuously checks the detection distance. When someone breaks into a prohibited area, the detection distance of DS20L becomes a small valu and sends an Alarm.
930
931 (% style="color:red" %)**Notice: To continously count object, user need to use external power source to power DS20L, Use battery is not enough.**
932
933
934 [[image:image-20240423204625-8.png||height="278" width="638"]]
935
936 [[image:image-20240423204654-9.png||height="306" width="824"]]
937
938
939 === 4.3.2 Software configuration ===
940
941 Open the serial port assistant tool, enter the key, and set AT+MOD=3,0,1800,200
942
943 Or send downlink command 0A 03 00 07 08 00 00 00 CB
944
945 This command will continue to read the distance,  if the reading distance is below 1800 cm and lasts longer than 200 ms. Then DS20L will send an Alarm.
946
947 Detail explain for this command please see [[Working Mode>>||anchor="H3.3.3Setworkmode"]] .
948
949
950 === 4.3.3 Test Result ===
951
952 [[image:image-20240423204928-10.png||height="334" width="1167"]]
953
954
955 = 5. Battery & Power Consumption =
956
957
958 DS20L use built-in 2400mAh non-chargeable battery for long-term use up to several years*. See below link for detail information about the battery info and how to replace.
959
960 [[**Battery Info & Power Consumption Analyze**>>http://wiki.dragino.com/xwiki/bin/view/Main/How%20to%20calculate%20the%20battery%20life%20of%20Dragino%20sensors%3F/]] .
961
962
963 = 6. Firmware update =
964
965
966 (% class="wikigeneratedid" %)
967 User can change firmware DS20L to:
968
969 * Change Frequency band/ region.
970
971 * Update with new features.
972
973 * Fix bugs.
974
975 Firmware and changelog can be downloaded from : **[[Firmware download link>>https://www.dropbox.com/sh/zqv1vt3komgp4tu/AAC33PnXIcWOVl_UXBEAeT_xa?dl=0]]**
976
977 Methods to Update Firmware:
978
979 * (Recommanded way) OTA firmware update via wireless:  **[[http:~~/~~/wiki.dragino.com/xwiki/bin/view/Main/Firmware%20OTA%20Update%20for%20Sensors/>>url:http://wiki.dragino.com/xwiki/bin/view/Main/Firmware%20OTA%20Update%20for%20Sensors/]]**
980
981 * Update through UART TTL interface: **[[Instruction>>http://wiki.dragino.com/xwiki/bin/view/Main/UART%20Access%20for%20LoRa%20ST%20v4%20base%20model/#H2.5UARTConnectionforDS20Lmotherboard]]**.
982 (% style="display:none" %) (%%)
983
984 = 7. FAQ =
985
986 == 7.1 What is the frequency plan for DS20L? ==
987
988
989 DS20L use the same frequency as other Dragino products. User can see the detail from this link:  [[Introduction>>doc:Main.End Device Frequency Band.WebHome||anchor="H1.Introduction"]]
990
991
992 == 7.2 How to connect external power supply to DS20L? ==
993
994
995 Use the positive pole of the regulated power supply to connect the 3.3v pin of the interface;
996
997 Use the negative pole of the regulated power supply to connect the GND pin of the interface.
998
999 [[image:image-20240312104724-1.png]]
1000
1001
1002 When using external power supply, the gear position is in E position
1003
1004 [[image:image-20240313091009-2.png]]
1005
1006
1007 == 7.3 Why cannot Mode be modified? ==
1008
1009
1010 If mode cannot be modified, upgrade the firmware version to v1.0.2 or later.
1011
1012
1013 = 8. Trouble Shooting =
1014
1015 == 8.1 AT Command input doesn't work ==
1016
1017
1018 In the case if user can see the console output but can't type input to the device. Please check if you already include the (% style="color:blue" %)**ENTER**(%%) while sending out the command. Some serial tool doesn't send (% style="color:blue" %)**ENTER**(%%) while press the send key, user need to add ENTER in their string.
1019
1020
1021 == 8.2 Significant error between the output distant value of LiDAR and actual distance ==
1022
1023
1024 (((
1025 (% style="color:blue" %)**Cause ①**(%%)**:**Due to the physical principles of The LiDAR probe, the above phenomenon is likely to occur if the detection object is the material with high reflectivity (such as mirror, smooth floor tile, etc.) or transparent substance. (such as glass and water, etc.)
1026 )))
1027
1028 (((
1029 (% style="color:red" %)**Troubleshooting**(%%): Please avoid use of this product under such circumstance in practice.
1030 )))
1031
1032
1033 (((
1034 (% style="color:blue" %)**Cause ②**(%%)**: **The IR-pass filters are blocked.
1035 )))
1036
1037 (((
1038 (% style="color:red" %)**Troubleshooting**(%%): please use dry dust-free cloth to gently remove the foreign matter.
1039 )))
1040
1041
1042 = 9. Order Info =
1043
1044
1045 Part Number: (% style="color:blue" %)**DS20L-XXX**
1046
1047 (% style="color:red" %)**XXX**(%%): **The default frequency band**
1048
1049 * (% style="color:red" %)**AS923**(%%): LoRaWAN AS923 band
1050
1051 * (% style="color:red" %)**AU915**(%%): LoRaWAN AU915 band
1052
1053 * (% style="color:red" %)**EU433**(%%): LoRaWAN EU433 band
1054
1055 * (% style="color:red" %)**EU868**(%%): LoRaWAN EU868 band
1056
1057 * (% style="color:red" %)**KR920**(%%): LoRaWAN KR920 band
1058
1059 * (% style="color:red" %)**US915**(%%): LoRaWAN US915 band
1060
1061 * (% style="color:red" %)**IN865**(%%): LoRaWAN IN865 band
1062
1063 * (% style="color:red" %)**CN470**(%%): LoRaWAN CN470 band
1064 (% style="display:none" %) (%%)
1065
1066 = 10. ​Packing Info =
1067
1068
1069 (% style="color:#037691" %)**Package Includes**:
1070
1071 * DS20L LoRaWAN Smart Distance Detector x 1
1072
1073 (% style="color:#037691" %)**Dimension and weight**:
1074
1075 * Device Size: cm
1076
1077 * Device Weight: g
1078
1079 * Package Size / pcs : cm
1080
1081 * Weight / pcs : g
1082 (% style="display:none" %) (%%)
1083
1084 = 11. Support =
1085
1086
1087 * Support is provided Monday to Friday, from 09:00 to 18:00 GMT+8. Due to different timezones we cannot offer live support. However, your questions will be answered as soon as possible in the before-mentioned schedule.
1088
1089 * Provide as much information as possible regarding your enquiry (product models, accurately describe your problem and steps to replicate it etc) and send a mail to [[Support@dragino.cc>>mailto:Support@dragino.cc]].
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0