Skip to content
/ LDS Public

Arduino LiDAR library supporting YDLIDAR X2/X3/X4, RPLIDAR A1, Xiaomi LDS02RR, Neato XV11, LD14P, CAMSENSE X1, Delta-2A/2B/2G

License

Notifications You must be signed in to change notification settings

kaiaai/LDS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LiDAR Library for Arduino

Laser distance scan sensor (LIDAR) Arduino wrapper/controller for kaia.ai home robot software platform. Please check out the Awesome 2D LiDARs list and read this blog post for more details.

Please visit the Support Forum!

This library supports:

  • YDLIDAR X4, X4-PRO, X3, X3-PRO, X2/X2L, SCL models
  • SLAMTEC RPLIDAR A1
  • Neato XV11/Botvac
  • Xiaomi Roborock Mi 1st gen LDS02RR
  • 3irobotix Delta-2A, Delta-2B, Delta-2G, Delta-2A 115000 baud
    • Note: there is a fixed pattern noise issue that needs debug
  • LDROBOT LD14P
  • CAMSENSE X1

Other models are in the works.

LDS_collection_labeled_v3

Video: YDLIDAR SCL runs on Arduino, ROS2

YDLIDAR SCL laser distance scan sensor runs on Arduino, ROS2

Video: Neato XV11 runs on Arduino, ROS2

Neato XV11 laser distance scan sensor runs on Arduino, ROS2

Video: Xiaomi Mi 1st gen LDS02RR runs on Arduino, ROS2

LDS02RR laser distance scan sensor runs on Arduino, ROS2

Video: SLAMTEC RPLIDAR A1 runs on Arduino, ROS2

RPLIDAR A1 laser distance scan sensor runs on Arduino, ROS2

Video: YDLIDAR X3 PRO runs on Arduino, ROS2

YDLIDAR X3 PRO laser distance scan sensor runs on Arduino, ROS2

Video: LDROBOT LD14P runs on Arduino, ROS2

LDROBOT LD14P LiDAR connected to Arduino, ROS2

Video: CAMSENSE X1 runs on Arduino, ROS2

CAMSENSE X1 LiDAR connected to Arduino, ROS2

Video: Delta-2G runs on Arduino, ROS2

CAMSENSE X1 LiDAR connected to Arduino, ROS2

Example Code

Please see the examples folder for sample Arduino sketches.

Connecting to Arduino

  • Maker's Pet offers Lidar breakout boards for ESP32 for sale in its onine store
  • follow this DIY tutorial to connect LDROBOT LD14P to Arduino ESP32

Adapter Boards

Some LiDAR models do not have built-in motor control and therefore require an additional board to operate:

ESP32 Module Variants

  • When using the ESP32 WROVER board, it's worth using pins 32 and 33 instead of pins 16 and 17, which are used for QSPI
  • ESP32-S3 has only two UARTs, as opposed to ESP32 having 3 UARTS
    • When using the YD ESP32-S3, consider the default TX1, RX1 GPIO15 and GPIO16 pins and change the example code to HardwareSerial LidarSerial(1);
//ESP32-S3
//HardwareSerial LidarSerial(2);
HardwareSerial LidarSerial(1);
...
//LidarSerial.begin(baud_rate); // Use default GPIO TX 17, RX 16
LidarSerial.begin(baud_rate, SERIAL_8N1, 16, 15); // GPIO16 as RX1, GPIO15 as TX1
  • ESP32-C3 has only two UARTs, as opposed to ESP32 having 3 UARTS
    • use UART1 for LiDAR and, for example, GPIO4 as RX1 and GPIO5 as TX
//ESP32-C3
//HardwareSerial LidarSerial(2);
HardwareSerial LidarSerial(1);
...
//LidarSerial.begin(baud_rate); // Use default GPIO TX 17, RX 16
LidarSerial.begin(baud_rate, SERIAL_8N1, 4, 5); // GPIO4 as RX1, GPIO5 as TX1

Performance Notes

  • currently Delta-2A, -2B, -2G exhibit mysterious fixed pattern noise
    • this noise does NOT show when using 3irobotix development kit, so it should be fix-able (somehow)
    • so far I haven't heard back from 3irobotix support.

Release notes

v0.6.1

  • added an all-in-one example sketch for all supported Lidar models
    • pre-configured for LDS02RR
  • bugfixed Espressif SDK 5.x (ESP32 Arduino 3.x) build
  • examples cleanup

v0.6.0

  • support for Espressif SDK 5.x (ESP32 Arduino 3.x)

v0.5.9

  • added ESP32-C3 LD14P example
  • added ESP32-S3 LD14P example

v0.5.8

  • LDROBOT LD14P commands
    • start, stop motor
    • set, get scan frequency

v0.5.7

  • added YDLIDAR X4-PRO

v0.5.6

  • added YDLIDAR SCL

v0.5.5

  • compilation bugfix

v0.5.4

  • added CAMSENSE X1
  • example sketch fix

v0.5.3

  • added Delta-2A 230400 baud
  • added Delta-2B

v0.5.3

  • Camsense X1

v0.5.2

  • added LDROBOT LD14P

v0.5.1

  • bugfix lds_all_models.h include file

v0.5.0

  • added Delta-2A, Delta-2G

v0.4.0

  • added Neato XV11
  • added RPLIDAR A1
  • added YDLIDAR X3, X3 PRO
  • report scan RPM for all sensor models

v0.3.1

  • added YDLIDAR X2/X2L
  • measure RPM for YDLIDAR X4, YDLIDAR X2/X2L

v0.3.0

  • virtual class methods
  • ESP32 crash workaround by moving init code from constructor out to init()

v0.2.0

  • example bugfix
  • renamed classes

v0.1.0

  • initial release

TODO

  • add Xiaomi Roborock LDS01RR
  • add LDROBOT LD20
  • add LDROBIT LD19P, https://github.com/Myzhar/ldrobot-lidar-ros2
  • add Hitachi-LG HLS-LFCD2
  • add Dreame TBD
  • reduce raw data volume
    • omit measurement quality since it usually does not get used

Star History

Star History Chart