EAIBOT / ydlidar_arduino

the ydlidar driver for arduino
28 stars 14 forks source link

YDLidar X4 no serial comunication #2

Open GuyCoast opened 5 years ago

GuyCoast commented 5 years ago

Hi all,

I spent a lot of my time, to let Arduino communicate with ydlidar X4, without success. Although the command is sent, Arduino can not read the answer from the lidar. With a logic analyzer on the rx tx serial lines, I see that the 'deviceinfo' command is sent and the lidar responds with the correct package, but Arduino does not receive anything and the receive buffer is empty.

Please help me thanks in advance

robotfpv commented 4 years ago

Hi, did you manage to get working the library?

Im using arduino UNO and i get this error:

"YDLIDAR get DeviceInfo Error!!!"

help meeee

EmileDqy commented 4 years ago

Hi, I managed to send the device info command from my Arduino UNO to the Ydlidar X4 and to get a response:

image

In the beginning, I used 2 transistors so as to step down from 5V to 3.3V. I did that because the documentation I found on the website of Ydlidar said that it can only take 3.3V as input.

But when I found this library, I had to simplify my circuit so as to have it follow the one shown inside the "YDLIDAR ARDUINO.docx" file.

image

I also had to solder my cables to jumpers in order to get rid of the noise I had. Now I can get the device's info and proceed to the scan. But my problem now is that my Arduino UNO says: "YDLIDAR get Scandata failed!!"

I don't know if any of you encountered this problem and managed to solve it? Anyway, I will do my best to fix this issue and I'll get back to you if I find something.

GuyCoast commented 4 years ago

Hi, same problem for me, I fix this with code modification in connectydlidar.ino. Check this link: https://github.com/EAIBOT/ydlidar_arduino/pull/4/files

EmileDqy commented 4 years ago

Hi, thank you for your quick reply.

I just tried your modification and but I get this: image

GuyCoast commented 4 years ago

try to disconnect SCTP pin (pwm signal)

Code work for me, look:

current angle:8.4843750000 current distance:2508.0000000000 current angle:9.0625000000 current distance:2513.0000000000 current angle:9.6406250000 current distance:2519.0000000000 current angle:10.2343750000 current distance:2524.0000000000 current angle:10.8125000000 current distance:2532.0000000000 current angle:11.4062500000 current distance:2540.0000000000

EmileDqy commented 4 years ago

I managed to make it work but now it drains too much amps from my Arduino UNO. I need to find a reliable 350mA -5V power supply and it should work for more than 5 secondes.

My problem was the noise generated by the breadboard.

Enes73728 commented 4 years ago

I managed to make it work but now it drains too much amps from my Arduino UNO. I need to find a reliable 350mA -5V power supply and it should work for more than 5 secondes.

My problem was the noise generated by the breadboard.

How did you manage the noise generated by the breadboard ? I don't really get how you solved you issue tbh

doro516 commented 4 years ago

I have a ydlidar X4,a apparently works but the angles samples are not continue, sometimes jump for, example from angle 10 to angle 70, from angle 80 to 320. have you seen the same?

dduddaddidda commented 2 years ago

Hi, did you manage to get working the library?

Im using arduino UNO and i get this error:

"YDLIDAR get DeviceInfo Error!!!"

help meeee

Hi, did you fix that problem? now I have same one

rkammela commented 9 months ago

I have the same error, able to get device info, it says the health status is well and it's scanning. I can see LIDAR is spinning but getting the "YDLIDAR get Scandata failed!!" error. Which is the same issue described in this post. Did anyone resolve this issue?

Serial:2022110301111111 [YDLIDAR INFO] Current Sampling Rate:4K [YDLIDAR INFO] Current Scan Frequency:7.0000000000Hz [YDLIDAR INFO] YDLIDAR running correctly! The health status: well Now YDLIDAR is scanning ...... YDLIDAR get Scandata fialed!!

urmamafavthans commented 3 months ago

Hi, same problem for me, I fix this with code modification in connectydlidar.ino. Check this link: https://github.com/EAIBOT/ydlidar_arduino/pull/4/files

Hi may I ask the wiring plan between the YDlidar and Arudino?

urmamafavthans commented 3 months ago

I have the same error, able to get device info, it says the health status is well and it's scanning. I can see LIDAR is spinning but getting the "YDLIDAR get Scandata failed!!" error. Which is the same issue described in this post. Did anyone resolve this issue?

Serial:2022110301111111 [YDLIDAR INFO] Current Sampling Rate:4K [YDLIDAR INFO] Current Scan Frequency:7.0000000000Hz [YDLIDAR INFO] YDLIDAR running correctly! The health status: well Now YDLIDAR is scanning ...... YDLIDAR get Scandata fialed!!

Hi have you fix it afterwards?