Arduino Based Driver for Slamtech S1 LIDAR

I recently purchased the SLAMTECH S1 Lidar from Robotshop. I got it working on my Windows PC using their sample code. I need to interface it to an Arduino based - ESP32 Development Board module. I did not want to start moving the source code for Windows over to the Arduino environment and was hoping that someone could direct me to a source of such drivers. I have been in contact with SLAMTEC support and they confirm they do not have one for the Arduino. My intent is to process readings from the unit and detect objects in the field of view. Thank you.

1 Like

HI @ABasacchi and welcome to our forum.

If SLAMTEC doesn’t have it, it may be not so easy to find.

Anyway, I did a quick google search, and it seems that RPLIDAR from Robopeak has it.

Maybe something can be used from them?

I’ve found these links:
http://www.robopeak.net/data/doc/rplidar/appnote/RPLDAPPN01-rplidar_appnote_arduinolib-enUS.pdf

Hi @djurk0wic: I appreciate the welcome and especially the references. It has been a real challenge finding code for the S1 and Arduino. I really appreciate you finding these references and I will review them in detail. I suspect I will need to make modifications to the code as the S1 has more commands and responses then the A1. But at least I have a good basis to go from. Thank you again and will let you know how I make out with this.

Andy

1 Like

You are welcome @ABasacchi :slight_smile:

Let us know if you managed to make it work.

Thank you.

Hi @djurk0wic:

Just wanted to report back that I got the RPLidar S1 talking to my ESP32! I started with trying to figure out what Serial port that would connect to it and realized that the ESP32 serial monitor for printing was the same used in the default code to communicate with the RPLidar. I confirmed this quickly as I could not get any Serial.print(); debug commands to work. After some research on the ESP32 and hardwareserial (used in the sample code from ROBOpeak) I realized I had to use another port. I researched the main command in the driver ‘HardwareSerial * _bined_serialdev’ and got very lucky with a reference to the exact code (someone else had the issue) but they showed how to reassign the serial port! (Arduino Due DMA Serial Port - Arduino Due - Arduino Forum).

I then saw other web references to not to use the U1UXD port and decided to use U2UXD. First attempt at the connection - bingo. Angle and distance returning back to the serial console! There are some intermittent wrong values (e.g. angle greater than 360 Degrees), but I suspect it could be speed of the process and my printing every value to see if it works. Next to process the values prior to printing as I am looking for specific targets.

Well - thanks again for your help.

Andy

1 Like

Great job @ABasacchi :smiley:

Hola a todos!!

Despues de visitar varios sitios y probar variantes coincido en el mismo problema con @djurk0wic: Hay algunos valores incorrectos intermitentes (por ejemplo, ángulo superior a 360 grados),

sabeis como conseguir valores correctos

muchas gracias y un cordial saludo

Hi:

I do not speak Spanish but I translated your message with Google. I did not have issues with angles greater than 360 Degrees with the S1 LIDAR. I did have some odd readings at some angles - it was picking up something that was not there - almost like a blind spot. For me it was outside the range that I needed so I ignored the readings.

I would suggest contact Slamtech support as they do have good engineers.

Thanks

Andy

1 Like

Hi @ABasacchi,

I’m trying to connect my S1 Lidar with an arduino board and i would like to ask you if you can give me your code ?

Thanks,

Gabriel

Hi Gabriel:

My code includes lots of other code in addition to the LIDAR section. I started by doing a lot of Google searches for code and found my starting point here…

RoboPeak.com” . I think they were acquired by SLAMTEC and unfortunately did not upgrade the code. If you contact SLAMTEC they will refer you to their examples that with much work (I was not able to get them to work) you can possibly get Arduino to communicate with their LIDAR. The code that I found was from 2014 and very simple interface. You will need to download their driver too ‘RPLidar.h’.

Thanks

Andy