Category Archives: Python

Lidar Robot

This is a video of my DIY Lidar robot. Here it is using a spinning laser distance sensor (Xiaomi robot vacuum spare part) to drive around and avoid obstacles. The sensor is connected to a Raspberry Pi running a Python script that is the main behavior program. There is no mapping going on, the robot is just going forward and turning away from things that are to close. The Raspberry Pi then sends serial data to an Arduino that controls stepper motors driving the robot.

The Xiaomi laser distance sensor is connected to a Teensy 3.2 running code from this project: https://github.com/getSurreal/XV_Lidar_Controller

The Teensy 3.2 is running PID speed control for the DC motor that spins the sensor. It is also reading the binary sensor data and sends it in easy to understand ASCII-messages over serial to the Raspberry Pi. The sensor spins at 5 revolutions per second and makes a distance measurement for every degree. Resulting in 360*5 = 1800 measurements per second. The accuracy is within a few centimeters. This sensor trigonometry to measure distance, in that way it is not a real Lidar sensor.