I designed and implemented a system from scratch which allows you to map a point cloud of your environment and nearby objects using LIDAR, Arduino, and Unreal Engine 4.
I made the real time visualization tool using Unreal Engine and interfaced the LIDAR with an Arduino Mega using UART and I2C communication protocols.
In order for the Arduino to communicate with Unreal Engine 4, I used the "UE4Duino" plugin created by RVillani.
Example scan of a sofa using a Lidar Lite-V3 (the white color in the middle is the location of the scanning system):
Demonstration of the Lidar rotation with real-time mapping display:
- Hook everything up to the Arduino according to the circuit diagrams below
- Upload the appropriate Arduino code, depending on which LIDAR you are using
- Run the
LidarScanner.exe
application, specifyCom Port
,baud rate
,scan type
and go from there
Note: The exe
is available in the releases of this repository.
When trying to load a previously saved scan into Unreal Engine 4 project:
- Remember to rename the
.sav
file toScanDataSave.sav
- The file goes in
.\LidarScanner3D\LidarScannerUE4\Saved\SaveGames
When trying to load a previously saved scan into the compiled LidarScanner.exe
:
- Go to
.\LidarScannerUE4Compiled\LidarScanner\Saved\SaveGames
and findScanDataSave.sav
- Note: This file has the point cloud data
- If wanted, copy or move it out into a different folder to keep for later and can rename it to something like
room.sav
- To load back in, name the file as
ScanDataSave.sav
and move it to theSaveGames
folder
Although I made the first prototype out of wood, the final design for the Lidar pan-and-tilt was hand built from Aluminum plates. It allows for easy portability, rotation, and great stability.
There are 2 servos needed in order to achieve the scan. Servo 1 is placed right side up allowing the Lidar to rotate horizontally from side to side, and Servo 2 is placed sideways on Servo 1 allowing the Lidar to tilt vertically. To achieve a scan that fixes the tilt in the placement data, calculations have been done as shown below.
I have interfaced the Lidar Lite V3 and TFMini Plus Lidar range finders with an Arduino Mega. I chose to do this using a perfboard for easy development and modularity. Some circuit schematics I made in Fritzing are shown below:
For Lidar Lite V3 using perfboard:
For Lidar Lite V3 using breadboard:
For TFMini Plus: (Note: Replace the Sonar in the diagram with a TFMini Plus. The wiring from the TFMini Plus is based on the colors in the diagram).
For more pictures and diagrams, see the Pics folder of this repo.
The LIDAR sensor measures a distance to the object, and the current orientation of this sensor is given by the servo positions. The angle calculations I did for finding the exact location of the point relative to the LIDAR in 3D Space using vector geometry are shown below: