1652856952171-363.png

Table of Contents:

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.

1652857419839-473.png

image-20221117175638-1.png

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

1652857762997-798.png

1652857791347-991.png

1.7 Pin Definitions and Switch

1652857867227-591.png

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: https://www.dropbox.com/sh/djkxs7mr17y94mi/AABVlWbM9uzK9OA3mXyAT10Za?dl=0

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:

  1. Boot the device in flash mode
  2. 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.

1652858412212-334.png

  • 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:

image-20230426085232-1.png

Users can enter these keys in the LoRaWAN Server portal. Below is the TTN V3 screenshot:

Add APP EUI in the application.

1652858478050-325.png

1652858498638-881.png

1652858507748-628.png

1652858520534-791.png

Add APP KEY and DEV EUI

Step 2: Power on CPL01

1652858584749-726.png

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.

1652858597931-989.png

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)12112
ValueSensor ModelFirmware VersionFrequency BandSub-bandBAT

 

Example parse in TTNv3

1652859749264-179.png

  •  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)31121
ValueTDC (unit:sec)DisalarmKeep statusKeep 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.

1652860064987-743.png

1652860079526-831.png

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)1334
ValueStatus & AlarmTotal pulseThe last open duration (unit: min)Unix TimeStamp
Status & Alarm field
Size(bit)611
ValueCalculate FlagAlarm: 0: No Alarm; 1: AlarmContact 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

  •  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.

1652860403792-491.png

2.3.4 Real-Time Open/Close Status, 3 pulse mode, Uplink FPORT=6

Note:

  • Users need to run AT+MOD=3 to support this model after updating the firmware.
  • This mode doesn't support Historical Events and Datalog features.

CPL03 3 Pulse Wiring:

image-20221013153352-1.png

Payload:

image-20221013153352-2.png

Size(bytes)1333
ValueStatus

Port1 Total Pulse(PB14)

Port2 Total Pulse(PB15)

Port3 Total Pulse(PA4)

Status:

Size(bit)62
ValueCalculate FlagReserve

Max COUNT for each port is 16777215. Exceed this number will reset to 1.

Related AT Command:

AT+TTRMOD1:  Port1 count mode;   0: Signal falling edge(Default), 1: Signal raising edge

             AT+TTRMOD1=0  Downlink Command: 0xA4 01 00

             AT+TTRMOD1=1  Downlink Command: 0xA4 01 01

AT+TTRMOD2:  Port2 count mode;   0: Signal falling edge(Default), 1: Signal raising edge

             AT+TTRMOD1=0  Downlink Command: 0xA4 02 00

             AT+TTRMOD1=1  Downlink Command: 0xA4 02 01

AT+TTRMOD3:  Port3 count mode;  0: Signal falling edge(Default), 1: Signal raising edge

             AT+TTRMOD1=0  Downlink Command: 0xA4 03 00

             AT+TTRMOD1=1  Downlink Command: 0xA4 03 01

AT+CALCFLAG:  Calculate Flag ( Default : 0 )

             AT+CALCFLAG=aa

Downlink Command: 0xA5 aa

AT+COUNTMOD:  Accumulative Mode;  0: Accumulative (Default),1: Reset after uplink.

            AT+COUNTMOD=0   Downlink Command: 0x0B 00

            AT+COUNTMOD=1   Downlink Command: 0x0B 01

AT+SETCNT:  Set count value

            AT+SETCNT=1,aa  Downlink Command: 0xA6 01 aa aa aa

            AT+SETCNT=2,aa  Downlink Command: 0xA6 02 aa aa aa

            AT+SETCNT=3,aa  Downlink Command: 0xA6 03 aa aa aa

Decode:  https://github.com/dragino/dragino-end-node-decoder

2.3.5 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

1652861353248-624.png

 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],

 

1652861480446-216.png

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

CPL01 uses Unix TimeStamp format based on

1652861618065-927.png

Users can get this time from the link:  https://www.epochconverter.com/ :

Below is the converter example

1652861637105-371.png

2.4.2 Set Device Time

There are two ways to set the device's time:

 

1. 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.

 

2. Manually Set Time

Users need to set SYNCMOD=0 to manual time, otherwise, the user set time will be overwritten by the time set by the server.

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)
1byte4bytes4bytes1byte
31Timestamp startTimestamp endUplink 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 commandimage-20220518162852-1.png 

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

1652862574387-195.png

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 2: Configure CPL01 in Datacake

  1652862663124-805.png

1652862686700-576.png

1652862716106-261.png

1652862734313-990.png

1652862744310-982.png

1652862755419-628.png

1652862763975-153.png

1652862773781-198.png

1652862794151-835.png

1652862807472-427.png

3. 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:  IoT LoRaWAN 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: End Device AT Commands and Downlink Command

 

  • Commands special design for CPL01

These commands are only valid for CPL01, as below:

3.1 Set Transmit Interval Time

Feature: Change LoRaWAN End Node Transmit Interval.

 

AT Command: AT+TDC

Command ExampleFunctionResponse
AT+TDC=?Show current transmit Interval

30000
OK
the interval is 30000ms = 30s

AT+TDC=60000Set 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

     

3.2 Set Password

Feature: Set device password, max 9 digits

AT Command: AT+PWORD

Command ExampleFunctionResponse

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 ExampleFunctionResponse
AT+DISATQuit AT Commands modeOK

Downlink Command:

No downlink command for this feature.

3.4 Enable / Disable Alarm

Feature: Enable/Disable Alarm for open/close event. Default value 0.

AT Command:

Command ExampleFunctionResponse
AT+DISALARM=1End node will only send packets in TDC time.OK
AT+DISALARM=0End node will send packets in TDC time or status change for door sensorOK

Downlink Command:

0xA7 01     //  Same As AT+DISALARM=1

0xA7 00     //  Same As AT+DISALARM=0

Notice, This command requires setting CPL01 to LDS03A Mode first. See "3.7 Set the sensor mode"

3.5 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:

 

1. Keep Status: Status to be monitor

Keep Status = 1: Monitor Close to Open event

Keep Status = 0: Monitor Open to Close event

 

2. 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.

3.6 Clear Flash Record

Feature: Clear flash storage for data log feature.

AT Command: AT+CLRDTA

Command ExampleFunctionResponse
AT+CLRDTAClear flash storage for data log feature.Clear all stored sensor data… OK

Downlink Command:

  • Example: 0xA301     //  Same as AT+CLRDTA

3.7 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 ExampleFunctionResponse
AT+MOD=1Set the sensor to LDS03A.OK
AT+MOD=2Set the sensor to CPL01.OK

Downlink Command:

  • Example: 0x0A02      //  Same as AT+MOD=2

3.8 Set trigger mode

Feature: Set the trigger interrupt mode.

AT Command: AT+TTRMOD

Command ExampleFunctionResponse

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

3.9 Set the calculate flag

Feature: Set the calculate flag

AT Command: AT+CALCFLAG

Command ExampleFunctionResponse
AT+CALCFLAG =1Set the calculate flag to 1.OK
AT+CALCFLAG =2Set the calculate flag to 2.OK

Downlink Command:

  • Example: 0XA501         //  Same as AT+CALCFLAG =1

3.10 Set count number

Feature: Manually set the count number

AT Command: AT+SETCNT

Command ExampleFunctionResponse
AT+ SETCNT =0Set the count number to 0.OK
AT+ SETCNT =100Set the count number to 100.OK

Downlink Command:

  1. Example: 0xA6000001      //  Same as AT+ SETCNT =1
  2. Example: 0xA6000064      //  Same as AT+ SETCNT =100

4. Battery & Power Consumption

CPL01 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 CPL01

CPL01 UART connection photo

1652864909750-855.png

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:

 1652864915792-686.png

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: (​​same firmware as LDS03A)https://www.dropbox.com/sh/x9rpz9ftyljg135/AAAhC5hqtQOAw9_AoEEZbl9Ca?dl=0

5.3 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.

5.4 How to change CPL01 to uplink on every contact status change?

1. Set mod to 1 (the setting method is in chapter 3.7)
2. Use ATZ or physically restart the device
(If you set a timeout alarm command, the open state will send an uplink according to the set timeout command.
Example: If you set AT+TTRIG=1,10, then the uplink will be sent after the open state reaches ten seconds)

5.5 What is the maximum total number of pulses for CPL01? What happens after the maximum total number of pulses is reached?

The maximum total number of pulses for CPL01 is three bytes FF FF FF (16,777,215)
The count is reset when the maximum total number of pulses is reached

6. Trouble Shooting

6.1  AT Commands input doesn't work

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 ENTER while sending out the command. Some serial tool doesn't send ENTER while press the send key, user need to add ENTER in their string. 

7. 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

     

8. Packing Info

Package Includes:

  • CPL01 Open/Close Sensor x 1

     

9. 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.

     

Tags:
    
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0