I can't get lidar to work with lds02rr_esp32.ino on ESP32 WROWER #9
-
Hi! Today I received the LDS02RR lidar, and I came across the fact that it does not give any values. I've commented out the line
When I commented out the lines
then the lidar does not spin at all, constantly displaying the message "LDS motor error" in Serial. I only changed the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@ArtemVolkov2103 I assume you mean "uncommented" those lines. About uncommenting I believe value Then, The next PID update, I assume, increases About why uncommenting
Arduino loop() calls xv_lds.loop() in xv_lib.h/cpp
XV::loop() calls XV::motorCheck()
XV::motorCheck() checks LiDAR RPM every When you power up LDS02RR, its RPM starts from zero and starts increasing as the motor spins up faster and faster. It takes a few seconds or so for the RPM to get close to its target speed. Until then, So the LiDAR simply does not have enough time to spin up to its target speed. If I remember correctly, I had the same issue. You can increase XV::loop() lines are not my code. That routine came from https://github.com/getSurreal/XV_Lidar_Controller Looking at this comment When you start your bring up, first off, make sure LDS02RR serial communication works with ESP32. Check that your LDS02RR sends distance values only when it spins close to its target RPM. In other words, you will not be getting distance values if the RPM is too fast or too slow. When the speed is too slow or too fast LDS02RR will be sending out short packets that contain its RPM value - so that the (external) PID/PWM controller can drive the LiDAR's motor to reach the correct RPM. |
Beta Was this translation helpful? Give feedback.
Hello! It looks like I've solved the problem!
Thank you for advising me to use an oscilloscope. Unfortunately, I don't have an oscilloscope, but for this purpose, the ESP32 itself was enough for me. I found out that the LiDAR changes the state of the TX during rotation, which meant its minimum performance.
Next, I read the ESP32 WROVER documentation again and remembered that 17 and 16 GPIOs cannot be used for this model, since they work with QSPI. I started looking for other pin combinations that the LiDAR and found pins 32 (TX) and 33 (RX).
Now, the LiDAR is rotating at the desired speed and returning the measured data.
I suggest adding the following information to the README.md: when us…