RPLIDAR serial communication problem.
-
- Posts: 4
- Joined: Wed Sep 25, 2019 7:39 am
RPLIDAR serial communication problem.
I have RPLIDAR A1, which failed to work with esp32 (Wroom and Wrover) on UART when assigning it to pins 19,21. I am not sure if the problem is within the manufacture provided library or ESP itself. I can confirm that lidar works with serial pins declared by default, also I tried mapping out to 26,27 and had a problem with them aswell ( 5,16 worked normally, havent checked rest). I was struggling with this problem for a while, debugging was done using a scope, ESP is transmitting and receiving data back, but for some reason lidar module is not recognized. Does anyone know why is this happening? I have custom PCB and can't change pins at this point. ESP and Lidar RX, TX are assigned correctly 100% I am using Arduino IDE for flashing and programming.
-
- Posts: 4
- Joined: Wed Sep 25, 2019 7:39 am
Re: RPLIDAR serial communication problem.
I found the solution to my problem, so I am sharing it, maybe it will be helpful to someone in the future.
So, when using Slamtec RPLIDAR A1 with ESP32 and manufacturer provided Arduino library. Don't declare new UART pins in your code like thisInstead, find HardweareSerial.cpp in esp32 core libraries, and in that file, scroll down to Serial1 or 2 pin numbers and redefine them to your liking. Then you only call and it works.
So, when using Slamtec RPLIDAR A1 with ESP32 and manufacturer provided Arduino library. Don't declare new UART pins in your code like this
Code: Select all
Serial2.begin(115200, SERIAL_8N1, 19, 21); lidar.begin(Serial2)
Code: Select all
lidar.begin(Serial2);
Re: RPLIDAR serial communication problem.
Thank you so much for this! Could I ask for help on the basic code to get this working? I cannot seem to get the PWM pin to work so the motor will spin on the Lidar. It is connected to GPIO 21 on the ESP 32
Who is online
Users browsing this forum: No registered users and 23 guests