RPLIDAR serial communication problem.

ForumNewMember
Posts: 4
Joined: Wed Sep 25, 2019 7:39 am

RPLIDAR serial communication problem.

Postby ForumNewMember » Wed Oct 16, 2019 8:46 am

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.

ForumNewMember
Posts: 4
Joined: Wed Sep 25, 2019 7:39 am

Re: RPLIDAR serial communication problem.

Postby ForumNewMember » Fri Oct 18, 2019 8:06 am

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 this

Code: Select all

Serial2.begin(115200, SERIAL_8N1, 19, 21); lidar.begin(Serial2)
Instead, 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

Code: Select all

lidar.begin(Serial2);
and it works.

hhelmbold
Posts: 7
Joined: Wed May 27, 2020 3:12 pm

Re: RPLIDAR serial communication problem.

Postby hhelmbold » Tue Jun 30, 2020 5:48 pm

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 63 guests