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