Sorry for the messy looks
Also serial setup in your code is still not ok. You set serial (for serial monitor ) at 460800 baud rate and serial1 for lidar baud rate is..?
Doesn't match with the wiring in your post #21
Serial1 is 18tx and 19rx (like in post #21), but in foto something else.
Also that usb hub is a big uncertainty to mee..
Try to concentrate!
baud rate is the same 460800, I readjust the wiring on 18tx 19rx of Serial 1, it shows "RPLIDAR not detected. Trying again...".
serial monitor baudrate in your code and on serial monitor have to match! You set them 115200 both.
Serial.begin(115200);
The RPLidar team told me this morning the baud of C1 model is 460800, then I changed the setting both in the code and serial monitor to align with that. ps: I'm kept updating the situation in the origin info of the question.
That has nothing to do with serial.begin()
The RPLidar team told me this morning the baud of C1 model is 460800, then I changed the setting both in the code and serial monitor to align with that. ps: I'm kept updating the situation in the origin info of the question..
if you don't follow instructions, I'm not able to help you.
I'm just did it, it says "�$t����50X��2��l�" still error code came out
So you have:
Serial.begin(115200);
in your code
and 115200 in serial monitor?
Yes, and it still generate the"��* I���-b�l�I������%V2[��"�$4���" error code, it's been whole day..
And your code has been wrong whole day...
Show me your actual code.
Also, that hub is probably not ok.
Also in your photo your lidar Vcc (red) is connected to some random digital pin of Mega!
You really aren't following at all!
Look, I have to go now.
If you carefully read everything I wrote to you today and follow my instructions for serial communication and power supply, you are able to power your lidar correctly and establish serial connection with your pc and serial1 connection with lidar. -If you didn't damage your Mega with your random wiring.
I have no idea if your code related to lidar-library is correct or not.
But by now I have even doubts that your lidar is compatible with your library.
Hi Kimin, I updated the code and the baud setting, it generates the content with 'Distance: 0.00 mm, Angle: 0.00';
About the power supply, I did some research for the Adruino Mega and RPLidar C1 they both ran properly at 5v and Macbook Pro thunder bot 4 can provide enough supply.
After I modified the code and setting with GPT for the whole night, I still could not generate useful data sadly.
The wiring is RPLidar (RX/TX) >Arduino Mega serial 1 port, RPLidar GND>Arduino Mega GND, RPLidar Vcc>Arudino Mega 5v
#include <RPLidar.h>
RPLidar lidar;
void setup() {
Serial.begin(115200);
Serial1.begin(460800);
delay(1000);
Serial.println("Initializing RPLIDAR...");
// Try to detect RPLIDAR...
if (lidar.begin(Serial1)) {
Serial.println("RPLIDAR detected!");
} else {
Serial.println("Failed to connect to RPLIDAR");
}
}
void loop() {
// Read data from RPLIDAR
if (lidar.waitPoint()) {
float distance = lidar.getCurrentPoint().distance; // Distance in mm
float angle = lidar.getCurrentPoint().angle; // Angle in degrees
Serial.print("Distance: ");
Serial.print(distance);
Serial.print(" mm, Angle: ");
Serial.println(angle);
} else {
Serial.println("No data received from RPLIDAR");
}
}
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
Do you have the Tx of the Lidar connected to Rx serial1 pin of the Mega?
Do you have the Rx of the Lidar connected to Tx serial1 pin of the Mega?
Have you written some simple code to check that your Mega to PC comms is okay?
Thanks.. Tom..
![]()
Hi Tom,
Both TX and RX of RPLidar C1 have been connected to Serial 1 port 18Tx1, 19Rx1 on Arduino Mega.
About the power supply, I'm using the Lenovo USB 4 in 1 port connected MacBook Pro Thunderbolt4, the output of the port is 5v, 1.5 A.
I test the connection between Mega and Macbook pro with the example code 'Blink' it does work.
I will attach the wiring graph and real situation footage below, thanks for your help.

Run this code, put the IDE monitor on 115200 baud and tell me what is displayed.
void setup()
{
Serial.begin(115200);
}
void loop()
{
Serial.println("Test Comms from Mega to PC");
for (int i = 0; i <= 10 ; i++)
{
Serial.println(i);
delay(500);
}
}
Thanks.. Tom..
![]()
Initializing RPLIDAR...
Failed to connect to RPLIDAR
Distance: 0.00 mm, Angle: 0.00
Hi,
What did you do to get from this;
To this;
Tom..
![]()
PS. I'm off to bed, its after 2:00AM here...
![]()

