SW3L -- LoRaWAN Outdoor Flow Sensor
Table of Contents:
- 1. Introduction
- 2. Operation Mode
- 3. Configure SW3L via AT Command or LoRaWAN Downlink
- 4. Battery & Power Consumption
- 5. FAQ
- 6. Order Info
- 7. Packing Info
- 8. Support
1. Introduction
1.1 What is SW3L LoRaWAN Flow Sensor
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.
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.)
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.
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.
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
*Battery life depends on how often to send data, please see battery analyzer.
1.2 Features
- LoRaWAN v1.0.3 Class A protocol.
- Frequency Bands: CN470/EU433/KR920/US915/EU868/AS923/AU915/IN865/RU864
- Upload water flow volume
- Monitor water waste
- 8500mAh industrial battery(none-rechargeable)
- AT Commands to change parameters
- Uplink on periodically and open/close event
- Datalog feature
- Remote configure parameters via LoRa Downlink
- Firmware upgradable via program port
- Wall Mountable
- Outdoor Use
1.3 Installation
Each SW3L package is shipped with a flow sensor. Install the flow sensor into water pipe with correct flow direction to start monitoring.
1.4 Storage & Operation Temperature
-40°C to +85°C
1.5 Applications
- Flow Sensor application
- Water Control
- Toilet Flow Sensor
- Monitor Waste water
1.6 Flow Sensor Spec
Model | SW3L-004 | SW3L-006 | SW3L-010 | SW3L-020 |
---|---|---|---|---|
Probe # | DW-004 | DW-006 | DW-010 | DW-020 |
Diameter | G1/2" / DN15 | G3/4" / DN20 | G1" / DN25 | G2" / DN50 |
Working Range | 1~30L/min | 1~60L/min | 2~100L/min | 10~300L/min |
Measure | 450 pulse = 1 L | 390 pulse = 1 L | 64 pulse = 1 L | 12 pulse = 1 L |
Accurancy | ±5% | ±5% | ±5% | ±5% |
Power Consumption | 1uA, 3.6v (Sensor Only) | 1uA, 3.6v (Sensor Only) | 1uA, 3.6v (Sensor Only) | 1uA, 3.6v (Sensor Only) |
Max Pressure | ≤ 1.75Mpa | ≤ 1.75Mpa | ≤ 1.75Mpa | ≤ 1.75Mpa |
Temperature range | <80°C | <80°C | <80°C | <80°C |
Humidity Range | 35%~90%RH (no frost) | 35%~90%RH (no frost) | 35%~90%RH (no frost) | 35%~90%RH (no frost) |
1.7 Mechanical
004: DW-004 Flow Sensor: diameter: G1/2” / DN15. 450 pulse = 1 L
006: DW-006 Flow Sensor: diameter: G3/4” / DN20. 390 pulse = 1 L
010: DW-010 Flow Sensor: diameter: G 1” / DN25. 64 pulse = 1 L
020: DW-020 Flow Sensor: diameter: G 2” / DN50. 12 pulse = 1 L
1.8 Pin Definitions and Switch
1.8.1 Pin Definition
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:
https://www.dropbox.com/sh/djkxs7mr17y94mi/AABVlWbM9uzK9OA3mXyAT10Za?dl=0
Add PA11 digital input and PA12 digital input(Since firmware v1.2.0)
1.8.2 Jumper JP2(Power ON/OFF)
Power on Device when putting this jumper.
1.8.3 BOOT MODE / SW1
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.
2) Flash: work mode, the device starts to work and send out console output for further debug
1.8.4 Reset Button
Press to reboot the device.
1.8.5 LED
It will flash:
1) Boot the device in flash mode
2) Send an uplink packe
2. Operation Mode
2.1 How it works?
Each SW3L is shipped with a worldwide unique set of OTAA keys. To use SW3L in a LoRaWAN network, user needs to input the OTAA keys in the LoRaWAN network server. So SW3L can join the LoRaWAN network and start to transmit sensor data.
2.2 Example to use for LoRaWAN network
This section shows an example of how to join the TTN V3 LoRaWAN IoT server. Usages with other LoRaWAN IoT servers are similar.
- In this use case, the SW3L is connected into water line to measure water flow and send the status to the LoRaWAN server. The SW3L will uplink different types of messages to the LoRaWAN server. See Uplink payload for detail.
Assume the DLOS8 is already set to connect to the TTN V3 network . We need to add the SW3L device in TTN V3:
Step 1: Create a device in TTN V3 with the OTAA keys from SW3L.
Each SW3L is shipped with a sticker with the default device EUI as below:
Users can enter these keys in the LoRaWAN Server portal. Below is the TTN V3 screenshot:
Add APP EUI in the application.
Add APP KEY and DEV EUI
Step 2: Power on SW3L
Put the jumper to power on SW3L 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.
2.3 Uplink Payload
Uplink payloads have two types:
Open/Close Status: Use FPORT=2
Other control commands: Use other FPORT fields.
The application server should parse the correct value based on FPORT settings.
2.3.1 Device Status, FPORT=5
Include device configure status. Once SW3L Joined the network, it will uplink this message to the server. After that, SW3L will uplink Device Status every 12 hours.
Users can also use the downlink command(0x26 01) to ask SW3L to resend this uplink. This uplink payload also includes the DeviceTimeReq to get time.
Device Status (FPORT=5) | |||||
Size (bytes) | 1 | 2 | 1 | 1 | 2 |
Value | Sensor Model | Firmware Version | Frequency Band | Sub-band | BAT |
Example parse in TTNv3
- Sensor Model: For SW3L, this value is 0x11
- Firmware Version: 0x0100, Means: v1.0.0 version
- Frequency Band:
*0x01: EU868
*0x02: US915
*0x03: IN865
*0x04: AU915
*0x05: KZ865
*0x06: RU864
*0x07: AS923
*0x08: AS923-1
*0x09: AS923-2
*0x0a: AS923-3
*0x0b: CN470
*0x0c: EU433
*0x0d: KR920
*0x0e: MA869
Sub-Band:
- AU915 and US915:value 0x00 ~ 0x08
- CN470: value 0x0B ~ 0x0C
- Other Bands: Always 0x00
- Battery Info:
Check the battery voltage.
Ex1: 0x0B45 = 2885mV
Ex2: 0x0B49 = 2889mV
2.3.2 Sensor Configuration, FPORT=4
SW3L will only send this command after getting the downlink command (0x26 02) from the server.
Size(bytes) | 3 | 1 | 1 | 2 | 1 |
Value | TDC(unit:sec) | N/A | Stop Timer | Alarm Timer | Reserve |
- TDC: (default: 0x0004B0)
Uplink interval for the total pulse count, default value is 0x0004B0 which is 1200 seconds = 20 minutes.
- STOP Duration & Alarm Timer
Shows the configure value of Alarm for continuously water flow
2.3.3 Water Flow Value, Uplink FPORT=2
SW3L will send this uplink after Device Status once join the LoRaWAN network successfully. And SW3L will:
periodically send this uplink every 20 minutes, this interval can be changed.
Uplink Payload totals 11 bytes.
Water Flow Value, FPORT=2 | |||||
---|---|---|---|---|---|
Size(bytes) | 1 | 4 | 1 | 1 | 4 |
Value | Calculate Flag & Alarm | Total pulse Or Last Pulse | MOD | Reserve(0x01) | Unix TimeStamp |
Status & Alarm field | |||
---|---|---|---|
Size(bit) | 6 | 1 | 1 |
Value | Calculate Flag | Alarm: 0: No Alarm; 1: Alarm | N/A |
Calculate Flag
The calculate flag is a user defined field, IoT server can use this flag to handle different meters with different pulse factors. For example, if there are 100 Flow Sensors, meters 1 ~50 are 1 liter/pulse and meters 51 ~ 100 has 1.5 liter/pulse.
Example: in the default payload:
- calculate flag=0: for SW3L-004 Flow Sensor: 450 pulse = 1 L
- calculate flag=1: for SW3L-006 Flow Sensor: 390 pulse = 1 L
- calculate flag=2: for SW3L-010 Flow Sensor: 64 pulse = 1 L
Note: At present, the calculation flag can only be set to 0~2, and probe types other than this can directly calculate water flow using different decoding.
Default value: 0.
Range (6 bits): (b)000000 ~ (b) 111111
If user use with a meter for example is 0.02L/pulse. To proper decode the correct value in server,
1) User can set the Calculate Flag of this sensor to 3.
2) In server side, when a sensor data arrive, the decoder will check the value of Calculate Flag, It the value is 3, the total volume = 0.02 x Pulse Count.
NOTE: User need to set Calculate Flag to proper value before use Flow Sensor. Downlink or AT Command see: Refer: Set Calculate Flag
Alarm
Total pulse
Total pulse/counting since factory
Range (4 Bytes) : 0x00000000~ 0xFFFFFFFF .
Last Pulse
Total pulse since last FPORT=2 uplink. (Default 20 minutes)
Range (4 Bytes) : 0x00000000~ 0xFFFFFFFF .
MOD: Default =0
MOD=0 --> Uplink Total Pulse since factory
MOD=1 --> Uplink total pulse since last FPORT=2 uplink.
Water Flow Value
Total Water Flow Volume = (Calculate Flag) x (Total Pulse)=9597/450=21.3L
Total Water Flow for TDC timer = (Calculate Flag) x (Last Pulse)=79/450=0.2L
2.3.4 Historical Water Flow Status, FPORT=3
SW3L stores sensor values and users can retrieve these history values via the downlink command.
The historical payload includes one or multiplies entries and every entry has the same payload as Real-Time water flow status.
Each data entry is 11 bytes and has the same structure as real time water flow status, to save airtime and battery, SW3L will send max bytes according to the current DR and Frequency bands.
For example, in the US915 band, the max payload for different DR is:
a) DR0: max is 11 bytes so one entry of data
b) DR1: max is 53 bytes so devices will upload 4 entries of data (total 44 bytes)
c) DR2: total payload includes 11 entries of data
d) DR3: total payload includes 22 entries of data.
If SW3L doesn't have any data in the polling time. It will uplink 11 bytes of 0
Downlink:
0x31 62 46 B1 F0 62 46 B3 94 07
Uplink:
00 00 01 00 00 00 00 62 46 B2 26 00 00 01 00 00 00 00 62 46 B2 5D 00 00 01 00 00 00 00 62 46 B2 99 00 00 01 00 00 00 00 62 46 B2 D5 00 00 01 00 00 01 15 62 46 B3 11 00 00 01 00 00 01 1F 62 46 B3 7E
Parsed Value:
[Alarm, Calculate Flag, MOD, Total pulse or Last Pulse, Water Flow Value, TIME]
[FALSE,0,0,0,0.0,2022-04-01 08:04:54],
[FALSE,0,0,0,0.0,2022-04-01 08:05:49],
[FALSE,0,0,0,0.0,2022-04-01 08:06:49],
[FALSE,0,0,0,0.0,2022-04-01 08:07:49],
[FALSE,0,0,277,0.6,2022-04-01 08:08:49],
[FALSE,0,0,287,0.6,2022-04-01 08:10:38],
2.4 Datalog Feature
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.
2.4.1 Unix TimeStamp
SW3L uses Unix TimeStamp format based on
Users can get this time from the link: https://www.epochconverter.com/ :
Below is the converter example
2.4.2 Set Device Time
Through LoRaWAN MAC Command
Once SW3L Joined the LoRaWAN network, it will send the MAC command (DeviceTimeReq) and the server will reply with (DeviceTimeAns) to send the current time to SW3L. If SW3L fails to get the time from the server, SW3L will use the internal time and wait for the next time request [via Device Status (FPORT=5)].
Note: LoRaWAN Server needs to support LoRaWAN v1.0.3(MAC v1.0.3) or higher to support this MAC command feature.
2.4.3 Poll sensor value
Users can poll sensor values based on timestamps. Below is the downlink command.
Downlink Command to poll Open/Close status (0x31) | |||
---|---|---|---|
1byte | 4bytes | 4bytes | 1byte |
31 | Timestamp start | Timestamp end | Uplink Interval |
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.
For example, downlink command
Is to check 2021/11/12 12:00:00 to 2021/11/12 15:00:00's data
Uplink Internal =5s,means CPL01 will send one packet every 5s. range 5~255s.
2.4.4 Decoder in TTN V3
Please check the decoder from this link: https://github.com/dragino/dragino-end-node-decoder
2.5 Show data on Datacake
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:
Step 1: Link TTNv3 to Datacake https://docs.datacake.de/lorawan/lns/thethingsindustries#create-integration-on-tti
Step 2: Configure SW3L in Datacake
3. Configure SW3L via AT Command or LoRaWAN Downlink
Use can configure SW3L via AT Command or LoRaWAN Downlink.
- AT Command Connection: See FAQ.
- LoRaWAN Downlink instruction for different platforms: IoT LoRaWAN Server
There are two kinds of commands to configure SW3L, they are:
- General Commands.
These commands are to configure:
- General system settings like uplink interval.
- LoRaWAN protocol & radio related command.
They are the same for all Dragino Devices which support DLWS-005 LoRaWAN Stack(Note**). These commands can be found on the wiki: End Device AT Commands and Downlink Command
- Commands special design for SW3L
These commands are only valid for SW3L, as below:
3.1 Set Transmit Interval Time
Feature: Change LoRaWAN End Node Transmit Interval.
AT Command: AT+TDC
Command Example | Function | Response |
---|---|---|
AT+TDC=? | Show current transmit Interval | 30000 |
AT+TDC=60000 | Set Transmit Interval | OK |
Downlink Command: 0x01
Format: Command Code (0x01) followed by 3 bytes time value.
If the downlink payload=0100003C, it means set the END Node's Transmit Interval to 0x00003C=60(S), while type code is 01.
- Example 1: Downlink Payload: 0100001E // Set Transmit Interval (TDC) = 30 seconds
- Example 2: Downlink Payload: 0100003C // Set Transmit Interval (TDC) = 60 seconds
3.2 Set Password
Feature: Set device password, max 9 digits
AT Command: AT+PWORD
Command Example | Function | Response |
---|---|---|
AT+PWORD=? | Show password | 123456 OK |
AT+PWORD=999999 | Set password | OK |
Downlink Command:
No downlink command for this feature.
3.3 Quit AT Command
Feature: Quit AT Command mode, so user needs to input the password again before using AT Commands.
AT Command: AT+DISAT
Command Example | Function | Response |
---|---|---|
AT+DISAT | Quit AT Commands mode | OK |
Downlink Command:
No downlink command for this feature.
3.4 Alarm for continuously water flow
This feature is to monitor and send Alarm for continuously water flow.
Example case is for Toilet water monitoring, if some one push toilet button, the toilet will have water flow. If the toilet button has broken and can't returned to original state, the water flow will keep for hours or days which cause huge waste for water.
To monitor this faulty and send alarm, there are two settings:
Stop Duration: Unit: Second
Default: 15s, If SW3L didn't see any water flow in 15s, SW3L will consider stop of water flow event.
Alarm Timer: Units: Minute; Default 0 minutes (means Alarm disable)
Example: 3 minutes, if SW3L detect a start of water flow event and didn't detect a stop event within Alarm timer, SW3L will send an Alarm to indicate a water flow abnormal alarm.
So for example, If we set stop duration=15s and Alarm Timer=3minutes. If the toilet water flow continuously for more than 3 minutes, Sensor will send an alarm (in Confirmed MODE) to platform.
Note: After this alarm is send, sensor will consider a stop of water flow and count for another new event. So if water flow waste last for 1 hour, Sensor will keep sending alarm every 3 minutes.
AT Command to configure:
AT+PTRIG=15,3 --> Set Stop duration: 15s, Alarm Timer: 3 minutes.
AT+ PTRIG=15,0 --> Default Value, disable water waste Alarm.
Downlink Command to configure:
Command: 0xAA aa bb cc
AA: Command Type Code
aa: Stop duration
bb cc: Alarm Timer
If user send 0xAA 0F 00 03: equal to AT+PTRIG=15,3
3.5 Clear Flash Record
Feature: Clear flash storage for data log feature.
AT Command: AT+CLRDTA
Command Example | Function | Response |
---|---|---|
AT+CLRDTA | Clear flash storage for data log feature. | Clear all stored sensor data... OK |
Downlink Command:
- Example: 0xA301 // Same as AT+CLRDTA
3.6 Set the calculate flag
Feature: Set the calculate flag
AT Command: AT+CALCFLAG
Command Example | Function | Response |
---|---|---|
AT+CALCFLAG=1 | Set the calculate flag to 1. | OK |
AT+CALCFLAG=2 | Set the calculate flag to 2. | OK |
Downlink Command:
- Example: 0XA501 // Same as AT+CALCFLAG=1
3.7 Set count number
Feature: Manually set the count number
AT Command: AT+SETCNT
Command Example | Function | Response |
---|---|---|
AT+SETCNT=0 | Set the count number to 0. | OK |
AT+SETCNT=100 | Set the count number to 100. | OK |
Downlink Command:
- Example: 0xA600000001 // Same as AT+SETCNT=1
- Example: 0xA600000064 // Same as AT+SETCNT=100
3.8 Set work mode
Feature: Manually set the work mode
AT Command: AT+MOD
Command Example | Function | Response |
---|---|---|
AT+MOD=0 | Set the work mode to 0. | OK |
AT+MOD=1 | Set the work mode to 1 | OK |
Downlink Command:
- Example: 0x0A00 // Same as AT+MOD=0
- Example: 0x0A01 // Same as AT+MOD=1
4. Battery & Power Consumption
SW3L uses ER26500 + SPC1520 battery pack. See below link for detail information about the battery info and how to replace.
Battery Info & Power Consumption Analyze .
5. FAQ
5.1 How to use AT Command to configure SW3
SW3L UART connection photo
In the PC, you need to set the serial baud rate to 9600 to access the serial console for LSN50. LSN50 will output system info once power on as below:
5.2 How to upgrade the firmware?
A new firmware might be available for:
Support new features
For bug fix
Change LoRaWAN bands.
Instruction for how to upgrade: Firmware Upgrade Instruction
Firmware location: https://www.dropbox.com/sh/jktldt8q674i87l/AADqk1zoUEekCjDR_4ic2Tg0a?dl=0
5.3 How to change the LoRa Frequency Bands/Region?
Users can follow the introduction for how to upgrade images. When downloading the images, choose the required image file for download.
5.4 Can I connect 3rd party flow sensor other than the default one?
If a user wants to connect SW3L to a 3rd party flow sensor such as a DN50 flow sensor, that is possible. A flow sensor with pulse output is needed.
Below is the notice for the connection:
1. Connect the 3rd party flow meter to the pulse input and GND of SW3L.
2. Make sure the pulse output voltage of 3rd party flow sensor is less than 5v.
3. It is not recommended to use SW3L to power the external flow meter, unless you are sure the external flow sensor is low power ( several uA). Otherwise the battery of SW3L will be running out soon.
4. After connection, user needs to set the Calculator Flag and change the payload so to get the correct reading in the platform.
Connection:
6. Order Info
Part Number: SW3L-XXX-YYY
XXX: The default frequency band
- AS923: LoRaWAN AS923 band
- AU915: LoRaWAN AU915 band
- EU433: LoRaWAN EU433 band
- EU868: LoRaWAN EU868 band
- KR920: LoRaWAN KR920 band
- US915: LoRaWAN US915 band
- IN865: LoRaWAN IN865 band
- CN470: LoRaWAN CN470 band
YYY: Flow Sensor Model:
- 004: DW-004 Flow Sensor: diameter: G1/2” / DN15. 450 pulse = 1 L
- 006: DW-006 Flow Sensor: diameter: G3/4” / DN20. 390 pulse = 1 L
- 010: DW-010 Flow Sensor: diameter: G 1” / DN25. 64 pulse = 1 L
- 020: DW-020 Flow Sensor: diameter: G 2” / DN50. 12 pulse = 1 L
7. Packing Info
Package Includes:
- SW3L Water Flow Sensor x 1
8. Support
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.
Provide as much information as possible regarding your inquiry (product models, accurately describe your problem and steps to replicate it etc) and send a mail to support@dragino.com.