Milesight D2D featuring LoRa is a device to device communication protocol developed by Milesight and executed only among Milesight branded end nodes. There are benefits with Milesight D2D protocol:
- Low latency: peer to peer communication without any gateway
- Low consumption: based on low power LoRa technology
- Wide range: long transmission range as standard LoRaWAN®
- Security: support AES128 encryption algorithm to ensure secure communication
- Multicast: support control in bulks
The basic structure of Milesight D2D is consist of D2D Controller Devices and D2D Agent Devices. When triggering condition of D2D Controller device is meet (any button is pressed or sensor value reaches the threshold), D2D Controller device will send a user-defined command to corresponding D2D Agent devices to control lights, fans or other appliances.
Here are the lists of D2D Controller Devices and corresponding triggering conditions:
Short press, long press or double press
Any button is pressed
PIR and light status is occupied/bright, occupied/dark, vacant
Door close or open (magnet absorb or separate)
Occupied or vacant
Any RS485 Modbus value reaches the threshold
|UC300 (LoRaWAN)||Any DI status reaches the threshold condition|
|GS301||NH3 or H2S value reaches the threshold or not|
1. Temperature reaches the threshold or not
2. MCS sensor (door) open or close
3. Water is leaked or not
Note: ensure EM300 series hardware version is V3.x and firmware version is V1.5 or later.
Here are the lists of D2D Agent Devices and corresponding controlling actions:
Any button on, off or inverse
Any output on, off or inverse
2. Send customized Modbus command to RS485 terminal devices
1. Control DO to on or off
2. Send customized Modbus command to RS485 terminal devices
Milesight D2D can be widely used on many indoor applications like smart offices, smart buildings, etc. In this article, we provide a smart office application example to realize a quick control without gateway.
Button 1 works as day mode——UC300 opens the fan, UC100 opens the curtain, WS502 switches off the lights; the control command is 40e1.
Button 2 works as night mode——UC300 closes the fan, UC100 draws the curtain, WS502 switches on the lights; the control command is 40e0.
When PIR status is occupied and light is bright, WS502 switches on the lights; the control command is 40e0.
When PIR status is vacant, WS502 switches off the lights; the control command is 40e1.
- Milesight D2D Controller: WS156, WS202
- Milesight D2D Agent: UC100, UC300 (LoRaWAN), WS502
- Milesight ToolBox App: download from Google Play or App Store
- ToolBox Software: download here
All above devices should use the same frequency plan.
D2D Controller Configurations
1. Open Milesight ToolBox App on a NFC-enabled smartphone and attach the NFC area to the device to read the basic information of D2D Controller devices.
2. Go to Setting > LoRaWAN Settings, set the RX2 frequency and RX2 datarate which will be used to send control commands. It is suggested to change the default parameters to avoid transmission conflicts.
3. Enable D2D feature and define an unique D2D key (length: 16 to 32) for every device. The default value is 5572404c696e6b4c6f52613230313823.
4. Define a 2-byte hexadecimal control command for every trigger condition.
For WS156, set the button 1 command as 40e1 and button 2 command as 40e0.
For WS202, set the Occupied/Bright status command as 40e0 and Vacant status commands as 40e1.
D2D Agent Configurations
1. Connect type-C port of UC100 and UC300 to PC and open Milesight ToolBox software to log in and configure the device. The default log in password is 123456. For WS502, open Milesight ToolBox App on a NFC-enabled smartphone and attach the NFC area to the switch to read and configure the basic information.
2. Go to LoRaWAN Settings > Basic page, set the supported frequency, RX2 frequency and RX2 datarate the same as D2D Controller device.
3. Enable D2D feature and set D2D key the same as D2D Controller device. The default value is 5572404c696e6b4c6f52613230313823. In this example, UC300 and UC100 uses the same key as WS156; WS502 uses the same key as WS156 and WS202.
4. Set the received control commands and corresponding operating actions.
For UC300, go to Command page to add two commands:
Command 1: Received command 1 is 40e1, trigger DO to open;
Command 2: Received command 2 is 40e0, trigger DO to close.
For UC100, go to Command page to add two commands:
Command 1: Received command 1 is 40e1, send curtain pulling up Modbus RTU command;
Command 2: Received command 2 is 40e0, send curtain pulling down Modbus RTU command.
For WS502, add two commands:
Command 1: Received command 1 is 40e1, all switches off;
Command 2: Received command 2 is 40e0, all switches on.
Q1: Do the Milesight D2D compliant end nodes support standard LoRaWAN® transmission at the same time?
A: Yes, but if D2D controller feature is enabled, default button message or threshold alarm will be transformed first to D2D control command to send to agent devices instead of sending via LoRaWAN®. For parts of models, you can enable the LoRa Uplink option which will allow the device to send both command to D2D agent and data to LoRaWAN® network server at the same time.
Q2: Why there is delay of D2D communication if device does not join the LoRaWAN® network?
A: Even D2D is enabled, the device will also send join request to LoRaWAN® network server regularly. When both join requests and D2D control commands need to be sent, the device will send join requests in priority, which will delay the D2D communication.
Q3: It seems there is a long delay in response after clicking the WS1x6 button hundreds of times continuously.
A: For sake of battery life, the initial 6 times of operation will get an immediately response. After that, the command will be sent with a latency of 4 seconds each time until you stop continuous clicking.
Q4: Can UC100 and UC300 work as Controller or Agent at the same time?
A: Yes, you can add both controller command and agent command to achieve both features.