Table of Contents:

1. Introduction

1.1 What is LoRaWAN LiDAR ToF Distance Sensor

The Dragino LDS40-LB is a LoRaWAN LiDAR ToF (Time of Flight) Distance Sensor for Internet of Things solution.  It is capable of measuring the distance to objects as close as 0m to 40m. The LiDAR probe uses laser induction technology for distance measurement.

The LDS40-LB can be applied to scenarios such as horizontal distance measurement, parking management system, object proximity and presence detection, intelligent trash can management system, robot obstacle avoidance, automatic control, sewer, etc.

It detects the distance between the measured object and the sensor, and uploads the value via wireless to LoRaWAN IoT Server.

The LoRa wireless technology used in LDS40-LB allows device to send data and reach extremely long ranges at low data-rates. It provides ultra-long range spread spectrum communication and high interference immunity whilst minimizing current consumption.

LDS40-LB supports BLE configure and wireless OTA update which make user easy to use.

LDS40-LB is powered by 8500mAh Li-SOCI2 battery, it is designed for long term use up to 5 years.

Each LDS40-LB is pre-load with a set of unique keys for LoRaWAN registrations, register these keys to local LoRaWAN server and it will auto connect after power on.


1.2 ​Features

  • LoRaWAN 1.0.3 Class A
  • Bands: CN470/EU433/KR920/US915/EU868/AS923/AU915/IN865
  • Ultra-low power consumption
  • Laser technology for distance detection
  • Measure Distance: 0.1m ~ 40m @ 90% Reflectivity
  • Monitor Battery Level
  • Support Bluetooth v5.1 and LoRaWAN remote configure
  • Support wireless OTA update firmware
  • AT Commands to change parameters
  • Downlink to change configure
  • 8500mAh Battery for long term use

1.3 Specification

Common DC Characteristics:

  • Supply Voltage: built in 8500mAh Li-SOCI2 battery , 2.5v ~ 3.6v
  • Operating Temperature: -40 ~ 85°C

Probe Spec:

  • Storage temperature:-30°C~80°C
  • Operating temperature: -20°C~60°C
  • Measure Distance:
    • 0.1m ~ 40m @ 90% Reflectivity
    • 0.1m ~ 13.5m @ 10% Reflectivity
  • Distance resolution: 1cm
  • Ambient light immunity: 100klux
  • Enclosure rating : IP65
  • Light source : VCSEL
  • Central wavelength : 850nm
  • FOV : 3°
  • Material of enclosure : ABS+PC
  • Wire length : 75cm

LoRa Spec:

  • Frequency Range,  Band 1 (HF): 862 ~ 1020 Mhz, Band 2 (LF): 410 ~ 528 Mhz
  • Max +22 dBm constant RF output vs.
  • RX sensitivity: down to -139 dBm.
  • Excellent blocking immunity


  • Li/SOCI2 un-chargeable battery
  • Capacity: 8500mAh
  • Self-Discharge: <1% / Year @ 25°C
  • Max continuously current: 130mA
  • Max boost current: 2A, 1 second

Power Consumption

  • Sleep Mode: 5uA @ 3.3v
  • LoRa Transmit Mode: 125mA @ 20dBm, 82mA @ 14dBm

1.4 Applications

  • Horizontal distance measurement
  • Parking management system
  • Object proximity and presence detection
  • Intelligent trash can management system
  • Robot obstacle avoidance
  • Automatic control
  • Sewer


1.5 Sleep mode and working mode

Deep Sleep Mode: Sensor doesn't have any LoRaWAN activate. This mode is used for storage and shipping to save battery life.

Working Mode: In this mode, Sensor will work as LoRaWAN Sensor to Join LoRaWAN network and send out sensor data to server. Between each sampling/tx/rx periodically, sensor will be in IDLE mode), in IDLE mode, sensor has the same power consumption as Deep Sleep mode.

1.6 Button & LEDs


Behavior on ACTFunctionAction
Pressing ACT between 1s < time < 3sSend an uplink

If sensor is already Joined to LoRaWAN network, sensor will send an uplink packet, blue led will blink once.
Meanwhile, BLE module will be active and user can connect via BLE to configure device.

Pressing ACT for more than 3sActive Device

Green led will fast blink 5 times, device will enter OTA mode for 3 seconds. And then start to JOIN LoRaWAN network.
Green led will solidly turn on for 5 seconds after joined in network.
Once sensor is active, BLE module will be active and user can connect via BLE to configure device, no matter if device join or not join LoRaWAN network.

Fast press ACT 5 times.Deactivate DeviceRed led will solid on for 5 seconds. Means device is in Deep Sleep Mode.

1.7 BLE connection

LDS40-LB support BLE remote configure.

BLE can be used to configure the parameter of sensor or see the console output from sensor. BLE will be only activate on below case:

  • Press button to send an uplink
  • Press button to active device.
  • Device Power on or reset.

If there is no activity connection on BLE in 60 seconds, sensor will shut down BLE module to enter low power mode.

1.8 Pin Definitions


1.9 Mechanical




Probe Mechanical:


2. Configure LDS40-LB to connect to LoRaWAN network

2.1 How it works

The LDS40-LB is configured as LoRaWAN OTAA Class A mode by default. It has OTAA keys to join LoRaWAN network. To connect a local LoRaWAN network, you need to input the OTAA keys in the LoRaWAN IoT server and press the button to activate the LDS40-LB. It will automatically join the network via OTAA and start to send the sensor value. The default uplink interval is 20 minutes.


2.2 ​Quick guide to connect to LoRaWAN server (OTAA)

Following is an example for how to join the TTN v3 LoRaWAN Network. Below is the network structure; we use the LPS8v2  as a LoRaWAN gateway in this example. 

The LPS8v2 is already set to connected to TTN network , so what we need to now is configure the TTN server.


Step 1: Create a device in TTN with the OTAA keys from LDS40-LB.

Each LDS40-LB is shipped with a sticker with the default device EUI as below:


You can enter this key in the LoRaWAN Server portal. Below is TTN screen shot:

Register the device




Add APP EUI in the application




Step 2: Activate on LDS40-LB

Press the button for 5 seconds to activate the LDS40-LB.

Green led will fast blink 5 times, device will enter OTA mode for 3 seconds. And then start to JOIN LoRaWAN network. Green led will solidly turn on for 5 seconds after joined in network.

After join success, it will start to upload messages to TTN and you can see the messages in the panel.

2.3 ​Uplink Payload

2.3.1 Device Status, FPORT=5

Users can use the downlink command(0x26 01) to ask LDS40-LB to send device configure detail, include device configure status. LDS40-LB will uplink a payload via FPort=5 to server.

The Payload format is as below.


ValueSensor ModelFirmware VersionFrequency BandSub-bandBAT

Example parse in TTNv3


Sensor Model: For LDS40-LB, this value is 0x25

Frequency Band:

0x01: EU868

0x02: US915

0x03: IN865

0x04: AU915

0x05: KZ865

0x06: RU864

0x07: AS923

0x08: AS923-1

0x09: AS923-2

0x0a: AS923-3

0x0b: CN470

0x0c: EU433

0x0d: KR920

0x0e: MA869


AU915 and US915:value 0x00 ~ 0x08

CN470: value 0x0B ~ 0x0C

Other Bands: Always 0x00

Firmware Version: 0x0100, Means: v1.0.0 version

Battery Info:

Check the battery voltage.

Ex1: 0x0B45 = 2885mV

Ex2: 0x0B49 = 2889mV

2.3.2 Uplink Payload, FPORT=2

LDS40-LB will send this uplink after Device Status once join the LoRaWAN network successfully. And LDS40-LB will:

periodically send this uplink every 20 minutes, this interval can be changed.

Uplink Payload totals 11 bytes.



Temperature DS18B20

DistanceDistance signal strengthInterrupt flag & Interrupt_levelLiDAR temp

Message Type


Battery Info

Check the battery voltage for LDS40-LB.

Ex1: 0x0B45 = 2885mV

Ex2: 0x0B49 = 2889mV

DS18B20 Temperature sensor

This is optional, user can connect external DS18B20 sensor to the +3.3v, 1-wire and GND pin . and this field will report the temperature.


If payload is: 0105H:  (0105 & FC00 == 0), temp = 0105H /10 = 26.1 degree

If payload is: FF3FH :  (FF3F & FC00 == 1) , temp = (FF3FH - 65536)/10 = -19.3 degrees.


Indicates the distance value measured by the LDS40-LB. The default unit is cm and the range is 0-4000.


If the data you get from the register is 0x0B 0xEA, the distance between the sensor and the measured object is 0BEA(H) = 3050 (D)/10 = 305cm.

Distance signal strength

Refers to the signal strength, the default output value will be between 0-65535. When the ranging gear is fixed, the farther the ranging, the lower the signal strength.

In actual use, when the signal strength value Strength≤60, the measured value of Dist is considered unreliable, and the default output is 4500. When the signal strength is greater than 60 and the actual distance is and the actual distance is 45~60m, the output value of Dist is 4500. When the signal strength is greater than 60 and the actual distance is more than 60m, there will be over-period data appearing as 0 or other abnormal values.


If payload is: 01D7(H)=471(D), distance signal strength=471, 471>100,471≠65535, the measured value of Dist is considered credible.

Customers can judge whether they need to adjust the environment based on the signal strength.

1) When the sensor detects valid data:


2) When the sensor detects invalid data:


3) When the sensor is not connected:


Interrupt Pin & Interrupt Level

This data field shows if this packet is generated by interrupt or not. Click here for the hardware and software set up.

Note: The Internet Pin is a separate pin in the screw terminal. See pin mapping of GPIO_EXTI.


If byte[0]&0x01=0x00 : Normal uplink packet.

If byte[0]&0x01=0x01 : Interrupt Uplink Packet.

LiDAR temp

Characterize the internal temperature value of the sensor.

If payload is: 1C(H) <<24>>24=28(D),LiDAR temp=28°C.
If payload is: F2(H) <<24>>24=-14(D),LiDAR temp=-14°C.

Message Type

For a normal uplink payload, the message type is always 0x01.

Valid Message Type:

Message Type CodeDescriptionPayload
0x01Normal UplinkNormal Uplink Payload
0x02Reply configures infoConfigure Info Payload


2.3.3 Historical measuring distance, FPORT=3

LDS40-LB stores sensor values and users can retrieve these history values via the downlink command.

The historical payload includes one or multiplies entries and every entry has the same payload as Real-Time measuring distance.


ValueInterrupt flag & Interrupt_level


DistanceDistance signal strength

LiDAR temp

Unix TimeStamp

Interrupt flag & Interrupt level:


ValueNo ACK messagePoll Message FlagReserveInterrupt levelInterrupt flag
  • Each data entry is 11 bytes and has the same structure as Uplink Payload, to save airtime and battery, LDS40-LB will send max bytes according to the current DR and Frequency bands.

For example, in the US915 band, the max payload for different DR is:

a) DR0: max is 11 bytes so one entry of data

b) DR1: max is 53 bytes so devices will upload 4 entries of data (total 44 bytes)

c) DR2: total payload includes 11 entries of data

d) DR3: total payload includes 22 entries of data.

If LDS40-LB doesn't have any data in the polling time. It will uplink 11 bytes of 0


0x31 64 CC A6 DC 64 CC A8 44 05



40 FF 0D CA 06 88 1F 64 CC A6 E8 40 FF 0D D4 06 8C 1F 64 CC A7 24 40 FF 01 4A 0C BC 1F 64 CC A7 60 40 FF 0D DE 06 89 1F 64 CC A7 9C 43 FF 0D D4 06 89 1F 64 CC A7 C3 41 FF 0E 06 06 87 1F 64 CC A7 D5 41 FF 0D E8 05 58 1F 64 CC A8 1C

Parsed Value:


[353,1672,31,Low,False,2023-08-04 07:21:12],

[354,1676,31,Low,False,2023-08-04 07:22:12],

[33,3260,31,Low,False,2023-08-04 07:23:12],

[355,1673,31,Low,False,2023-08-04 07:24:12],

[354,1673,31,High,True,2023-08-04 07:24:51],

[359,1671,31,Low,True,2023-08-04 07:25:09],

[356,1368,31,Low,True,2023-08-04 07:26:20],

History read from serial port:


2.3.4  Decode payload in The Things Network

While using TTN network, you can add the payload format to decode the payload.


The payload decoder function for TTN is here:

2.4 ​Show Data in DataCake IoT Server

DATACAKE provides a human friendly interface to show the sensor data, once we have data in TTN, we can use DATACAKE to connect to TTN and see the data in DATACAKE. Below are the steps:

Step 1: Be sure that your device is programmed and properly connected to the network at this time.

Step 2: To configure the Application to forward data to DATACAKE you will need to add integration. To add the DATACAKE integration, perform the following steps:



Step 3: Create an account or log in Datacake.

Step 4: Create LDS40-LB product.




Step 5: add payload decode



After added, the sensor data arrive TTN, it will also arrive and show in Datacake.


2.5 Datalog Feature

Datalog Feature is to ensure IoT Server can get all sampling data from Sensor even if the LoRaWAN network is down. For each sampling, LDS40-LB will store the reading for future retrieving purposes.

2.5.1 Ways to get datalog via LoRaWAN

Set PNACKMD=1, LDS40-LB will wait for ACK for every uplink, when there is no LoRaWAN network,LDS40-LB will mark these records with non-ack messages and store the sensor data, and it will send all messages (10s interval) after the network recovery.

  • a) LDS40-LB will do an ACK check for data records sending to make sure every data arrive server.

  • b) LDS40-LB will send data in CONFIRMED Mode when PNACKMD=1, but LDS40-LB won't re-transmit the packet if it doesn't get ACK, it will just mark it as a NONE-ACK message. In a future uplink if LDS40-LB gets a ACK, LDS40-LB will consider there is a network connection and resend all NONE-ACK messages. 

Below is the typical case for the auto-update datalog feature (Set PNACKMD=1)


2.5.2 Unix TimeStamp

LDS40-LB uses Unix TimeStamp format based on


User can get this time from link: :

Below is the converter example


So, we can use AT+TIMESTAMP=1611889405 or downlink 3060137afd00 to set the current time 2021 – Jan -- 29 Friday 03:03:25

2.5.3 Set Device Time

User need to set SYNCMOD=1 to enable sync time via MAC command.

Once LDS40-LB Joined LoRaWAN network, it will send the MAC command (DeviceTimeReq) and the server will reply with (DeviceTimeAns) to send the current time to LDS40-LB. If LDS40-LB fails to get the time from the server, LDS40-LB will use the internal time and wait for next time request (AT+SYNCTDC to set the time request period, default is 10 days).

Note: LoRaWAN Server need to support LoRaWAN v1.0.3(MAC v1.0.3) or higher to support this MAC command feature, Chirpstack,TTN V3 v3 and loriot support but TTN V3 v2 doesn't support. If server doesn't support this command, it will through away uplink packet with this command, so user will lose the packet with time request for TTN V3 v2 if SYNCMOD=1.

2.5.4 Poll sensor value

Users can poll sensor values based on timestamps. Below is the downlink command.

Downlink Command to poll Open/Close status (0x31)
31Timestamp startTimestamp endUplink Interval

Timestamp start and Timestamp end-use Unix TimeStamp format as mentioned above. Devices will reply with all data logs during this period, using the uplink interval.

For example, downlink command image-20220518162852-1.png 

Is to check 2021/11/12 12:00:00 to 2021/11/12 15:00:00's data

Uplink Internal =5s,means LDS40-LB will send one packet every 5s. range 5~255s.

2.6 Frequency Plans

The LDS40-LB uses OTAA mode and below frequency plans by default. If user want to use it with different frequency plan, please refer the AT command sets.

2.7 LiDAR ToF Measurement

2.7.1 Principle of Distance Measurement

The LiDAR probe is based on TOF, namely, Time of Flight principle. To be specific, the product emits modulation wave of near infrared ray on a periodic basis, which will be reflected after contacting object. The product obtains the time of flight by measuring round-trip phase difference and then calculates relative range between the product and the detection object, as shown below.


2.7.2 Distance Measurement Characteristics

The detection angle of the LDS40-LB is 3 degrees, and the size of the light spot at different distances is the side length of the detection range. The size of the light spot at different distances is the side length of the detection range. The side length of the detection range (the shape is square), as shown.

Detection range side length (cm)51016263752105156208

Note that generally, the side length of the detected target object should be greater than the side length of the detection range of the LDS40-LB; when the detected object is smaller than the detection range side length; when the detected object is smaller than the detection range side length, the effective range of the radar will be reduced.

2.7.3  Notice of usage

Possible invalid /wrong reading for LiDAR ToF tech:

  • Measure high reflectivity object such as: Mirror, Smooth ceramic tile, static milk surface, will have possible wrong readings.
  • While there is transparent object such as glass, water drop between the measured object and the LiDAR sensor, the reading might be wrong.
  • The LiDAR probe is cover by dirty things; the reading might be wrong. In this case, need to clean the probe.
  • The sensor window is made by Acrylic. Don't touch it with alcohol material. This will destroy the sensor window.

2.7.4  Reflectivity of different objects

1Black foam rubber2.4%
2Black fabric3%
3Black rubber4%
4Coal (different types of coal)4~8%
5Black car paint5%
6Black Jam10%
7Opaque black plastic14%
8Clean rough board20%
9Translucent plastic bottle62%
10Carton cardboard68%
11Clean pine70%
12Opaque white plastic87%
13White Jam90%
14Kodak Standard Whiteboard100%

Unpolished white metal surface

16Glossy light metal surface150%
17stainless steel200%
18Reflector plate, reflective tape>300%

3. Configure LDS40-LB

3.1 Configure Methods

LDS40-LB supports below configure method:

3.2 General Commands

These commands are to configure:

  • General system settings like: uplink interval.
  • LoRaWAN protocol & radio related command.

They are same for all Dragino Devices which support DLWS-005 LoRaWAN Stack. These commands can be found on the wiki:

3.3 Commands special design for LDS40-LB

These commands only valid for LDS40-LB, as below:

3.3.1 Set Transmit Interval Time

Feature: Change LoRaWAN End Node Transmit Interval.

AT Command: AT+TDC

Command ExampleFunctionResponse
AT+TDC=?Show current transmit Interval

the interval is 30000ms = 30s

AT+TDC=60000Set Transmit Interval

Set transmit interval to 60000ms = 60 seconds

Downlink Command: 0x01

Format: Command Code (0x01) followed by 3 bytes time value.

If the downlink payload=0100003C, it means set the END Node's Transmit Interval to 0x00003C=60(S), while type code is 01.

  • Example 1: Downlink Payload: 0100001E       // Set Transmit Interval (TDC) = 30 seconds

  • Example 2: Downlink Payload: 0100003C      // Set Transmit Interval (TDC) = 60 seconds  


3.3.2 Set Interrupt Mode

Feature, Set Interrupt mode for pin of GPIO_EXTI.

When AT+INTMOD=0 is set, GPIO_EXTI is used as a digital input port.


Command ExampleFunctionResponse
AT+INTMOD=?Show current interrupt mode

the mode is 0 =Disable Interrupt



Set Transmit Interval
0. (Disable Interrupt),
1. (Trigger by rising and falling edge)
2. (Trigger by falling edge)
3. (Trigger by rising edge)


Downlink Command: 0x06

Format: Command Code (0x06) followed by 3 bytes.

This means that the interrupt mode of the end node is set to 0x000003=3 (rising edge trigger), and the type code is 06.

  • Example 1: Downlink Payload: 06000000       //  Turn off interrupt mode
  • Example 2: Downlink Payload: 06000003      //   Set the interrupt mode to rising edge trigger

3.3.3 Set Power Output Duration

Control the output duration 3V3(pin of VBAT_OUT) . Before each sampling, device will

1. first enable the power output to external sensor,

2. keep it on as per duration, read sensor value and construct uplink payload

3. final, close the power output.

AT Command: AT+3V3T

Command ExampleFunctionResponse
AT+3V3T=?Show 3V3 open time.

0 (default)


Close after a delay of 1000 milliseconds.

AT+3V3T=0Always turn on the power supply of 3V3 pin.OK
AT+3V3T=65535Always turn off the power supply of 3V3 pin.OK

Downlink Command: 0x07

Format: Command Code (0x07) followed by 3 bytes.

The first byte is 01,the second and third bytes are the time to turn on.

  • Example 1: Downlink Payload: 07 01 00 00     --->   AT+3V3T=0
  • Example 2: Downlink Payload: 07 01 01 F4      --->  AT+3V3T=500
  • Example 3: Downlink Payload: 07 01 FF FF      --->  AT+3V3T=65535

4. Battery & Power Consumption

LDS40-LB use ER26500 + SPC1520 battery pack. See below link for detail information about the battery info and how to replace.

Battery Info & Power Consumption Analyze .

5. OTA Firmware update

User can change firmware LDS40-LB to:

  • Change Frequency band/ region.
  • Update with new features.
  • Fix bugs. 

Firmware and changelog can be downloaded from : Firmware download link

Methods to Update Firmware:

6. FAQ

6.1 What is the frequency plan for LDS40-LB?

LDS40-LB use the same frequency as other Dragino products. User can see the detail from this link:  Introduction

7. Trouble Shooting

7.1 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.2 Significant error between the output distant value of LiDAR and actual distance

Cause ①Due to the physical principles of The LiDAR probe, the above phenomenon is likely to occur if the detection object is the material with high reflectivity (such as mirror, smooth floor tile, etc.) or transparent substance. (such as glass and water, etc.)

Troubleshooting: Please avoid use of this product under such circumstance in practice.

Cause ②The IR-pass filters are blocked.

Troubleshooting: please use dry dust-free cloth to gently remove the foreign matter.

8. Order Info

Part Number: LDS40-LB-XXX

XXX: The default frequency band

  • AS923: LoRaWAN AS923 band
  • AU915: LoRaWAN AU915 band
  • EU433: LoRaWAN EU433 band
  • EU868: LoRaWAN EU868 band
  • KR920: LoRaWAN KR920 band
  • US915: LoRaWAN US915 band
  • IN865: LoRaWAN IN865 band
  • CN470: LoRaWAN CN470 band

9. ​Packing Info

Package Includes:

  • LDS40-LB LoRaWAN LiDAR ToF Distance Sensor x 1

Dimension and weight:

  • Device Size: cm
  • Device Weight: g
  • Package Size / pcs : cm
  • Weight / pcs : g

10. 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
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0