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
- Before a device can communicate via “The Things Network” we have to add it to an application.
- Create a new application
- Under
Overview
click(+) Register device
- Under
Input method
selectSelect the end device in the LoRaWAN Device Repository
- Enter the following device information
End device brand
selectDragino Technology Co., Limited
Model
selectLDS02
Hardware Ver.
selectUnknown Ver.
or whatever is possible or on the stickerFirmware
select1.5
or whatever is possible or on the stickerProfile (Region)
selectEU_863_870
- Under
Frequency plan
selectEurope 863-870 Mhz (SF9 for RX2 - recommended)
- Under
JoinEUI
enter theApp EUI
from the sticker - Enter as well the
DevEUI
and theAppKey
from the sticker - Set an end-device name
- Press
Register end device
- Open the case and take out the batteries
- Replace the batteries and close the case
- Now the device should join the network and you can see the incoming telegrams in the
Live data
section - The payload formatter should already be preset. If not, you can copy/paste it from below
Payload formatter
function decodeUplink(input) {
var port = input.fPort;
var bytes = input.bytes;
var value=(bytes[0]<<8 | bytes[1])&0x3FFF;
var bat=value/1000;//Battery,units:V
var door_open_status=bytes[0]&0x80?1:0;//1:open,0:close
var water_leak_status=bytes[0]&0x40?1:0;
var mod=bytes[2];
var alarm=bytes[9]&0x01;
var data = {};
switch (input.fPort) {
case 10:
if(mod==1){
var open_times=bytes[3]<<16 | bytes[4]<<8 | bytes[5];
var open_duration=bytes[6]<<16 | bytes[7]<<8 | bytes[8];//units:min
data.BAT_V=bat,
data.MOD=mod,
data.DOOR_OPEN_STATUS=door_open_status,
data.DOOR_OPEN_TIMES=open_times,
data.LAST_DOOR_OPEN_DURATION=open_duration,
data.ALARM=alarm
}
else if(mod==2)
{
var leak_times=bytes[3]<<16 | bytes[4]<<8 | bytes[5];
var leak_duration=bytes[6]<<16 | bytes[7]<<8 | bytes[8];//units:min
data.BAT_V=bat,
data.MOD=mod,
data.WATER_LEAK_STATUS=water_leak_status,
data.WATER_LEAK_TIMES=leak_times,
data.LAST_WATER_LEAK_DURATION=leak_duration
}
else if(mod==3)
{
data.BAT_V=bat,
data.MOD=mod,
data.DOOR_OPEN_STATUS=door_open_status,
data.WATER_LEAK_STATUS=water_leak_status,
data.ALARM=alarm
}
else{
data.BAT_V=bat,
data.MOD=mod
}
return {
data: data,
}
default:
return {
errors: ["unknown FPort"]
}
}
}