Table of Contents:
- 1. Introduction
- 2. Use CPN01 to communicate with IoT Server
- 2.1 How it works
- 2.2 Configure CPN01
- 2.3 Uplink Payload
- 2.4 Payload Explanation and Sensor Interface
- 2.5 Downlink Payload
- 2.6 LED Indicator
- 2.7 Alarm Base on Timeout
- 2.8 Set debug mode
- 2.9 Clear Flash Record
- 2.10 Set trigger mode
- 2.11 Set the calculate flag
- 2.12 Set count number
- 2.13 Set the number of data to be uploaded and the recording time
- 2.14 Read or Clear cached data
- 2.15 Firmware Change Log
- 2.16 Battery Analysis
- 3. Access NB-IoT Module
- 4. Using the AT Commands
- 5. FAQ
- 6. Trouble Shooting
- 7. Order Info
- 8. Packing Info
- 9. Support
1. Introduction
1.1 What is CPN01 NB-IoT Pulse/Contact Sensor
The Dragino CPN01 is an NB-IoT Dry Contact Sensor. It detects open/close status and uplinks the info to IoT server via NB-IoT network. User can see the dry contact status, open time, and open counts in the IoT Server.
The CPN01 will send periodically data every day as well as for each dry contact action. It also counts the contact open times and calculates the last open duration. Users can also disable the uplink for each Open/Close event, instead, device can count each open event and uplink periodically.
CPN01 has Open-Alarm feature, user can set this feature so CPN01 will send an alarm if the contact has been open exceeds a certain time.
CPN01 is designed for outdoor use. It has a weatherproof enclosure and industrial-level battery to work in low to high temperatures.
NarrowBand-Internet of Things (NB-IoT) is a standards-based low power wide area (LPWA) technology developed to enable a wide range of new IoT devices and services. NB-IoT significantly improves the power consumption of user devices, system capacity, and spectrum efficiency, especially in deep coverage.
CPN01 supports different uplink methods including TCP, MQTT, UDP, and CoAP for different application requirements.
CPN01 is powered by 8500mAh Li-SOCI2 battery, It is designed for long-term use of up to 5 years. (Actually Battery life depends on the use environment, update period & uplink method)
To use CPN01, user needs to check if there is NB-IoT coverage in the field and with the Nb-IoT bands that CPN01 supports. If local operator support it, user needs to get a NB-IoT SIM card from the operator and install into CPN01 to get NB-IoT network connection.
1.2 Features
- NB-IoT Bands: B1/B3/B8/B5/B20/B28 @H-FDD
- Open/Close detect
- Open/Close statistics
- Monitor Battery Level
- Uplink on periodically and open/close event
- Datalog feature
- Uplink periodically
- Downlink to change configure
- Wall Mountable
- Outdoor Use
- Ultra-Low Power consumption
- AT Commands to change parameters
- Micro SIM card slot for NB-IoT SIM
- 8500mAh Battery for long-term use
1.3 Specification
Common DC Characteristics:
- Supply Voltage: 2.1v ~ 3.6v
- Operating Temperature: -40 ~ 85°C
NB-IoT Spec:
- - B1 @H-FDD: 2100MHz
- - B3 @H-FDD: 1800MHz
- - B8 @H-FDD: 900MHz
- - B5 @H-FDD: 850MHz
- - B20 @H-FDD: 800MHz
- - B28 @H-FDD: 700MHz
1.4 Installation
Connect CPN01 to an Open Close sensor like below. So it can detect the Open/Close event.
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
CPN01 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 LSN50v2 User Manual.
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. The firmware won't run.
2) Flash: working mode, the device starts to work for NB-IoT connection and sends out console output for further debugging.
1.7.4 Reset Button
Press to reboot the device.
1.7.5 LED
The LED will blink when :
1. Boot the device in flash mode
2. Send an uplink packet
2. Use CPN01 to communicate with IoT Server
2.1 How it works
The CPN01 is equipped with an NB-IoT module, the pre-loaded firmware in CPN01 will get Open/Close Event or Count from sensor and send the value to the NB-IoT network. The NB-IoT network will forward this value to IoT server via the protocol defined by CPN01.
The diagram below shows the working flow in the default firmware of CPN01:
2.2 Configure CPN01
2.2.1 Test Requirement
To use CPN01 in your city, make sure to meet below requirements:
- Your local operator has already distributed an NB-IoT Network.
- The local NB-IoT network used the band that CPN01 supports.
- Your operator is able to distribute the data received in their NB-IoT network to your IoT server.
Below figure shows our testing structure. Here we have NB-IoT network coverage by China Mobile, the band they use is B8. The CPN01 will use CoAP(120.24.4.116:5683) or raw UDP(120.24.4.116:5601) or MQTT(120.24.4.116:1883) or TCP(120.24.4.116:5600)protocol to send data to the test server.
2.2.2 Insert NB-IoT SIM card
Insert the NB-IoT Card get from your provider.
User needs to take out the NB-IoT module and insert the SIM card like below:
2.2.3 Connect USB – TTL to CPN01 and configure it
User need to configure CPN01 via serial port to set the Server Address / Uplink Topic to define where and how-to uplink packets. CPN01 support AT Commands, user can use a USB to TTL adapter to connect to CPN01 and use AT Commands to configure it, as below.
Connection:
USB TTL GND <----> GND
USB TTL TXD <----> UART_RXD
USB TTL RXD <----> UART_TXD
In the PC, use below serial tool settings:
- Baud: 9600
- Data bits: 8
- Stop bits: 1
- Parity: None
- Flow Control: None
Make sure the switch is in FLASH position, then power on CPN01 by connecting the Yellow Jumper.
CPN01 will output system info once powered on as below, we can enter the password: 12345678 to access AT Command input.
Note: the valid AT Commands can be found at: https://www.dropbox.com/sh/351dwor6joz8nwh/AADn1BQaAAxLF_QMyU8NkW47a?dl=0
2.2.4 Use CoAP protocol to uplink data
Note: if you don't have a CoAP server, you can refer this link to set up a CoAP server: http://wiki.dragino.com/xwiki/bin/view/Main/Set%20up%20CoAP%20Server/
Use below commands in CPN01:
- AT+PRO=1 // Set to use CoAP protocol to uplink
- AT+SERVADDR=120.24.4.116,5683 // Set CoAP server address and port
- AT+URI=0,0,11,2,"mqtt" // Set CoAP resource path
For parameter description, please refer to AT command set
After configuring the server address and reset CPN01 (via AT+ATZ ), CPN01 will start to uplink sensor values to the CoAP server.
2.2.5 Use UDP protocol to uplink data(Default protocol)
AT Commands:
- AT+PRO=2 // Set to use UDP protocol to uplink
- AT+SERVADDR=120.24.4.116,5601 // Set UDP server address and port
- AT+CFM=1 // If the server does not respond, this command is unnecessary
2.2.6 Use MQTT protocol to uplink data
AT Commands:
- AT+PRO=3 // Set to use MQTT protocol to uplink
- AT+SERVADDR=120.24.4.116,1883 // Set MQTT server address and port
- AT+CLIENT=CLIENT // Set up the CLIENT of MQTT
- AT+UNAME=UNAME // Set the username of MQTT
- AT+PWD=PWD // Set the password of MQTT
- AT+PUBTOPIC=NSE01_PUB // Set the sending topic of MQTT
- AT+SUBTOPIC=NSE01_SUB // Set the subscription topic of MQTT
MQTT protocol has a much higher power consumption compare with UDP / CoAP protocol. Please check the power analyze document and adjust the uplink period to a suitable interval.
2.2.7 Use TCP protocol to uplink data
AT Commands:
- AT+PRO=4 // Set to use TCP protocol to uplink
- AT+SERVADDR=120.24.4.116,5600 // Set TCP server address and port
2.2.8 Change Update Interval
User can use below command to change the uplink interval.
- AT+TDC=7200 // Set Update Interval to 7200s (2 hours)
NOTE:
1. By default, the device will send an uplink message every 1 hour.
2.3 Uplink Payload
The uplink payload includes 123 bytes in total by default.
Each time the device uploads a data package, 8 sets of recorded data will be attached. Up to 32 sets of recorded data can be uploaded.
Size(bytes) | 8 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 3 |
---|---|---|---|---|---|---|---|---|---|
Value | Device ID | Ver | BAT | Signal Strength | MOD | Calculate Flag | Contact Status | Alarm | Total pulse |
3 | 4 | 1 | 3 | 1 | 3 | 4 | 8 group |
The last open duration | Time stamp | Contact Status | Total pulse | Calculate Flag | The last open duration | Time stamp | ... |
If we use the MQTT client to subscribe to this MQTT topic, we can see the following information when the CPN01 uplink data.
The payload is ASCII string, representative same HEX:
0x f867787050213317 0064 0c78 17 01 00 00 00 09 02 6315537b 01 00000b 02 0000026 63510fed 0100000e0200000263510f39 010000000000000063510e85 010000000000000063510d2e 010000000000000063510c7a 010000000000000063510bc6 010000000000000063510954 010000000000000063510882
where:
- Device ID: 0x f867787050213317 = f867787050213317
- Version: 0x0064=100=1.0.0
- BAT: 0x0c78 = 3192 mV = 3.192V
- Singal: 0x17 = 23
- Mod: 0x01 = 1
- Calculate Flag: 0x00=0
- Contact Status: 0x00=0
- Alarm: 0x00 =0
- Total pulse: 0x09 =0
- The last open duration: 0x02 =2
- Time stamp : 0x6315537b =1662342011 (Unix Time)
- Contact Status, Total pulse, Calculate Flag, The last open duration ,Time stamp : 01 00000b 02 000026 63510fed
- 8 sets of recorded data: Contact Status, Total pulse, Calculate Flag, The last open duration ,Time stamp : 0100000e0200002663510f39,.......
2.4 Payload Explanation and Sensor Interface
2.4.1 Device ID
By default, the Device ID is equal to the last 15 bits of IMEI.
User can use AT+DEUI to set Device ID
Example:
AT+DEUI=868411056754138
The Device ID is stored in a non-erase area, Upgrade the firmware or run AT+FDR won't erase the Device ID.
2.4.2 Version Info
Specify the software version: 0x64=100, which means firmware version 1.00.
For example 0x00 64 : This device is CPN01 with firmware version 1.0.0.
2.4.3 Battery Info
Check the battery voltage for CPN01.
Ex1: 0x0B45 = 2885mV
Ex2: 0x0B49 = 2889mV
2.4.4 Signal Strength
NB-IoT Network signal Strength.
Ex1: 0x1d = 29
0 -113dBm or less
1 -111dBm
2...30 -109dBm... -53dBm
31 -51dBm or greater
99 Not known or not detectable
2.4.5 Calculate Flag
The calculate flag is a user defined field, IoT server can use this filed to handle different meters with different pulse factors. 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
2.4.6 Alarm
2.4.7 Contact Status
0: Open
1: Close
2.4.8 Total pulse
Total pulse/counting based on dry contact trigger event
Range (3 Bytes) : 0x000000 ~ 0xFFFFFF . Max: 16777215
2.4.9 The last open duration
Dry Contact last open duration.
Unit: min.
2.4.10 Timestamp
Timestamp : 0x6315537b =1662342011
Convert Unix timestamp to time 2022-9-5 9:40:11.
2.5 Downlink Payload
By default, CPN01 prints the downlink payload to console port.
Examples:
- Set TDC
If the payload=0100003C, it means set the END Node's TDC to 0x00003C=60(S), while type code is 01.
Payload: 01 00 00 1E TDC=30S
Payload: 01 00 00 3C TDC=60S
- Reset
If payload = 0x04FF, it will reset the NSE01
- INTMOD
Downlink Payload: 06000003, Set AT+INTMOD=3
2.6 LED Indicator
The CPN01 has an internal LED which is to show the status of different states.
- When the device starts normally, the LED will light up for 1 second.
- After CPN01 join NB-IoT network. The LED will be ON for 3 seconds.
- For each uplink probe, LED will be on for 500ms.
2.7 Alarm Base on Timeout
CPN01 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 connected to disconnect, and device remains in disconnect status for more than 30 seconds. CPN01 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+TTRIG=0,0 --> Default Value, disable timeout Alarm.
2.8 Set debug mode
Feature: Enable or Disable debug mode
AT Command: AT+DEBUG
2.9 Clear Flash Record
Feature: Clear flash storage for data log feature.
AT Command: AT+CLRDTA
2.10 Set trigger mode
AT Command: AT+TTRMOD
Feature: Set the trigger interrupt mode.
2.11 Set the calculate flag
Feature: Set the calculate flag
AT Command: AT+CALCFLAG
2.12 Set count number
Feature: Manually set the count number
AT Command: AT+SETCNT
2.13 Set the number of data to be uploaded and the recording time
AT Command:
AT+TR=900 // The unit is seconds, and the default is to record data once every 900 seconds.( The minimum can be set to 180 seconds)
AT+NOUD=8 // The device uploads 8 sets of recorded data by default. Up to 32 sets of record data can be uploaded.
2.14 Read or Clear cached data
AT Command:
AT+CDP // Read cached data
AT+CDP=0 // Clear cached data
2.15 Firmware Change Log
Download URL & Firmware Change log: https://www.dropbox.com/sh/8p5nuvo6gh7je4n/AAAMP7MMusgbXMz9Ik7Ls03Ga?dl=0
Upgrade Instruction: Upgrade Firmware
2.16 Battery Analysis
2.16.1 Battery Type
The CPN01 battery is a combination of an 8500mAh Li/SOCI2 Battery and a Super Capacitor. The battery is non-rechargeable battery type with a low discharge rate (<2% per year). This type of battery is commonly used in IoT devices such as water meter.
The battery is designed to last for several years depends on the actual use environment and update interval.
The battery-related documents as below:
2.16.2 Power consumption Analyze
Dragino battery powered product are all runs in Low Power mode. We have an update battery calculator which base on the measurement of the real device. User can use this calculator to check the battery life and calculate the battery life if want to use different transmit interval.
Instruction to use as below:
Step 1: Downlink the up-to-date DRAGINO_Battery_Life_Prediction_Table.xlsx from: https://www.dragino.com/downloads/index.php?dir=LoRa_End_Node/Battery_Analyze/
Step 2: Open it and choose
- Product Model
- Uplink Interval
- Working Mode
And the Life expectation in difference case will be shown on the right.
2.16.3 Battery Note
The Li-SICO battery is designed for small current / long period application. 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 time to transmit LoRa, then the battery life may be decreased.
2.16.4 Replace the battery
The default battery pack of CPN01 includes a ER26500 plus super capacitor. If user can't find this pack locally, they can find ER26500 or equivalence without the SPC1520 capacitor, which will also work in most case. The SPC can enlarge the battery life for high frequency use (update period below 5 minutes).
3. Access NB-IoT Module
Users can directly access the AT command set of the NB-IoT module.
The AT Command set can refer the BC35-G NB-IoT Module AT Command: https://www.dragino.com/downloads/index.php?dir=datasheet/other_vendors/BC35-G/
4. Using the AT Commands
4.1 Access AT Commands
See this link for detail: https://www.dropbox.com/sh/351dwor6joz8nwh/AADn1BQaAAxLF_QMyU8NkW47a?dl=0
AT+<CMD>? : Help on <CMD>
AT+<CMD> : Run <CMD>
AT+<CMD>=<value> : Set the value
AT+<CMD>=? : Get the value
General Commands
AT : Attention
AT? : Short Help
ATZ : MCU Reset
AT+TDC : Application Data Transmission Interval
AT+CFG : Print all configurations
AT+CFGMOD : Working mode selection
AT+INTMOD : Set the trigger interrupt mode
AT+5VT : Set extend the time of 5V power
AT+PRO : Choose agreement
AT+RXDL : Extend the sending and receiving time
AT+SERVADDR : Server Address
AT+TR : Get or Set record time
AT+NOUD : Get or Set the number of data to be uploaded
AT+CDP : Read or Clear cached data
AT+ DEBUG : Enable or Disable debug mode
AT+ TTRIG : Get or Set Alarm Base on Timeout
AT+ TTRMOD : Get or Set the trigger interrupt mode(0:falling,1:rising)
AT+ CALCFLAG : Get or Set the calculate flag
AT+ CLRC : Clear current door open count
COAP Management
AT+URI : Resource parameters
UDP Management
AT+CFM : Upload confirmation mode (only valid for UDP)
MQTT Management
AT+CLIENT : Get or Set MQTT client
AT+UNAME : Get or Set MQTT Username
AT+PWD : Get or Set MQTT password
AT+PUBTOPIC : Get or Set MQTT publish topic
AT+SUBTOPIC : Get or Set MQTT subscription topic
Information
AT+FDR : Factory Data Reset
AT+PWORD : Serial Access Password
5. FAQ
5.1 How to Upgrade Firmware
User can upgrade the firmware for 1) bug fix, 2) new feature release.
Please see this link for how to upgrade: http://wiki.dragino.com/xwiki/bin/view/Main/Firmware%20Upgrade%20Instruction%20for%20STM32%20base%20products/#H2.HardwareUpgradeMethodSupportList
Notice: CPN01 and CPL01 share the same mother board. They use the same connection and method to update.
6. Trouble Shooting
6.1 Connection problem when uploading firmware
6.2 AT Command 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: CPN01
8. Packing Info
Package Includes:
- CPN01 Open/Close Sensor x 1
- External antenna x 1
Dimension and weight:
- Size: 195 x 125 x 55 mm
- Weight: 420g
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 enquiry (product models, accurately describe your problem and steps to replicate it etc) and send a mail to support@dragino.com