CPL01 LoRaWAN Outdoor Pulse/Contact Sensor Manual
1. Introduction
1.1 What is CPL01 LoRaWAN Pulse/Contact Sensor
The Dragino CPL01 is a LoRaWAN Contact Sensor. It detects open/close status and uplink to IoT server via LoRaWAN network. user can see the dry contact status, open time, open counts in the IoT Server.
CPL01 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 CPL01 will send periodically data every day as well as for each dry contact action. It also counts the contact open times and calculate last open duration. User can also disable the uplink for each open/close event, instead, device can count each open event and uplink periodically.
CPL01 has the open alarm feature, user can set this feature so device will send Alarm if the contact has been open for a certain time.
CPL01 is designed for outdoor use. It has a weatherproof enclosure and industrial level battery to work in low to high temperatures.
Each CPL01 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
- Open/Close detect
- Open/Close statistics
- 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
Connect CPL01 to an Open Close sensor like below. So it can detect the open/close event.
1.4 Storage & Operation Temperature
-40°C to +85°C
1.5 Applications
- Open/Close Detection
- Pulse meter application
- Dry Contact Detection
1.6 Mechanical
1.7 Pin Definitions and Switch
1.7.1 Pin Definition
CPL01 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/
1.7.2 Jumper JP2(Power ON/OFF)
Power on Device when putting this jumper.
1.7.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.7.4 Reset Button
Press to reboot the device.
1.7.5 LED
It will flash:
- Boot the device in flash mode
- Send an uplink packet
2. Operation Mode
2.1 How it works?
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.
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 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 for detail.
Assume the DLOS8 is already set to connect to the TTN V3 network . We need to add the CPL01 device in TTN V3:
Step 1: Create a device in TTN V3 with the OTAA keys from CPL01.
Each CPL01 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 CPL01
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.
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 CPL01 Joined the network, it will uplink this message to the server. After that, CPL01 will uplink Device Status every 12 hours.
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.
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 CPL01, this value is 0x0E
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
CPL01 will only send this command after getting the downlink command (0x26 02) from the server.
Sensor Configuration FPORT=4 | |||||
Size (bytes) | 3 | 1 | 1 | 2 | 1 |
Value | TDC (unit: sec) | Disalarm | Keep status | Keep time (unit: sec) | Trigger mode |
TDC: (default: 0x001C20)
Uplink interval for the total pulse count, default value is 0x001C20 which is 7200 seconds = 2 hours.
Disalarm: (default: 0)
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.
If Disalarm = 0, CPL01 will send uplink at every TDC periodically.
Keep Status & Keep Time
Shows the configure value of Alarm Base on Timeout Feature
Trigger mode (default: 0)
If Trigger mode = 0, count close to open event.
If Trigger mode = 1, count open to close event.
2.3.3 Real-Time Open/Close Status, Uplink FPORT=2
CPL01 will send this uplink after Device Status once join the LoRaWAN network successfully. And CPL01 will:
periodically send this uplink every 2 hours, this interval can be changed.
Uplink Payload totals 11 bytes.
Real-Time Open/Close Status, FPORT=2 | ||||
Size (bytes) | 1 | 3 | 3 | 4 |
Value | Status & Alarm | Total pulse | The last open duration (unit: min) | Unix TimeStamp |
Status & Alarm field | |||
Size (bit) | 6 | 1 | 1 |
Value | Calculate Flag | Alarm: 0: No Alarm; 1: Alarm | Contact Status: 0: Open, 1: Close |
Calculate Flag
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.
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.
Default value: 0.
Range (6 bits): (b)000000 ~ (b) 111111
Refer: Set Calculate Flag
Alarm
Contact Status
0: Open
1: Close
Total pulse
Total pulse/counting base on dry contact trigger event
Range (3 Bytes) : 0x000000 ~ 0xFFFFFF . Max: 16777215
The last open duration
Dry Contact last open duration.
Unit: min.
-
- Historical Door Open/Close Event, FPORT=3
CPL01 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 open/close status.
- Each data entry is 11 bytes and has the same structure as Real-Time open/close status, to save airtime and battery, CPL01 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 CPL01 doesn’t have any data in the polling time. It will uplink 11 bytes of 0
Downlink:
0x31 61 E9 3A D4 61 E9 3D E0 05
Uplink:
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
Parsed Value:
[ALARM, PIN_STATUS, TOTAL_PULSE, CALCULATE_FLAG, LAST_OPEN_DURATION, TIME]
[TRUE,CLOSE,9190,3,0,2022-01-20 10:35:48],
[TRUE, CLOSE,9190,3,0,2022-01-20 10:36:21],
[FALSE, OPEN,0,3,0,2022-01-20 10:39:04],
[TRUE, CLOSE,2,3,0,2022-01-20 10:39:16],
[TRUE, CLOSE,6,3,0,2022-01-20 10:39:23],
[FALSE, OPEN,0,0,0,2022-01-20 10:42:25],
[FALSE, OPEN,0,0,0,2022-01-20 10:42:41],
[FALSE,OPEN,0,3,0,2022-01-20 10:43:08],
[TRUE, CLOSE,7,3,0,2022-01-20 10:43:34],
[FALSE, CLOSE,0,0,0,2022-01-20 10:47:02],
-
- 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.
- Unix TimeStamp
CPL01 uses Unix TimeStamp format based on
Users can get this time from the link: https://www.epochconverter.com/ :
Below is the converter example
-
- Set Device Time
There are two ways to set the device’s time:
- Through LoRaWAN MAC Command (Default settings)
Users need to set SYNCMOD=1 to enable sync time via the MAC command.
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)].
Note: LoRaWAN Server needs to support LoRaWAN v1.0.3(MAC v1.0.3) or higher to support this MAC command feature.
- 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 31 618E5740 618E8170 05
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.
- Decoder in TTN V3
Please check the decoder from this link:
https://docs.google.com/document/d/1LFTp2IupfM3O4rQ1gJgZHJNP49BZFnm2xThiErnJYPQ/edit?usp=sharing
- 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 CPL01 in Datacake
|
|
- Configure CPL01 via AT Command or LoRaWAN Downlink
Use can configure CPL01 via AT Command or LoRaWAN Downlink.
- AT Command Connection: See FAQ.
- LoRaWAN Downlink instruction for different platforms:
http://wiki.dragino.com/index.php?title=Main_Page#Use_Note_for_Server
There are two kinds of commands to configure CPL01, 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:
http://wiki.dragino.com/index.php?title=End_Device_Downlink_Command
- Commands special design for CPL01
These commands are only valid for CPL01, as below:
- 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 OK the interval is 30000ms = 30s |
AT+TDC=60000 | Set Transmit Interval | OK Set transmit interval to 60000ms = 60 seconds |
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
- 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.
- 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.
- Enable / Disable Alarm
Feature: Enable/Disable Alarm for open/close event. Default value 0.
AT Command:
Command Example | Function | Response |
AT+DISALARM=1 | End node will only send packets in TDC time. | OK |
AT+DISALARM=0 | End node will send packets in TDC time or status change for dry contact status | OK |
Downlink Command:
0xA7 01 //Same As AT+DISALARM=1
0xA7 00 // Same As AT+DISALARM=0
- Alarm Base on Timeout
CPL01 can monitor the timeout for a status change, this feature can be used to monitor some events such as door opening too long etc. Related Parameters are:
- Keep Status: Status to be monitor
Keep Status = 1: Monitor Close to Open event
Keep Status = 0: Monitor Open to Close event
- Keep Time: Timeout to send an Alarm
Range 0 ~ 65535(0xFFFF) seconds.
If keep time = 0, Disable Alarm Base on Timeout feature.
If keep time > 0, device will monitor the keep status event and send an alarm when status doesn’t change after timeout.
AT Command to configure:
- AT+TTRIG=1,30 à When the Keep Status change from connect to disconnect, and device remains in disconnect status for more than 30 seconds. CPL01 will send an uplink packet, the Alarm bit (the second bit of 1st byte of payload) on this uplink packet is set to 1.
- AT+TTIG=0,0 à Default Value, disable timeout Alarm.
Downlink Command to configure:
Command: 0xA9 aa bb cc
A9: Command Type Code
aa: status to be monitored
bb cc: timeout.
If user send 0xA9 01 00 1E: equal to AT+TTRIG=1,30
Or
0xA9 00 00 00: Equal to AT+TTRIG=0,0. Disable timeout Alarm.
- 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
- Set the sensor mode
Feature: LDS03A and CPL01 use the same firmware. User is possible to switch between this two models.
AT Command: AT+MOD
Command Example | Function | Response |
AT+MOD =1 | Set the sensor to LDS03A. | OK |
AT+MOD=2 | Set the sensor to CPL01. | OK |
Downlink Command:
➢ Example: 0x0A02 //Same as AT+MOD=2
- Set trigger mode
Feature: Set the trigger interrupt mode.
AT Command: AT+TTRMOD
Command Example | Function | Response |
AT+TTRMOD =1 | Count and trigger from open to close (rising edge) | OK |
AT+TTRMOD =0 | Count and trigger from close to open (falling edge) | OK |
Downlink Command:
➢ Example: 0xA401 //Same as AT+ TTRMOD =1
- 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 |
➢ Example: 0XA501 //Same as AT+CALCFLAG =1
- 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: 0xA6000001 //Same as AT+ SETCNT =1
Example: 0xA6000064 //Same as AT+ SETCNT =100
- Battery & how to replace
- Battery Info
CPL01 is equipped with a 8500mAH ER18505 Li-SOCI2 battery. The battery is an un-rechargeable battery with a low discharge rate targeting 8~10 years of use. This type of battery is commonly used in IoT targets for long-term running, such as water meters.
The battery-related documents are as below:
- Battery Dimension,
- Lithium-Thionyl Chloride Battery datasheet,
- Lithium-ion Battery-Capacitor datasheet, Tech Spec
The discharge curve is not linear so can’t simply use percentage to show the battery level. Below is the battery performance.
Minimum Working Voltage for the CPL01:
CPL01: 2.45v ~ 3.6v
- Battery Note
The Li-SICO battery is designed for small current / long period applications. It is not good to use a high current, short period transmit method. The recommended minimum period for use of this battery is 5 minutes. If you use a shorter period to transmit LoRa, then the battery life may be decreased.
- Replace Battery
Any battery with a range of 2.45 ~ 3.6v can be a replacement. We recommend using Li-SOCl2 Battery.
And make sure the positive and negative pins match.
JST-XH-2P connector |
-
- Battery Life Analyze
Dragino battery powered products are all run in Low Power mode. User can check the guideline from this link to calculate the estimate battery life:
- FAQ
- How to use AT Command to configure CPL01
CPL01 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:
- 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: https://wiki.dragino.com/index.php?title=Firmware_Upgrade_Instruction_for_STM32_base_products#Hardware_Upgrade_Method_Support_List
Firmware location: (same firmware as LDS03A)
https://www.dragino.com/downloads/index.php?dir=LoRa_End_Node/CPL01/Firmware/
- How to change the LoRa Frequency Bands/Region?
Users can follow the introduction for how to upgrade image. When downloading the images, choose the required image file for download.
- Trouble Shooting
- Order Info
Part Number: CPL01-XX
XX: 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
- Packing Info
Package Includes:
- CPL01 Open/Close Sensor x 1
- 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