Version 9.5 by Xiaoling on 2022/05/19 09:37

Show last authors
1 (% style="text-align:center" %)
2 [[image:image-20220519085532-1.png||height="429" width="366"]]
3
4
5 **SW3L LoRaWAN Outdoor Flow Sensor Manual**
6
7
8 **Table of Contents:**
9
10
11
12
13 = 1. Introduction =
14
15 == 1.1 What is CPL01 LoRaWAN Pulse/Contact Sensor ==
16
17 The Dragino SW3L is a LoRaWAN Flow Sensor. It detects water flow volume and uplink to IoT server via LoRaWAN network. User can use this to monitor the water usage for buildings.
18
19 SW3L is powered by 8500mAh Li-SOCI2 battery, It is designed for long term use up to 10 years. (Actually Battery life depends on the use environment, update period.)
20
21 The SW3L will send water flow volume every 20 minutes. It can also detect the water flow status and send Alarm, to avoid the waste for water usage such as broken toilet case.
22
23 SW3L is designed for both indoor and outdoor use. It has a weatherproof enclosure and industrial level battery to work in low to high temperatures.
24
25 Each SW3L is pre-load with a set of unique keys for LoRaWAN registration, register these keys to LoRaWAN server and it will auto connect after power on
26
27 *Battery life depends on how often to send data, please see [[battery analyzer>>path:#Battery]].
28
29 == 1.2 Features ==
30
31 * LoRaWAN v1.0.3 Class A protocol.
32 * Frequency Bands: CN470/EU433/KR920/US915/EU868/AS923/AU915/IN865/RU864
33 * Upload water flow volume
34 * Monitor water waste
35 * 8500mAh industrial battery(none-rechargeable)
36 * AT Commands to change parameters
37 * Uplink on periodically and open/close event
38 * Datalog feature
39 * Remote configure parameters via LoRa Downlink
40 * Firmware upgradable via program port
41 * Wall Mountable
42 * Outdoor Use
43
44 == 1.3 Installation ==
45
46 Each SW3L package is shipped with a flow sensor. Install the flow sensor into water pipe with correct flow direction to start monitoring.
47
48 == 1.4 Storage & Operation Temperature ==
49
50 -40°C to +85°C
51
52 == 1.5 Applications     ==
53
54 * Flow Sensor application
55 * Water Control
56 * Toilet Flow Sensor
57 * Monitor Waste water
58
59 == 1.6 Flow Sensor Spec ==
60
61 SW3L-004: DW-004 Flow Sensor: diameter: G1/2” / DN15.  450 pulse = 1 L
62
63 SW3L-006: DW-006 Flow Sensor: diameter: G3/4” / DN20.  360 pulse = 1 L
64
65 SW3L-010: DW-010 Flow Sensor: diameter: G 1” / DN25. 60 pulse = 1 L
66
67 == 1.7 Mechanical ==
68
69 [[image:1652922789057-479.png]]
70
71 [[image:1652922797548-885.png]]
72
73 **DW-004 Flow Sensor: diameter: G1/2” / DN15.  450 pulse = 1 L**
74
75 [[image:image-20220519091350-1.png||height="385" width="722"]]
76
77 **006: DW-006 Flow Sensor: diameter: G3/4” / DN20.  360 pulse = 1 L**
78
79 [[image:image-20220519091423-2.png||height="258" width="723"]]
80
81 *
82 ** 010: DW-010 Flow Sensor: diameter: G 1” / DN25. 60 pulse = 1 L
83
84 [[image:image-20220519091423-3.png||height="448" width="724"]]
85
86 == 1.8 Pin Definitions and Switch ==
87
88 [[image:1652923899427-927.png||height="372" width="723"]]
89
90 === 1.8.1 Pin Definition ===
91
92 SW3L is pre-configured to connect to two external wires. The other pins are not used. If user wants to know more about other pins, please refer to the user manual of LSN50v2 at: http:~/~/www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/
93
94 === 1.8.2 Jumper JP2(Power ON/OFF) ===
95
96 Power on Device when putting this jumper.
97
98 === 1.8.3 BOOT MODE / SW1 ===
99
100 (((
101 1) ISP: upgrade mode, device won't have any signal in this mode. but ready for upgrade firmware. LED won't work. Firmware won’t run. 
102 2) Flash: work mode, the device starts to work and send out console output for further debug
103 )))
104
105 === 1.8.4 Reset Button ===
106
107 Press to reboot the device.
108
109 === 1.8.5 LED ===
110
111 It will flash:
112 1)   Boot the device in flash mode
113 2)   Send an uplink packe
114
115 = 2. Operation Mode =
116
117 == 2.1 How it works? ==
118
119 Each CPL01 is shipped with a worldwide unique set of OTAA keys. To use CPL01 in a LoRaWAN network, user needs to input the OTAA keys in the LoRaWAN network server. So CPL01 can join the LoRaWAN network and start to transmit sensor data.
120
121 == 2.2 Example to use for LoRaWAN network ==
122
123 This section shows an example of how to join the TTN V3 LoRaWAN IoT server. Usages with other LoRaWAN IoT servers are similar.
124
125 [[image:1652924183429-136.png]]
126
127 * In this use case, the CPL01 is connect to a dry contact sensor to detect the open/close event and send the status to the LoRaWAN server. The CPL01 will uplink different types of messages to the LoRaWAN server. See [[Uplink payload>>path:http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.3UplinkPayload]] for detail.
128
129 Assume the DLOS8 is already set to connect to the [[TTN V3 network >>url:https://eu1.cloud.thethings.network]]. We need to add the CPL01 device in TTN V3:
130
131 **Step 1**: Create a device in TTN V3 with the OTAA keys from CPL01.
132
133 Each CPL01 is shipped with a sticker with the default device EUI as below:
134
135 [[image:1652858451221-297.png]]
136
137 Users can enter these keys in the LoRaWAN Server portal. Below is the TTN V3 screenshot:
138
139 Add APP EUI in the application.
140
141 [[image:1652858478050-325.png]]
142
143 [[image:1652858498638-881.png||height="327" width="727"]]
144
145 [[image:1652858507748-628.png]]
146
147 [[image:1652858520534-791.png]]
148
149 Add APP KEY and DEV EUI
150
151 **Step 2**: Power on CPL01
152
153 [[image:1652858584749-726.png]]
154
155 Put the jumper to power on CPL01 and it will auto-join to the TTN V3 network. After join success, it will start to upload sensor data to TTN V3 and the user can see it in the panel.
156
157 [[image:1652858597931-989.png||height="322" width="721"]]
158
159 == 2.3 Uplink Payload ==
160
161 Uplink payloads have two types:
162
163 * Open/Close Status: Use FPORT=2
164 * Other control commands: Use other FPORT fields.
165
166 The application server should parse the correct value based on FPORT settings.
167
168 === 2.3.1 Device Status, FPORT~=5 ===
169
170 Include device configure status. Once CPL01 Joined the network, it will uplink this message to the server. After that, CPL01 will uplink Device Status every 12 hours.
171
172 Users can also use the downlink command(0x26 01) to ask CPL01 to resend this uplink. This uplink payload also includes the DeviceTimeReq to get time.
173
174 |(% colspan="6" %)**Device Status (FPORT=5)**
175 |**Size (bytes)**|**1**|**2**|**1**|**1**|**2**
176 |**Value**|Sensor Model|Firmware Version|Frequency Band|Sub-band|BAT
177
178 Example parse in TTNv3
179
180 [[image:1652859749264-179.png||height="275" width="723"]]
181
182 * **Sensor Model**: For CPL01, this value is 0x0E
183
184 * **Firmware Version**: 0x0100, Means: v1.0.0 version
185
186 * **Frequency Band**:
187
188 *0x01: EU868
189 *0x02: US915
190 *0x03: IN865
191 *0x04: AU915
192 *0x05: KZ865
193 *0x06: RU864
194 *0x07: AS923
195 *0x08: AS923-1
196 *0x09: AS923-2
197 *0x0a: AS923-3
198 *0x0b: CN470
199 *0x0c: EU433
200 *0x0d: KR920
201 *0x0e: MA869
202
203 * (((
204 **Sub-Band**:
205
206 * AU915 and US915:value 0x00 ~~ 0x08
207 * CN470: value 0x0B ~~ 0x0C
208 * Other Bands: Always 0x00
209 )))
210
211 * **Battery Info:**
212
213 Check the battery voltage.
214
215 **Ex1**: 0x0B45 = 2885mV
216
217 **Ex2**: 0x0B49 = 2889mV
218
219 === 2.3.2 Sensor Configuration, FPORT~=4 ===
220
221 CPL01 will only send this command after getting the downlink command (0x26 02) from the server.
222
223 |(% colspan="6" %)**Sensor Configuration FPORT=4**
224 |**Size (bytes)**|**3**|**1**|**1**|**2**|**1**
225 |**Value**|TDC (unit: sec)|Disalarm|Keep status|Keep time (unit: sec)|Trigger mode
226
227 * **TDC: (default: 0x001C20)**
228
229 Uplink interval for the total pulse count, default value is 0x001C20 which is 7200 seconds = 2 hours.
230
231 * **Disalarm: (default: 0)**
232
233 **If Disalarm = 1**, CPL01 will only send uplink at every TDC periodically. This is normally use for pulse meter application, in this application, there are many disconnect/connect event, and platform only care about the total number of pulse.
234
235 **If Disalarm = 0**, CPL01 will send uplink at every TDC periodically.
236
237 * **Keep Status & Keep Time**
238
239 Shows the configure value of [[Alarm Base on Timeout Feature>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H3.5AlarmBaseonTimeout]]
240
241 * **Trigger mode (default: 0)**
242
243 **If Trigger mode = 0**, count close to open event.
244
245 **If Trigger mode = 1**, count open to close event.
246
247 [[image:1652860064987-743.png||height="152" width="730"]]
248
249 [[image:1652860079526-831.png||height="209" width="729"]]
250
251 === 2.3.3 Real-Time Open/Close Status, Uplink FPORT~=2 ===
252
253 CPL01 will send this uplink **after** Device Status once join the LoRaWAN network successfully. And CPL01 will:
254
255 periodically send this uplink every 2 hours, this interval [[can be changed>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H3.1SetTransmitIntervalTime]].
256
257 Uplink Payload totals 11 bytes.
258
259 |(% colspan="5" %)**Real-Time Open/Close Status, FPORT=2**
260 |**Size (bytes)**|**1**|**3**|**3**|**4**
261 |**Value**|Status & [[Alarm>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H3.5AlarmBaseonTimeout]]|Total pulse|The last open duration (unit: min)|[[Unix TimeStamp>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.4.1UnixTimeStamp]]
262
263 |(% colspan="4" %)**Status & Alarm field**
264 |**Size (bit)**|**6**|**1**|**1**
265 |**Value**|Calculate Flag|Alarm: 0: No Alarm; 1: Alarm|Contact Status: 0: Open, 1: Close
266
267 * **Calculate Flag**
268
269 The calculate flag is a user define field, IoT server can use this filed to handle different meter with different pulse factor. For example, if there are 100 water meters, meter 1 ~~50 are 1 liter/pulse and meter 51 ~~ 100 has 1.5 liter/pulse.
270
271 User can set calculate flag to 1 for meter 1~~50 and 2 for meter 51 ~~ 100, So IoT Server can use this field for calculation.
272
273 Default value: 0. 
274
275 Range (6 bits): (b)000000 ~~ (b) 111111
276
277 Refer: [[Set Calculate Flag>>path:http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H3.7Setthesensormode]]
278
279 * **Alarm**
280
281 See [[Alarm Base on Timeout>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H3.5AlarmBaseonTimeout]]
282
283 * **Contact Status**
284
285 0: Open
286
287 1: Close
288
289 * **Total pulse**
290
291 Total pulse/counting base on dry [[contact trigger event>>http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.3.2SensorConfiguration2CFPORT3D4]]
292
293 Range (3 Bytes) : 0x000000 ~~ 0xFFFFFF . Max: 16777215
294
295 * **The last open duration**
296
297 Dry Contact last open duration.
298
299 Unit: min.
300
301 [[image:1652860403792-491.png||height="153" width="735"]]
302
303 === 2.3.4 Historical Door Open/Close Event, FPORT~=3 ===
304
305 CPL01 stores sensor values and users can retrieve these history values via the [[downlink command>>path:http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.4DatalogFeature]].
306
307 The historical payload includes one or multiplies entries and every entry has the same payload as Real-Time open/close status.
308
309 * Each data entry is 11 bytes and has the same structure as [[Real-Time open/close status>>path:http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.3.3Real-TimeOpen2FCloseStatus2CUplinkFPORT3D2]], to save airtime and battery, CPL01 will send max bytes according to the current DR and Frequency bands.
310
311 For example, in the US915 band, the max payload for different DR is:
312
313 a) DR0: max is 11 bytes so one entry of data
314
315 b) DR1: max is 53 bytes so devices will upload 4 entries of data (total 44 bytes)
316
317 c) DR2: total payload includes 11 entries of data
318
319 d) DR3: total payload includes 22 entries of data.
320
321 If CPL01 doesn’t have any data in the polling time. It will uplink 11 bytes of 0
322
323 **Downlink:**
324
325 0x31 61 E9 3A D4 61 E9 3D E0 05
326
327 [[image:1652861353248-624.png||height="189" width="720"]]
328
329 **Uplink:**
330
331 0E 00 23 E6 00 00 00 61 E9 3B 04 0E 00 23 E6 00 00 00 61 E9 3B 25 0D 00 00 00 00 00 00 61 E9 3B C8 0E 00 00 02 00 00 00 61 E9 3B D4 0E 00 00 06 00 00 00 61 E9 3B DB 01 00 00 00 00 00 00 61 E9 3C 91 01 00 00 00 00 00 00 61 E9 3C A1 0D 00 00 00 00 00 00 61 E9 3C BC 0E 00 00 07 00 00 00 61 E9 3C D6 00 00 00 00 00 00 00 61 E9 3D A6
332
333 **Parsed Value:**
334
335 [ALARM, PIN_STATUS, TOTAL_PULSE, CALCULATE_FLAG, LAST_OPEN_DURATION, TIME]
336
337 [TRUE,CLOSE,9190,3,0,2022-01-20 10:35:48],
338
339 [TRUE, CLOSE,9190,3,0,2022-01-20 10:36:21],
340
341 [FALSE, OPEN,0,3,0,2022-01-20 10:39:04],
342
343 [TRUE, CLOSE,2,3,0,2022-01-20 10:39:16],
344
345 [TRUE, CLOSE,6,3,0,2022-01-20 10:39:23],
346
347 [FALSE, OPEN,0,0,0,2022-01-20 10:42:25],
348
349 [FALSE, OPEN,0,0,0,2022-01-20 10:42:41],
350
351 [FALSE,OPEN,0,3,0,2022-01-20 10:43:08],
352
353 [TRUE, CLOSE,7,3,0,2022-01-20 10:43:34],
354
355 [FALSE, CLOSE,0,0,0,2022-01-20 10:47:02],
356
357 [[image:1652861480446-216.png]]
358
359 == 2.4 Datalog Feature ==
360
361 When a user wants to retrieve sensor value, he can send a poll command from the IoT platform to ask the sensor to send value in the required time slot.
362
363 === 2.4.1 Unix TimeStamp ===
364
365 CPL01 uses Unix TimeStamp format based on
366
367 [[image:1652861618065-927.png||height="109" width="705"]]
368
369 Users can get this time from the link:  [[https:~~/~~/www.epochconverter.com/>>url:https://www.epochconverter.com/]] :
370
371 Below is the converter example
372
373 [[image:1652861637105-371.png||height="428" width="732"]]
374
375 === 2.4.2 Set Device Time ===
376
377 There are two ways to set the device’s time:
378
379 **~1. Through LoRaWAN MAC Command (Default settings)**
380
381 Users need to set SYNCMOD=1 to enable sync time via the MAC command.
382
383 Once CPL01 Joined the LoRaWAN network, it will send the MAC command (DeviceTimeReq) and the server will reply with (DeviceTimeAns) to send the current time to CPL01. If CPL01 fails to get the time from the server, CPL01 will use the internal time and wait for the next time request ~[[[via Device Status (FPORT=5)>>path:​ http://8.211.40.43:8080/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/CPL01%20LoRaWAN%20Outdoor%20PulseContact%20%20Sensor%20Manual/#H2.3.1DeviceStatus2CFPORT3D5]]].
384
385 **Note**: LoRaWAN Server needs to support LoRaWAN v1.0.3(MAC v1.0.3) or higher to support this MAC command feature.
386
387 === 2.4.3 Poll sensor value ===
388
389 Users can poll sensor values based on timestamps. Below is the downlink command.
390
391 |(% colspan="4" %)**Downlink Command to poll Open/Close status (0x31)**
392 |**1byte**|**4bytes**|**4bytes**|**1byte**
393 |31|Timestamp start|Timestamp end|Uplink Interval
394
395 Timestamp start and Timestamp end-use Unix TimeStamp format as mentioned above. Devices will reply with all data logs during this period, using the uplink interval.
396
397 For example, downlink command[[image:image-20220518162852-1.png]]
398
399 Is to check 2021/11/12 12:00:00 to 2021/11/12 15:00:00’s data
400
401 Uplink Internal =5s,means CPL01 will send one packet every 5s. range 5~~255s.
402
403 === 2.4.4 Decoder in TTN V3 ===
404
405 [[image:1652862574387-195.png||height="359" width="722"]]
406
407 Please check the decoder from this link:
408
409 [[https:~~/~~/docs.google.com/document/d/1LFTp2IupfM3O4rQ1gJgZHJNP49BZFnm2xThiErnJYPQ/edit?usp=sharing>>url:https://docs.google.com/document/d/1LFTp2IupfM3O4rQ1gJgZHJNP49BZFnm2xThiErnJYPQ/edit?usp=sharing]]
410
411 = 2.5 Show data on Datacake =
412
413 Datacake IoT platform provides a human-friendly interface to show the sensor data, once we have sensor data in TTN V3, we can use Datacake to connect to TTN V3 and see the data in Datacake. Below are the steps:
414
415 **Step 1**: Link TTNv3 to Datacake [[https:~~/~~/docs.datacake.de/lorawan/lns/thethingsindustries#create-integration-on-tti>>url:https://docs.datacake.de/lorawan/lns/thethingsindustries#create-integration-on-tti]]
416
417 **Step 2**: Configure CPL01 in Datacake
418
419 [[image:1652862663124-805.png]]
420
421 [[image:1652862686700-576.png]]
422
423 [[image:1652862716106-261.png]]
424
425 [[image:1652862734313-990.png||height="229" width="707"]]
426
427 [[image:1652862744310-982.png||height="380" width="715"]]
428
429 [[image:1652862755419-628.png||height="258" width="718"]]
430
431 [[image:1652862763975-153.png||height="214" width="720"]]
432
433 [[image:1652862773781-198.png||height="321" width="499"]]
434
435 [[image:1652862794151-835.png||height="327" width="487"]]
436
437 [[image:1652862807472-427.png||height="378" width="670"]]