Hacking XV-11 Lidar (Cheap lidar option)

My idea of using a XV-11 Lidar as a cheap sensor option actually started from this video from Robotics Weekend.

While waiting to get more components to experiment the same setup as his, I utilize other resources that I have to get some output and verify that my lidar is working. I have a Raspberry Pi 3 and an Arduino Uno boards.

Open up the Lidar

I got the lidar on eBay for about $60 which is not too bad. The only info I know about this unit is its model XV-11. After reading from XV11 Hacking, I understand more that there are 2 versions of this type of lidar, the earlier version is powered by 3.3v and the later version is powered by 5v. The motor can be powered by 3.3v, RX and TX port are 8N1 3.3v at 115200 baud rate for all units.

So I opened up the cap of the unit (top 4 screws) to investigate the unit, and I have a 5V powered unit.

Testing the Lidar on Arduino Uno

Connecting

RED – 5v
BLACK – GND
BROWN(LDS_RX) – pin 4
ORANGE(LDS_TX) – pin 3

(PLEASE NOTE you want 3.3v for your TX and RX so that you would not damage your unit, I used a voltage divider setup to obtain this. Although before I know about this, I did connect the TX and RX directly to the Arduino pins. Someone warned me later but good thing my lidar was not damaged!)

Arduino codes:

#include

#define rxPin 3
#define txPin 4

SoftwareSerial mySerial(rxPin, txPin);
char pinState;

void setup(){
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(115200);
mySerial.begin(115200);
}

void loop() {
if (mySerial.available()){
pinState = mySerial.read();
// pinState = Serial.read();
// mySerial.print(someChar);
Serial.print(pinState);
}
}

After connecting the lidar to Arduino, Arduino to PC (through USB) and upload the code, I have the Serial Monitor screen on. Then, unplug 1 power wire connect to the unit and plug it back in again. Now, the unit shows to have some response because it should output something on the Serial Monitor. SoftwareSerial does not support up to 115200 baud rate, it does not yield anything readable. However, some response at least gives me hope that my lidar is working.

Test Lidar on Raspberry Pi

From my experience, starting with the RPi is actually easier than with the Arduino board. If you have a Raspberry Pi board, it’s probably better to start from here, and not worry so much about all the electronic current, voltage. I found Tobias Weis instruction working out the best for me.

On the side note, you should also enable UART on your Rapsberry Pi so there is open communication on the Serial port (follow this instruction ). If using Raspberry Pi 3, your port can be different from the instruction, you can try port/dev/ttyS0 if dev/ttyAMC0 does not work. By running the Python script on Tobias website alone, I can see some data running on terminal.

(PLEASE NOTE: you do not have to make the motor running to test. However, I realized that if the motor does not spin, the lidar does not generate data. So you can use your finger and spin the top of the lidar yourself, you would see some data showing. I think as the data showing, it confirms that the lidar is working.)

Visualize through ROS

At this point, I successfully got the unit running by connect directly to the RPi. To visualize the laser data on ROS, I have ROS installed in both your PC and the RPi. Then follow the set up steps that the Robotics Weekend does in the first video to have your ROS-PC connect to ROS-RPI master.

To run the neato_laser_publisher node on my Rpi 3, I run this on the Pi’s terminal:

$rosrun xv_11_laser_driver neato_laser_publisher _port:=/dev/ttyS0 _firmware_version:=2

Then head over to local PC terminal, and run this command:

$rosrun rviz rviz -f my_frame

(my_frame here is neato_laser )

Credits:

Robotics Weekend:
http://roboticsweekends.blogspot.com/2017/12/how-to-connect-neato-xv-11-lidar-to.html

Xv11 Hacking:
https://web.archive.org/web/20150326122026/http://profmason.com/?p=13246

Control on Arduino:
https://ethandicks.wordpress.com/2014/12/12/neato-robotics-xv-21-vacuum-cleaner-cheapest-laser-scanner-ever/

Control on Raspberry Pi:
http://www.tobias-weis.de/neato-xv-laser-scanner-lidar/

GetSurreal Firmware:
https://github.com/getSurreal/XV_Lidar_Controller

How to get fixed frame on Rviz:
https://answers.ros.org/question/232731/how-to-start-rviz-with-a-fixed-frame/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s