Ilia
Ilia Hardware, software and startups 24/7

Arduino LiDAR library available

Arduino LiDAR library available

Developer Update - I have combined support for various spinning LiDAR/LDS sensors into an Arduino LDS library with a single platform API. You can install this library from the Arduino Library Manager GUI.

Why support many LiDAR/LDS sensors? The reason is to make the hardware - supported by Kaia.ai platform - affordable to as many prospective users as possible. Some of the sensors listed below are sold as used robot vacuum cleaner spare parts and cost as low as $16 or so (including shipping) available on AliExpress.

Here is a list of supported and to-be-supported (*) low-cost LiDAR/LDS sensors. “Tria” indicates triangulation LDS, as opposed to “ToF” time-of-flight LiDARs. You can purchase these sensors off AliExpress, Amazon, eBay and online stores that cater to robotics enthusiasts. The retail prices are approximate, as of 02/2024. The safety class indicates what the model’s official datasheet says available. Some LiDAR/LDS models do not have official datasheets available publically.

Model Type Scans Points Range Cost Service Safety Ambient Spec
    per sec per sec meters retail life   Lux  
YDLIDAR X4 Tria 6-12Hz 5KHz 0.12-10 ~$70-90   Class 1   PDF
YDLIDAR X4 PRO Tria 6-12Hz 5KHz 0.12-10 ~$75-100 1,500h Class 1   PDF
YDLIDAR X2/X2L Tria 5..8Hz 3KHz 0.12-10 ~$75-100 1,500h Class 1   PDF
YDLIDAR X3 Tria 5-10Hz 3KHz 0.12-8 ~$65     2K?  
YDLIDAR X3 PRO Tria 6-12Hz 4KHz 0.12-8 ~$70 1,500h   40K? Link
XIAOMI LDS02RR Tria 5Hz 1.8KHz 0.15-6? ~$16        
XIAOMI LDS01RR* ToF 5Hz   0.15-9 ~$37 1,095h Class 1    
Neato XV11 Tria 5Hz ~2KHz 0.15-6? ~$35        
SLAMTEC RPLIDAR A1M8-R4 Tria 1-10Hz 8KHz 0.15-6     Class 1   PDF
SLAMTEC RPLIDAR A1M8-R5 Tria 1-10Hz 8KHz 0.15-12 ~$99   Class 1   PDF
3irobotics Delta-2A Tria ~5.25Hz? ~1.9KHz? 0.15-5? ~$28     1K?  
3irobotics Delta-2G Tria ~5.25Hz? ~1.9KHz? 0.15-5? ~$17        
Hitachi-LG HLS-LFCD2* ToF 5Hz 1.8KHz 0.12-3.5 ~$28   Class 1 10K? Link
Hitachi-LG HLS-LFCD3* Tria 5Hz 2.3KHz 0.16-8 ~$17 1,000h Class 1 25K? Link
LDROBOT LD14P* Tria 2..8Hz 4KHz 0.1-8 ~$47 2,200h   80K?  
LDROBOT LD20*                  
RPLIDAR C1*                  

Here are examples of using the Arduino LDS library:

This is what the Arduino LiDAR/LDS library does:

  • wraps various LiDAR/LDS sensors into a single platform API
  • adds PWM PID control to LiDARs/LDS that lack built-in motor control
  • adds API for easy integration with sensor telemetry middleware including micro-ROS, Websockets, etc.
    • a callback to forward sensor data packet stream
  • optional real-time angle and distance computation on the Arduino MCU
    • e.g. for low-latency object avoidance

Video: Neato XV11 working with ROS2 using micro-ROS, Arduino LDS library

Video: Xiaomi Mi 1st gen LDS02RR working with ROS2 using micro-ROS, Arduino LDS library

Video: RPLIDAR A1 working with ROS2 using micro-ROS, Arduino LDS library

ROS2 Companion Package

Kaia.ai robot firmware forwards LDS raw data - obtained from the Arduino LDS library - to a PC running ROS2 and micro-ROS. The ROS2 PC kaiaai_telemetry package receives the raw LDS data, decodes that data and publishes it to the ROS2 /scan topic. If you are a ROS2 developer or enthusiast, please feel free to take a loot - and reuse - the kaiaai_telemetry package ROS2 package.

Adapter Board

Some of the LiDAR/LDS sensors listed above do not have built-in motor control. These sensors (LDS02RR, Neato XV11, Delta-2G, Delta-2A, etc.) therefore require an adapter PCB that implements motor control. Here are adapter PCBs:

Video: Adapter PCB for Xiaomi LDS02RR

comments powered by Disqus