MOKO-logo.

MOKO LW007-PIR LoRaWAN Pir Motion Detect Sensor

MOKO LW007-PIR-LoRaWAN-Pir-Motion-Detect-Sensor-ptoduct.

Specifications

  • Product Model: LW007-PIR
  • Version: 1.0
  • Manufacturer: MOKO TECHNOLOGY LTD.
  • Website: www.mokosmart.com

Product Usage Instructions

  • Control Command
    • The control command has three main parts: device parameters read, device parameters write, and control commands.
  •  Read PIR State
    • To read the PIR state, send the following command in Port 1:
    • Command: 58
    • Length (Byte): 1
    • Example: Send: 58 00
    • Response: The response data will indicate the PIR state.
  •  Restart the Device
    • To restart the device, send the following command in Port 2:
    • Command: 50
    • Length (Byte): 0
    • Example: Send: 50 00
    • Response: The device will restart.

Read Device’s Parameters

The downlink command for parameter read will be sent in Port 3.

Read Region of Device

To read the region of the device, send the following command:

  • Command: 01
  • Length (Bytes): 1
  • Example: Send: 01 00
  • Response: The response will indicate the region of the device.

Read LoRaWAN Mode

To read the LoRaWAN mode, send the following command:

  • Command: 02
  • Length (Bytes): 1
  • Example: Send: 02 00
  • Response: The response will indicate the LoRaWAN mode.

FAQs

Q: How do I restart the device?

A: To restart the device, send the command ’50’ in Port 2 with a length of 0 bytes.

Q: How can I read the PIR state?

A: To read the PIR state, send the command ’58’ in Port 1 with a length of 1 byte.

About this Manual

The purpose of this manual is to outline how to use Downlink Command for LW007-PIR.

Downlink Command

  • The downlink command has three main parts: device parameters read, device parameters write and control commands.

Control Command

  • The following command will be sent in Port 1.
Command Description CMD LEN (Byte) Example
Read PIR state 58 1 Send: 58 00

Response: 58 11 01 01

(01 means motion detected; 00 means no motion detected; FF means PIR detection function is off)

Read door detection status 59 3 Send: 59 00

Response: 59 11 03 01 00 0A

(The red part refers to door status: 01 means open; 00 means close.

The green part refers to total door detection trigger times: Convert to decimal, 00 0A means total door detection trigger

times is 10)

Read T&H data 5A 4 Send: 5A 00

Response: 5A 11 04 00 01 00 02

(The red part refers to temperature: Convert to decimal, the unit is 0.1℃.The base value is -30℃. The current temperature is -29.9℃(-30℃+0.1℃)

The green part refers to humidity

Convert to decimal, 00 02 means the current humidity is 2%)

The following command will be sent in Port 2.

Command Description CMD LEN

(Byte)

Example
Restart the device 50 0 Send: 50 00

Response: The device will restart.

Factory reset the device 51 0 Send: 51 00

Response: The device will factory reset.

Turn off the device 52 0 Send: 52 00

Response: The device will be off.

Sync the time 53 0 Send: 53 00

Response: The device time will be synced.

Open the Bluetooth broadcast 5B 0 Send: 5B 00

Response: The device will start Bluetooth broadcast until timeout.

Read Device’s Parameters

  • The downlink command of parameter read will be sent in Port 3
  • The downlink command for parameter read only consists CMD + 00.
Byte Index Content Description
Byte 0 CMD Different parameters have different CMD
Byte 1 00
  • The response payload for these downlink commands consists of four parts: CMD, INDEX, LEN and DATA.
Byte Index Content Description
Byte 0 CMD Different parameters have different CMD
Byte 1 INDEX High value represents the total number of response payloads, low value represents the order of the current payload. For example, the INDEX is 52, it means that the total response payloads are 5, current payload is 2th response payload.
Byte 2 LEN The length of “DATA” part
Byte 3-XX DATA The value of the parameter
  • The instructions and examples of parameter read are as follows:
Command Description CMD LEN (Bytes) Example
Read region of device 01 1 Send: 01 00

Response: 01 11 01 05

(00 means AS923; 01 means AU915; 02 means CN470; 03

means CN779; 04 means EU443; 05 means EU868; 06 means KR920; 07 means IN865; 08 means US915; 09 means RU864)

Read LoRaWAN mode 02 1 Send: 02 00

Response: 02 11 01 01(01 means ABP; 02 means OTAA. The LoRaWAN mode is ABP)

Read DEVEUI 03 8 Send: 03 00

Response: 03 11 08 11 22 33 44 55 66 77 88(The DEVEUI is

11 22 33 44 55 66 77 88)

Read APPEUI 04 8 Send: 04 00

Response: 04 11 08 11 22 33 44 55 66 77 88(The APPEUI is

11 22 33 44 55 66 77 88)

Read APPKEY 05 16 Send: 05 00

Response payload 1: 05 21 08 2B 7E 15 16 28 AE D2 A6

Response payload 2: 05 22 08 AB F7 15 88 09 CF 4F 3C

(The APPKEY is 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Read DEVADDR 06 04 Send: 06 00

Response: 06 11 04 11 22 33 44

(The DEVADDR is 11 22 33 44)

Read APPSKEY 07 16 Send: 07 00

Response payload 1: 07 21 08 2B 7E 15 16 28 AE D2 A6

Response payload 2: 07 22 08 AB F7 15 88 09 CF 4F 3C

(The APPSKEY is 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Read NWKSKEY 08 16 Send: 08 00

Response payload 1: 08 21 08 2B 7E 15 16 28 AE D2 A6

Response payload 2: 08 22 08 AB F7 15 88 09 CF 4F 3C

(The NWKSKEY is 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Read uplink message type 09 1 Send: 09 00

Response: 09 11 01 01

(00 means unconfirmed message; 01 means confirmed message)

Read max retransmission times 0A 1 Send: 0A 00

Response: 0A 11 01 03

(Convert to decimal, then minus 1. The max retransmission times are 2)

Read CH 0B 2 Send: 0B 00

Response: 0B 11 02 08 0F (Convert to decimal. The CH is from 8 to 15)

Read DR for join 0C 1 Send: 0C 00

Response: 0C 11 01 00 (Convert to decimal. The DR of join is DR0)

Read Uplink strategy 0D 3 Send: 0D 00

Response: 0D 11 03 01 00 05

(The 1st byte represents ADR function, 01 means ADR ON, 00 means ADR OFF; The 2nd byte and 3rd byte represents DR for payload, convert to decimal, DR for payload is DR0 ~ DR5)

Read function switch of duty-cycle 0E 1 Send: 0E 00

Response: 0E 11 01 01 (00 means OFF; 01 means ON)

Read Time Sync interval 0F 1 Send: 0F 00

Response: 0F 11 01 08

(Convert to decimal, the unit is H. The time sync interval is 8H)

Read Network check interval 10 1 Send: 10 00

Response: 10 11 01 05

(Convert to decimal, the unit is H. The network check interval is 5H)

Read Bluetooth broadcast mode 21 1 Send: 21 00

Response: 21 11 01 01 (01 means beacon mode)

Read connectable state 22 1 Send: 22 00

Response: 22 11 01 01

(00 means unconnectable; 01 means connectable)

Read Bluetooth broadcast timeout 23 1 Send: 23 00

Response: 23 11 01 03

(Convert to decimal, the unit is mins. The Bluetooth broadcast timeout is 3 mins)

Read function switch of login password 24 1 Send: 24 00

Response: 24 11 01 01

(00 means no need login password; 01 means need login password)

Read Bluetooth Tx Power 25 1 Send: 25 00

Response: 25 11 01 04

(It is a signed number, convert to decimal, the unit is dBm. The Bluetooth TX is 4 dBm)

Read ADV Name 26 0~16 Send: 26 00

Response payload 1: 26 21 08 4C 57 30 30 35 2D 4D 50

Response payload 2: 26 22 05 2D 38 39 45 44 (Convert to ASCII. The ADV Name is LW005-MP-89ED)

Read PIR function switch 30 1 Send: 30 00

Response: 30 11 01 01

(00 means OFF; 01 means ON)

Read PIR report interval 31 1 Send: 31 00

Response: 31 11 01 03

(Convert to decimal, the unit is mins. The PIR report interval is 3 mins)

Read PIR sensitivity 32 1 Send: 32 00

Response: 32 11 01 03

(01 means low; 02 means medium; 03 means high)

Read PIR delay time 33 1 Send: 33 00

Response: 33 11 01 03

(01 means low; 02 means medium; 03 means high)

Read door detection function switch 34 1 Send: 34 00

Response: 34 11 01 01

(00 means OFF; 01 means ON)

Read T&H function switch 35 1 Send: 35 00

Response: 35 11 01 01

(00 means OFF; 01 means ON)

Read T&H sample rate 36 1 Send: 36 00

Response: 36 11 01 03

(Convert to decimal, the unit is s. The sample rate is 3 s)
Read temperature threshold alarm function switch 37 1 Send: 37 00

Response: 37 11 01 01

(00 means OFF; 01 means ON)

Read temperature threshold alarm value 38 2 Send: 38 00

Response: 38 11 02 05 10

(It is two signed number. Convert to decimal, the unit is ℃. 05 means the lower threshold is 5 ℃, 10 means the upper

thresholds is 16℃.)

Read temperature change alarm function

switch

3A 1 Send: 3A 00

Response: 3A 11 01 01

(00 means OFF; 01 means ON)

Read temperature change alarm duration condition 3B 1 Send: 3B 00

Response: 3B 11 01 01

(Convert to decimal, the unit is H. The duration condition is 1 H)

Read temperature change alarm value threshold 3C 1 Send: 3C 00

Response: 3C 11 01 01

(Convert to decimal, the unit is ℃. The alarm value

threshold is 1 ℃)

Read humidity threshold alarm

function switch

3D 1 Send: 3D 00

Response: 3D 11 01 01

(00 means OFF; 01 means ON)

Read humidity threshold alarm value 3E 2 Send: 3E 00

Response: 3E 11 02 10 20

(Convert to decimal, the unit is %. 10 means the lower threshold is 16%, 20 means the upper thresholds is 32%.)

Read humidity change alarm function switch 40 1 Send: 40 00

Response: 40 11 01 01

(00 means OFF; 01 means ON)

Read humidity change alarm duration condition 41 1 Send: 41 00

Response: 41 11 01 01

(Convert to decimal, the unit is H. The duration condition is 1 H)

Read humidity change alarm value threshold 42 1 Send: 42 00

Response: 42 11 01 01

(Convert to decimal, the unit is %. The alarm value threshold is 1 %)

Read time zone 43 1 Send: 43 00

Response: 43 11 01 04

(It is a signed number. Convert to decimal, then divide 2. The time zone is UTC+2)

Read login password 44 8 Send: 44 00

Response: 44 11 08 4D 6F 6B 6F 34 33 32 31

(Convert to ASCII. The login password is Moko4321)

Read heartbeat 46 2 Send: 46 00
interval Response: 46 11 02 00 03

(Convert to decimal, the unit is mins. The heartbeat interval is 3 mins)

Read low power payload report function switch 48 1 Send: 48 00

Response: 48 11 01 01

(00 means OFF; 01 means ON)

Read led indicator function switch 49 1 Send: 48 00

Response: 48 11 01 01

(00 means OFF; 01 means ON)

Configure Device’s Parameters

  • The downlink command of parameter configuration will be sent in Port 4.
  • The downlink command for parameter configuration consists of three parts: CMD, LEN and DATA.
Byte Index Content Description
Byte 0 CMD Different parameters have different CMD
Byte 1 LEN The length of “DATA” part
Byte 2-XX DATA The setting value of parameter
  • The response payload for these commands consists of four parts: CMD, INDEX, LEN and DATA
Byte Index Content Description
Byte 0 CMD Different parameters have different CMD
Byte 1 LEN The value of this part is fixed at 0x01
Byte 2 DATA 00 means configure failed; 01 means configure successfully.

For example:

  • Now, we need configure LoRaWAN mode to ABP mode.
  • At firstly, send: 02 01 01
  • If the response payload content is 02 01 01, It means configure successfully. If the response payload content is 02 01 00, It means configure failed.
  • The instructions and examples of parameter configuration are as follows:
  • Now, we need configure LoRaWAN mode to ABP mode.
  • The instructions and examples of parameter configuration are as follows
Command Description CMD LEN

(Bytes)

Example
Configure region of device 01 1 Send: 01 01 01

(00 means AS923; 01 means AU915; 02 means CN470; 03 means

CN779; 04 means EU443; 05 means EU868; 06 means KR920; 07 means IN865; 08 means US915; 09 means RU864)

Configure LoRaWAN mode 02 1 Send: 02 01 01

(01 means ABP; 02 means OTAA. The LoRaWAN mode is ABP)

Configure DEVEUI 03 8 Send: 03 08 11 22 33 44 55 66 77 88

(Configure the DEVEUI to 11 22 33 44 55 66 77 88)

Configure APPEUI 04 8 Send: 04 08 11 22 33 44 55 66 77 88

(Configure the APPEUI to 11 22 33 44 55 66 77 88)

Configure APPKEY 05 16 Send: 05 10 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C

(Configure the APPKEY to 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Configure DEVADDR 06 04 Send: 06 04 11 22 33 44

(Configure the DEVADDR to 11 22 33 44)

Configure APPSKEY 07 16 Send: 07 10 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C

(Configure the APPSKEY to 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Configure NWKSKEY 08 16 Send: 08 10 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C

(Configure the NWKSKEY to 2B 7E 15 16 28 AE D2 A6 AB F7 15 88 09 CF 4F 3C)

Configure uplink message type 09 1 Send: 09 01 01

(00 means unconfirmed message; 01 means confirmed message)

Configure max retransmission times 0A 1 Send: 0A 01 03

(Convert to decimal, then minus 1. Configure the max retransmission times to 2. It ranges from 0~7)

Configure CH 0B 2 Send: 0B 02 08 0F

(Convert to decimal. It means configure the CH to 8 ~15)

Configure DR for join 0C 1 Send: 0C 01 00

(Convert to decimal. Configure the DR of join to DR0)

Configure Uplink strategy 0D 3 Send: 0D 03 01 00 05

(The 1st byte represents ADR function, 01 means ADR ON, 00 means ADR OFF; The 2nd byte and 3rd byte represents DR for payload, convert to decimal, configure DR for payload to DR0 ~ DR5)

Configure function switch of duty-cycle 0E 1 Send: 0E 01 01

(00 means OFF; 01 means ON)

Configure Time Sync interval 0F 1 Send: 0F 01 08

(Convert to decimal, the unit is H. Configure the time sync interval to 8H)

Configure Network check interval 10 1 Send: 10 01 05

(Convert to decimal, the unit is H. Configure the network check interval to 5H)

Configure Bluetooth broadcast mode 21 1 Send: 21 01 01

(01 means beacon mode; 00 means not beacon mode)

Configure connectable state 22 1 Send: 22 01 01

(00 means unconnectable; 01 means connectable)

Configure Bluetooth broadcast timeout 23 1 Send: 23 01 03

(Convert to decimal, the unit is mins. Configure the Bluetooth broadcast timeout to 3 mins, it ranges from 1~60 mins)

Configure function

switch of login password

24 1 Send: 24 01 01

(00 means no need login password; 01 means need login password)

Configure Bluetooth Tx Power 25 1 Send: 25 01 04

(It is a signed number, convert to decimal, the unit is dBm. The Bluetooth TX is 4 dBm, it can be set to 40 or -20 or -16 or -12 or – 8 or -4 or 0 or 3 or 4)

Configure ADV Name 26 0~16 Send: 26 0D 4C 57 30 30 35 2D 4D 50 2D 38 39 45 44

(Convert to ASCII. Configure the ADV Name to LW005-MP-89ED, it can be from 0~16 characters)

Configure PIR function switch 30 1 Send: 30 01 01

(00 means OFF; 01 means ON)

Configure PIR report interval 31 1 Send: 31 01 03

(Convert to decimal, the unit is mins. Configure the PIR report interval to 3 mins, it ranges from 1~60mins)

Configure PIR sensitivity 32 1 Send: 32 01 03

(01 means low; 02 means medium; 03 means high)

Configure PIR delay time 33 1 Send: 33 01 03

(01 means low; 02 means medium; 03 means high)

Configure door detection function switch 34 1 Send: 34 01 01

(00 means OFF; 01 means ON)

Configure T&H function switch 35 1 Send: 35 01 01

(00 means OFF; 01 means ON)

Configure T&H sample rate 36 1 Send: 36 01 03

(Convert to decimal, the unit is s. Configure the sample rate to 3 s, it ranges from 1~60s)

Configure temperature threshold alarm function switch 37 1 Send: 37 01 01

(00 means OFF; 01 means ON)

Configure temperature threshold alarm value 38 2 Send: 38 11 02 05 10

(It is two signed number. Convert to decimal, the unit is ℃. 05 means configure the lower threshold to 5 ℃, 10 means the

configure upper thresholds to 16℃. It ranges from -30℃ ~60℃)

Configure temperature change alarm function switch 3A 1 Send: 3A 01 01

(00 means OFF; 01 means ON)

Configure temperature change alarm duration condition 3B 1 Send: 3B 01 01

(Convert to decimal, the unit is H. Configure the duration condition to 1 H. It ranges from 1~24H)

Configure temperature change alarm value threshold 3C 1 Send: 3C 01 01

(Convert to decimal, the unit is ℃. Configure the alarm value

threshold is 1 ℃)

Configure humidity threshold alarm function switch 3D 1 Send: 3D 01 01

(00 means OFF; 01 means ON)

Configure humidity threshold alarm value 3E 2 Send: 3E 02 05 10

(Convert to decimal, the unit is %. 05 means configure the lower threshold to 5%, 10 means the configure upper thresholds to

10%. It ranges from 0% ~100%)
Configure humidity change alarm function switch 40 1 Send: 40 01 01

(00 means OFF; 01 means ON)

Configure humidity change alarm duration condition 41 1 Send: 41 01 01

(Convert to decimal, the unit is H. Configure the sample rate to 1 H, it ranges from 1~24H.)

Configure humidity change alarm value threshold 42 1 Send: 42 01 01

(Convert to decimal, the unit is %. Configure the sample rate to 1 %, it ranges from 1%~100%.)

Configure time zone 43 1 Send: 43 01 04

(It is a signed number. Convert to decimal, then divide 2.

Configure the time zone to UTC+2, it ranges from UTC- 12~UTC+14.)

Configure login password 44 8 Send: 44 08 4D 6F 6B 6F 34 33 32 31

(Convert to ASCII. Configure the login password to Moko4321. it can be to 8 characters)

Configure heartbeat interval 46 2 Send: 46 02 00 03

(Convert to decimal, the unit is mins. Configure the heartbeat interval to 3 mins, it ranges from 1~14400mins.)

Configure low power payload report function switch 48 1 Send: 48 01 01

(00 means OFF; 01 means ON)

Configure led indicator function switch 49 1 Send: 48 01 01

(00 means OFF; 01 means ON)

Revision History

Version Description Editor Date
1.0 Initial version Allen 2022-02-18

MORE INFO

MOKO TECHNOLOGY LTD.

Documents / Resources

MOKO LW007-PIR LoRaWAN Pir Motion Detect Sensor [pdf] Instruction Manual
LW007-PIR LoRaWAN Pir Motion Detect Sensor, LW007-PIR, LoRaWAN Pir Motion Detect Sensor, Pir Motion Detect Sensor, Motion Detect Sensor, Detect Sensor, Sensor

References

Leave a comment

Your email address will not be published. Required fields are marked *