How can I get data from RP LIDAR sensor with arduino?
145 views (last 30 days)
Show older comments
takamitsu hatakeyama on 1 Feb 2020
Commented: Mingxin Bai on 30 Oct 2020
I would like to ask about above question.
RP LIDAR sensor equip serial comunication(TX RX), So I thought it is possible to receive data using serial receive block.
I conected cable like attatched pdf, and drived arduino with my simulink model.(attatched model)
But, serial reseve block returned 0 state(that mean
unsuccess comunication), and I failed receive data from RP LIDAR.
So could you give me advice?
FAUCHER Mickael on 1 Feb 2020
I have the same project and I can't receive information. I am not an expert with aruino board but I think the USB communication between computer and arduino use TX and RX pin. If you want create 2 serial communication (1 with RPLIDAR and 1 with the computer) you need create a virtual serial port with 2 digital pin (for the RPILARD) and use RX and TX for the computer.
Me I try to connect directly the computer and the RPLIDAR (without arduino). I create communication, but I can't command the RPLIDAR and I can't receive information.
If you succes to create communication, please help me.
FAUCHER Mickael on 9 Feb 2020
I don't understand something, if it's the same the "simple_connect.ino", you have in this sketch the serial connection with the rplidar but you don't have the serial connection with the computer. How you can communicate without this serial connection?
takamitsu hatakeyama on 10 Feb 2020
Edited: takamitsu hatakeyama on 10 Feb 2020
Mingxin Bai on 30 Oct 2020
Hello, I am using arduino due with rplidar a2, I have very tough time get the lidar start and read the data. Please see my code below if you could suggest me where I may did wrong. Much appreciated!
#define RPLIDAR_MOTOR 3
// bind the RPLIDAR driver to the arduino hardware serial
// set pin modes
float distance = lidar.getCurrentPoint().distance; //distance value in mm unit
float angle = lidar.getCurrentPoint().angle; //anglue value in degree
bool startBit = lidar.getCurrentPoint().startBit; //whether this point is belong to a new scan
byte quality = lidar.getCurrentPoint().quality; //quality of the current measurement
Serial.print(", distance: ");
Serial.print(", angle: ");
Serial.print(", startBit: ");
Serial.print(", quality: ");
analogWrite(RPLIDAR_MOTOR, 0); //stop the rplidar motor
// try to detect RPLIDAR...
if (IS_OK(lidar.getDeviceInfo(info, 100)))
// start motor rotating at max allowed speed
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!