I intend to buy a Lidar scanner ( RPLIDAR S1) having a serial data rate of 256000 b/s.
May I use this Lidar with an Arduino MEGA controller ?
Is it possible to configure the hardware serial interfaces of the MEGA exactly to this imposed data rate ?
From what you can find quickly online (such as here), the Arduino Mega can most certainly achieve higher baud rates (including 256000 bps) with the right setup.
Yes, but that would most likely be the wrong approach.
What I mean by this is that while you can find some Arduino examples online doing basic acquiring of rotating LIDAR sensor measurements (similar ones to this and its data rate), you will most likely be severely limited in what you can do with this data once you acquire it.
The default sample rate of the RPLidar S1 is ~9.2 kHz. This means you would have to process 9200 data points per second. You may already know, but the ATmega2560 (specs here) has only 8 KB of ram. This means that is most likely not possible to even buffer all of the data to process it further.
I don’t know what your project is yet (please add details about that in a reply!), but the Arduino Mega platform is most likely not powerful enough to handle that kind of data rates, let alone do any processing of it (which is typically math heavy).
You would be much better off with a more powerful platform to do this. If you are looking to stay in the Arduino ecosystem I recommend something along the lines of a Teensy 4 [RB-Pjr-18], which has much better processing capabilities and way more ram (1024 KB).
Most users of sensors such as the RPLidar S1 use them for complex object detection/collision avoidance and/or SLAM. What is your project about / what do you intend to do with your sensor? Knowing this would help us offer more appropriate info!
My project concerns the agricultural field: I would like to realize a robot capable of moving with a precision better than 10 cm between rows of fruit trees. The robot’s speed of progress is very slow (about 3 meters per minute).
For position tracking I rely on two means, a GPS RTK and a LIDAR.
I have already made a prototype mower driven by a GPS RTK that works very well:
But I encounter a difficulty when trees form a large vegetation cover above the robot, preventing the GPS from functioning properly. That’s when LIDAR would take over. Obviously I will have to develop a way to merge the GPS and LIDAR data.
This LIDAR would allow guidance from the identification of tree trunks that would be nearby, typically within 10 meters of the robot.
I chose the SLAMTEC S1 because it is the only one that can be used reliably outdoors, under sunlight (Some trunks can be illuminated directly by the sun).
Unfortunately the amount of information provided is huge and unnecessary for me. Typically a sweep at the speed of 1 revolution per second would suit me better. In addition I would benefit from better angular resolution with more measuring points on each trunk.
My project is not professional and is completely open (I am a French retiree). If you are interested, I would be happy to discuss other ideas.
Thank you for the conversation and maybe I’ll see you soon.
I would just like to add a clarification on my project to merge GPS data with LIDAR data.
Of course I also provided an accelerometer, magnetometer and gyroscope (your BNO055 9 DOF Absolute Orientation IMU Fusion Breakout Board)
It is quite possible that one or more of those existing solutions would fit your needs directly or with some amount of modification. That being said, processing LIDAR with the goal of locating your robot in the world will most likely need more processing power than the Arduino MEGA can provide especially if it is doing all the other things from the link you provided (driving the wheels, obtaining GPS data, etc.).
For sure encoders on the wheels will be a good addition, whether you use LIDAR or not for your project.
As for processing, you may want to try to use a board that is well document such as the RPi 4 (RB-Ras-25/RB-Ras-26). Both of those should have more than enough power available to do this kind of processing. You may also want to look at RPi 3B+ [RB-Ras-20].
Otherwise, other forms of laser-based sensors may be a better solution. For example, if your robot is moving in a pre-determined straight line when it loses GPS signal / RTK lock then you could instead place a few reflective surfaces perpendicular to the movement direction and detect those using a single beam LIDAR sensor instead. This could be processed easily using your current platform (Arduino MEGA).
Something like the LLV3HP [RB-Pli-17], TeraRanger Evo 60m [RB-Ter-17], Benewake TF03 [RB-Ben-12] depending on how far you would need to sense your reference point from.
That sounds like the best plan! Let us know what you end up choosing… always curious to see these kind of projects and which direction they go!
And we’ll be glad to assist!
As a side note, you may want to create a page here to show details about your project. This not only allows you to more easily share info about your project when you need assistance but also help inspire others in making robots! Plus, I’m sure the RobotShop community would be happy to learn more about your project.