Dragino - LDS02
The LDS02 is a LoRaWAN Window/Door sensor.
Table of contents
Specifications
- indoor device
- Price ca. CHF 22.- (03.08.2023)
- Built-in sensors
- Magnetic reed switch, [open/close]
- Power Supply: 2 common AAA batteries, 1.5 V
- Expected life time: depending on usage, 16’000 ~ 70’000 state changes
- LoRaWAN version: 1.0.3
- LoRaWAN device class: A
- Size: 69.2 × 29.2 × 15 mm
- Weight: 55 g
Documents
- Payload description ttn v1.5 (2023-08-03)
- Datasheet from dragino.com (2023-08-03)
- User Manual (online)
Ordering Info
- Part Number: LDS02-XX
- XX is frequency band, for ttn in Europe choose EU868
- Ordering Link
Adding the Device to TTN
- The
JoinEUI
,App EUI
and theDevEUI
should be on a sticker on the cardboard box. - Before a device can communicate via “The Things Network” we have to add it to an application.
- Create a new application
- Under
End devices
in the application click(+) Register end device
- Under
Input method
selectEnter end device specifics manually
- Under
Frequency plan
selectEurope 863-870 Mhz (SF9 for RX2 - recommended)
- Under
LoRaWAN version
select1.0.3
- Under
JoinEUI
enter theApp EUI
from the App and pressConfirm
- Enter as well the
DevEUI
and theAppKey
from the App - Set an end-device name
- Press
Register end device
- Add the payload formatter from below, either to the device itself or if all devices in the app are from the same type, to the application
- Open the case and take out the batteries
- Replace the batteries and close the case
- After Configuration, the device restarts automatically and tries to join the network
- Now the device should join the network and you can see the incoming telegrams in the
Live data
section
Optional Settings
Change TDC (Transmit Time Interval resp. Keep Alive Interval)
In some cases, the sensor has sent incorrect values. This can be remedied by reducing the TDC.
By default, the sensor sends a status message every day. This interval can be reduced to 1 hour (3600s -> HEX E10) as follows:
- In the TTN Console on the device view, select the device and change to the tab
Messaging
, selectDownlink
- Change the
FPort to 1
- Copy/paste the payload from the examples below, e.g.
01 00 0E 10
into thePayload
field - Press
Send
- In the
Data
tab you should now see the scheduled telegram. The wisely sensor only receives downlink data after a transmission. Therefore wait max 1 day or manually open/close the window to trigger a new transmission.
Payload Decoder
function decodeUplink(input) {
const bytes = input.bytes;
const batteryVoltage = ((bytes[0] << 8 | bytes[1]) & 0x3FFF) / 1000;
const doorStatus = (bytes[0] & 0x80) ? 1 : 0; // 1: open, 0: close
const waterLeakStatus = (bytes[0] & 0x40) ? 1 : 0;
const mode = bytes[2];
const alarm = bytes[9] & 0x01;
let data = {
battery_volt: batteryVoltage
};
switch (input.fPort) {
case 10:
const times = bytes[3] << 16 | bytes[4] << 8 | bytes[5];
const duration = bytes[6] << 16 | bytes[7] << 8 | bytes[8]; // units: min
switch (mode) {
case 1:
data.open_state = doorStatus;
data.counter = times;
data.openDuration_min = duration;
data.alarm_state = alarm;
break;
case 2:
data.waterLeak_state = waterLeakStatus;
data.counter = times;
data.waterDuration_minutes = duration;
break;
case 3:
data.waterLeak_state = doorStatus || waterLeakStatus;
data.alarm_state = alarm;
break;
default:
break;
}
break;
default:
return { errors: ["unknown FPort"] };
}
return { data: data };
}