Update (17/10/2020): I made a new Lidar sensor. It has a lot of improvements compared to this one: link to the article.
In order to perform an accurate 3D scan of a room/environment, I created this lidar (LIght Detection And Ranging) turret as a 3-day project. Based on the Garmin™ LIDAR-Lite v3, it scans its surroundings using an infrared laser beam and rotating it using small servomotors. This video shows the completed apparatus:
The scan time mainly depends of the step size we chose. It ranges from less that a minute to about 30 minutes (full resolution, more that 32,000 data points). The accuracy of the measurements is about 1 cm, up to 40 meters in range.
The acquisition and visualization software I created for this project can extract the point cloud for further use (3D Printing, CAD software, etc.).
Hardware-wise, the scanner is rather basic: two 9g micro servomotors control the roll and pitch rotational axes. The brackets that hold them together are 3D printed.
Concerning the electronics, I used:
- Arduino Nano: the controller for the turret. It drives the servomotors and control the lidar while doing a small amount of computation to output the point cloud.
- LIDAR-Lite v3: a compact, high-performance optical distance measurement sensor.
- 9g SG90 Servomotors: actuators to rotate the lidar. Although these weak motors are a major bottleneck to the system, I used them simply because I already had them. Some more powerful and less "wobbly" servos would definitely enhance the quality and speed of the capture.
- 650uF capacitor: this large electrolytic capacitor prevents the micro-controller from rebooting during the current spikes that both the lidar and the motors create.
This is the wiring diagram for the my lidar turret:
The software that operates this project is divided into two distinct bits of code: the micro-controller side and the data acquisition/visualization software. It is of course fully open-source, and you can download the complete source for both parts by clicking on this button:
Thank to the Servo.h and LIDARLite.h Arduino libraries, the code to control these elements is made much easier. The basic work-flow of the code is the following:
Init. lidar, servos and serial; for YawAngle = 0 to 180: for PitchAngle = 0 to 180: Compute_coordinates(); Send_value();
The micro-controller only knows the angles of the servos and the distance to the obstacle. A small amount of computation is required to convert the yaw angle, pitch angle and range information into much more usable X, Y and Z coordinates.
Using these spherical to Cartesian coordinates system conversion formulas, it outputs the position of the point on the serial port.
Data acquisition and visualization software
In order to collect, display and use the turret, I created a software using Processing. It is a very convenient open-source Java framework made for graphic related work. LidarViewer reads the serial port to get the data; displays it as a 3D point cloud we can zoom, pan, rotate and move; and saves it to a file so we can use it later on (in Meshlab for instance).
Author: Charles Grassin