3D scanning like a pro


Almost any sensor yields more interesting results if mounted on a moving platform. Remember scanning thermometer? It’s time to mount TOF LIDAR (Time Of Flight / Light Imaging, Detection, And Ranging) on two precision rotary stages arranged for pan and tilt operation. Rig provides real-time position data along with distance to an obstacle. Using simple math we can calculate position in Cartesian coordinate system. Data is collected point by point to reconstruct 3D object model.

Used parts

I have been looking for LIDAR for a while and decided to use Garmin as an affordable distance sensor, so bought one for a spin.


Garmin LIDAR outputs data at up to 500 measurements a second which is way faster than thermal sensor, yet it takes about 15 minutes to scan full sphere yielding true scale 1-2M point cloud. No stitching, no lengthy post processing! And result is spectacular.

Animated GIF for better depth perception. Calculated point cloud normals and colorized according to their vector direction. Click for better quality in Youtube.
This is another fast scan with higher rotation speed. Result is 300K point cloud.

4.7M point cloud room view from above with colors removed. From this picture it’s possible to see that distance measurement could be more precise and laser beam angle could be narrower. Density is pretty even which indicates nice rotary stage performance and correct calculation.
Depth map colorized in heatmap colors and fixed black pixels. This imaging is useful for fast quality inspection.
Unfortunately this particular LIDAR is not quite suitable for outdoor mapping. Laser is too weak even in dusk and measurement rate drops, therefore scanning speed has to be reduced and it would take hours to cover longer range. Click for better quality in Youtube.

Laser barely reaches 4’th floor, therefore making it not suitable for long range outdoor operation.


I have written set of Python scripts to make scans like this. As release is still pending, will briefly describe what they do:


  1. Establish communication to sensor and motion controller
  2. Initialize motion platform (homing, zeroing)
  3. Start motion at specified speed and tilt incline angle. Rotation count is calculated automatically. Platform rotates at constant angular speed gradually changing tilt angle
  4. Platform position data is being recorded into file along with timestamp
  5. Sensor data is being recorded into separate file along with timestamp
  6. After scan is complete platform moves home and computer beeps to indicate end of scan

Fill dead pixels

  1. Load bitmap picture (generated as intermediate result by aggregate script)
  2. Find black pixels
  3. For each black pixel find neighbouring pixels, average their color and fill black pixel with new value
  4. Save file as new bitmap picture

Finding of black pixels can be done by brute force but it will take ages. Speed up can be done by using numpy functionality:

pixels = np.asarray(img_gray)
coordList = np.where(pixels != 0)
coordinates = zip(coordList[0], coordList[1])


  1. Load previously saved files (position data and sensor values)
  2. For each sensor value interpolate motor position from two nearest points (aligned by timestamp)
  3. Convert depth data to color and coordinates into 2D picture for fast preview (or final picture in case of thermometer)
  4. Convert angle and measured depth to Cartesian coordinate system and save each pixel to *.xyz file.

Pan/tilt/distance conversion to x,y,z is as simple as these formulas:

x = r * sin(th) * cos(tv)
y = r * sin(th) * sin(tv)
z = r * cos(th)

That’s it. Now point cloud file can be opened with preferred 3D manipulation program like MeshLab

Improvements and notes

Main part to be improved is LIDAR. Faster acquisition rate, smaller beam expansion, better precision and greater power is required.

Motion platform operation is quiet, smooth, fast and precise.Though with faster laser fast axis might be limiting factor.

Draft software lacks real-time preview of what’s happening, but that’s easy to update.

One slip-ring is damaged (or bad by design) and sometimes I2C communication is interrupted – added watchdog protection to restore LIDAR operation.

One more major update could be getting rid of laptop, instead using single board computer with tablet or smartphone connected over WiFi.

Comments ( 32 )

  1. 3D scanning like a pro - DIY Photography
    […] products on his website and look him up on Facebook and Twitter. This article was also published here and shared with […]
  2. jeff
    Very nice! What slip-ring did you use?
    • saulius
      Don't have exact part number, but short description is: "12.5mm Mini Slip Ring 12 Conductors"
  3. Arpad
    Fantastic stuff, great job! How adaptable is this to higher scanning resolution on a small, rotating platform?
    • saulius
      Hi Arpad, I have similar setup for scanning small objects with laser and camera. How big (small) is your object?
      • Arpad
        About 2-3" Thanks for the reply & info!
  4. saulius
    No problem, what resolution are you looking for?
  5. Digitize Your Room With LIDAR | Hackaday
    […] the best way to image a room? A picture? Hah — don’t be so old-fashioned! You want a LIDAR rig to scan the space and reconstruct it as a 3D point map in your […]
  6. Digitize Your Room With LIDAR | HackerWorld
    […] the best way to image a room? A picture? Hah — don’t be so old-fashioned! You want a LIDAR rig to scan the space and reconstruct it as a 3D point map in your […]
  7. MikeMo
    Great work with this. What would you estimate the range threshold to be (in feet), beyond which the point cloud starts to suffer? Also, you mention laser is weak at dusk... so results differ based on lighting? I saw a similar solution with the same Garmin sensor being used for cave mapping so I'm curious about that comment.
    • saulius
      MikeMo, I'd say everything what is up to 5m (16ft) should be usable with Garmin sensor. Daylight makes it harder to pick up reflection and measurement rate drops. Though measurement works more or less ok up to 20m (65ft) or so.
  8. 3D Scan a Room With This LIDAR Rig - What Do I Make
    […] Ready to 3D scan like a pro? Be sure to check out Lukse’s entire write-up here. […]
  9. Thomas
    Hi! Im looking to do Lidar measurements on water waves outside - do you think that'll be possible with Garmin lidar-lite ? It'll be outside ..
    • saulius
      Hi Thomas, what distance do you plan to measure?
  10. Nicobourb
    What a great project!! Thanks for sharing! Do you have an idea or an assessment of the precision reached ? Is it roughly 1 centimeter or more 1mm?
    • saulius
      Hi Nicolas, this particular LIDAR has resolution of 1cm and 2.5cm accuracy in range up to 5m.
  11. cdmsjtr
    Is the arduino project available?
    • saulius
      Hi, Arduino project actually is too simple to publish. Arduino1 - Garmin provides a sketch for LIDAR-Lite 3 and I used it almost unmodified. Arduino2 - unmodified GRBL with adapted settings for RSA1 motion platform.
  12. John
    Would you be opposed to sharing a couple of your point clouds (does your software output them)? I'm very curious to see how they would reconstruct to a mesh inside of various software applications. While I myself could not manage at constructing something similar to your unit, I'd certainly try and seek out someone knowledgable enough if the point clouds can indeed fit the needs -- which is basically what you are doing in your images (room mapping). Thank you for sharing so much of your process!
    • saulius
      Hi John, it was quite a while since these experiments were conducted. Don't remember which dataset it is but feel free to inspect it http://www.kurokesu.com/uploads/room_scan.xyz Data format is (vector 1, vector 2, distance).
  13. rutu
    Hi, I am working on similar kind of project. Do you have any source code which you can share.
    • saulius
      Hi Rutu, I guess you will have to write your own program as code snippets I used were very crude and good for testing only.
  14. rutu
    Thank you! actually I have got the map but the quality of the map is not that good so I would appreciate if you help me with that . Thanks in advance!
    • saulius
      There are lot of things that can influence results ranging from low positioning resolution, faulty LIDAR or data synthesis algorithm. Please describe your setup, maybe I will be able to point out an issue.
  15. Ali
    Hi Thanks for your blog. I need help in understanding .xyz file. What units are the x y and z in .xyz file? The lidar lite sends data in centimeters. using the conversion to cartesian the points will be in cm , it means the xyz file have it in centi meters? ORegardsne more thing , the .xyz file is related to point 2 and 3 under aggregate heading above? I am sorry if my questions are silly . I hope you will find some time to answer it Regards
    • saulius
      Hi Ali, actually *.xyz has no defined units. And each line defines point in space. Please see MeshLab for more details as I selected this file format in order to import points there.
  16. lmes
    could you please send the cripts of Python to make scans like this,I need to make an project like this using Lidar V3 and Rasberry.
    • saulius
      Hi Imes, scripts were written for proof of concept and were not saved for later use. Feel free to read notes and adapt to your hardware.
  17. Sebi
    Hey Saulius, Where can I find the Code?? thanks
    • saulius
      Hi Sebi, unfortunately code is gone and anyway it was super sketchy. Please use this blog post as a guide to design your own.
  18. Eric McAlexander
    Have these python scripts been approved for release yet? And what format would these scans be saved in?
    • saulius
      Hi Eric, python code was lost and was not prepared for general use. If you know a bit about programming it should be fairly simple to make your own code from information provided in this blog post.

Leave a reply

Your email address will not be published.