Introduction: LIDAR Spherical Capture Rig
LIDAR is a highly accurate light-based range-finding technology. It's typically used to scan large plots of land for aerial surveys, but more recently has found its way into many robotics applications, including the self-driving Uber car. By shooting out pulses of infrared light and measuring the time it takes to recover them, a distance estimate can be made, often up to a few mm of accuracy. However, some objects don't reflect light very well, like aluminum foil or car windows, or outdoor scenery that already contains high amounts of infrared light from the sun. High-powered LIDAR can overcome some of these deficits, but many remain for low-cost versions like the one I used here. It's important to note that this LIDAR, an Hokuyo URG-04LX-UG01 really isn't that cheap at about $1,100; however, cheaper versions can be bought and this rig modified in turn.
What does this rig do?
Most lower-end LIDAR devices can only "see" in a plane; that is, they rotate the pulses of light around a single axis. This provides sufficient data to capture, say, the outlines of all objects at knee height in a 360 degree view. This is just enough information for a small autonomous robot to avoid people and obstacles while navigating interior environments. However, if we would like to capture an entire space—not just in a plane but in all possible directions—we need to rotate the LIDAR around a second axis. This rig affords precisely this. The spherical capture rig rotates the LIDAR about an axis orthogonal to its natural sensing axis, capturing a nearly full view of its surroundings.The images obtained from one capture using this technique inside a forest are shown above. Note, however, this rig creates a blind spot in the ground beneath it: a small price to pay for near-complete vision.
How can the data be processed?
This LIDAR can connects over USB and sends the sensing data over serial. At the end of the tutorial, I provide links to download libraries that will save the data and play it back. These libraries are intended to be used with OpenFrameworks, a C++ arts engineering toolkit. For information on how to install and use OpenFrameworks, please see their website here.
Attribution & Thanks
Research Funded in Part by the Frank-Ratchye STUDIO for Creative Inquiry at Carnegie Mellon University.
Many thanks to Golan Levin for a multitude of ideas and support in his course for which this was made, Experimental Capture.
Many thanks to Dan Moore, for his gracious support and for allowing me to use his fantastic OpenFrameworks addon, ofxURG, to connect to the LIDAR.
Step 1: Technical Specifications
- size is about 5" x 8" x 8"
- contains a standard 1/4-20 thread to mount on a tripod
- full scan takes 52 seconds; however, scans can be shortened at the sacrifice of quality or lengthened up to a maximum of 8 minutes for maximum quality
- an entire scan can be captured in a 180 degree (half) turn, since the LIDAR is pointed upward, not sideways
- the gears ratios and motor system have been designed to yield an equal point resolution latitudinally and longitudinally
- requires a 12V source of power to run (if taking outside, you will also need a semi-powerful external battery)
- 0.35 degree resolution between points
- 682 points per scan
- 240 degree field of view (hence the blind spot below)
- 10Hz refresh rate (makes 10 full spins every second)
- Warning: Is powered off of USB, but draws too much current to be used off of a computer's USB port; Use a USB hub instead to separate the power and data transmissions.
Other single-axis LIDARs you can purchase for less include:
Step 2: Gather Materials & Tools
Below is a comprehensive bill of materials and tools needed to complete this project as is. Prices are listed for suggested suppliers; however, the project can be completed for significantly less if you already have the items or can find a replacement.
- 1/4" acrylic, 12" x 12" sheet * ($9.03 from McMaster Carr)
- 1/8" acrylic, 12" x 12" sheet * ($5.40 from McMaster Carr)
- shrink-wrap tubing (preferred) or electrical tape ($4.95 from Adafruit)
- 3" cable ties (100 for $6.97 from McMaster Carr)
- NEMA-17 Stepper Motor, 200 steps/revolution, 12V 350mA ($14 from Adafruit)
- Hokuyo URG-04LX-UG01 Scanning Laser Rangefinder ($1,100 from RobotShop)
- 8 x 4-40 thread 3/8" Phillips screws (100 for $4.30 from McMaster Carr)
- 11 x 4-40 thread 5/8" Phillips screws (100 for $4.32 from McMaster Carr)
- 3 x 4-40 thread 1" Phillips screws (100 for $5.29 from McMaster Carr)
- 26 x 4-40 thread hex nuts (100 for $0.87 from McMaster Carr)
- USB cable, regular A male to mini B male ($5.49 from Amazon)
- USB cable, regular A male to regular B male ($4.99 from Amazon)
- Arduino UNO ($24.95 from Adafruit)
- 4 pin power cable (optional) ($1.95 from Adafruit)
- A4988 stepper motor driver and heat sink ($5.95 from Pololu)
- 5V voltage regulator 7805 ($0.75 from Adafruit)
- 100 microFarad capacitor (10 for $1.95 from Adafruit)
- breadboard-friendly 2.1mm DC barrel jack ($0.95 from Adafruit)
- 4 x breadboard-friendly SPDT slide switch ($0.95 each from Adafruit)
- half-sized breadboard PCB ($4.50 from Adafruit)
- 4" turntable with bearings, 5/6" tall ($3.11 from McMaster Carr)
- Senring SM022-06 slip ring, 6 wire, 22mm outer diameter ($3.61 from Ebay)
- 1/4-20 thread screw mount nut (50 for $10.74 from McMaster Carr)
- 2-56 thread 3/8" length Phillips screws (100 for $3.28 from McMaster Carr)
- 2 x M3x0.5 mm thread, 6 mm long Phillips screw (100 for $2.68 from McMaster Carr)
- 4 x M3x0.5 mm thread, 10 mm long Phillips screw (100 for $2.68 from McMaster Carr)
- assorted 22 gauge (or similar) solid wire
- gaffers or electrical tape
- 12V 3A power supply with 5.5x2.1mm barrel jack ($10.68 from Amazon)
- powered USB hub ($16.99 from Amazon)
- 2 x 7/32" inner diameter rubber push-in grommet (50 for $16.98 from McMaster Carr)
* Cast acrylic is generally more precise than extruded acrylic and is the preferred type for this application. However, extruded is acceptable, though some tolerances may need to be adjusted more than usual.
- laser cutter capable of cutting through at least 1/4" acrylic
- soldering iron, solder, fan (to remove vapors)
- small Phillips screwdriver
- wire cutters
- wire strippers
- needle nose pliers
- glue gun and blue painters tape or masking tape
- hot air gun
To Program the Arduino:
- Arduino IDE (download here)
To Run Provided Capture Software:
- Apple computer
- OpenFrameworks and C++ experience for modifying the provided capture code
Step 3: Lasercut Acrylic Parts
Included here are four vector files:
- lidar_rig_assembled.ai : Contains aligned lasercut and non-lasercut parts separated into layers. This file is provided for your own reference or if you would like to modify any of the parts.
- lidar_rig_lasercut_layout.ai : Contains two layers, each labeled with a different thickness of acrylic. The first option is to lasercut from these files directly. They are laid out on 12" x 12" boards.
- lidar_rig_lasercut_layout_quarter_inch_acrylic.svg and lidar_rig_lasercut_layout_eighth_inch_acrylic.svg : These files represent the same parts as the AI file, but are provided as a second option to lasercut from, if you don't have access to Adobe Illustrator.
Proceed to lasercut all files. Cast acrylic is recommended over extruded for accuracy.
Step 4: Attach Tripod Plate
Gather the bottom plate, tripod plate, T nut insert, and three 2-56 screws.
Sandwich the bottom plate in between the T nut insert and the tripod plate. From the flanged side of the T nut, screw the 2-56 screws directly into the acrylic. The tolerances should be just right to ensure a snug fit. If they are too loose and the screws don't grip the acrylic, adjust the tolerances and lasercut new pieces.
Step 5: Splice Slip Ring Into USB Cable
Gather the USB A male to B mini male cable and slip ring.
A slip ring is a essentially a group of wires that can twist over and over again without ever getting stuck or tying into a knot. Slip rings solve the problem of sending and receiving data and power over a connection that needs to rotate indefinitely. We have this exactly problem in this rig, since the top gear will rotate on top of the bottom plate, but needs to be connected to it somehow to receive power and send data. This is why we need a slip ring.
Cut the USB cable about 4-5 inches away from the mini end. On both ends, pull back the rubber and wire mesh sheathing, exposing the four inner wires. Run shrink wrap tubing over each individual wire and each bunch. Solder the USB wires to each end of the slip ring, being sure to solder strong connections and connect the same USB colored wires to each end of the slip ring. For example, if a USB wire is red, you need not solder it to the red slip ring wire (though this may be easier to remember). Say you solder it to a green slip ring wire, then simply connect the other side of the slip ring's green wire to the red wire in the other half of the USB cable. Pull the tubing over the solder joints and heat with a hot air gun to shrink.
Step 6: Install Slip Ring
Gather the assembled slip ring cable, assembled bottom plate, three 1" 4-40 screws, and seven 4-40 nuts.
Place the screws through the holes in the slip ring. Then, screw one nut on each just a few turns shy of being tightened fully. On the one screw perpendicular to the separation of the slip ring wires place a second nut and screw about halfway up.
Slide the assemblage into the holes in the bottom plate with the two-nut screw facing toward the hole in the plate. Turn the plate over and place the last three nuts in their respective hexagonal holes. Tighten the screws into these bottom nuts, then tighten the nuts on the top of the mount using needle nose pliers. The resulting slip ring should be tightly secured on the bottom plate.
Lastly, tie the A-male end of the USB cable to the bottom of the plate with a cable tie.
Step 7: Assemble LIDAR Mount
Gather the remaining lasercut parts, eleven 5/8" 4-40 screws, and eleven 4-40 nuts.
Begin by screwing two screws into the triangular part (as shown in the photos) and tightening a nut on each halfway up the screw. Slide this part into the long rectangular piece. Tighten the screws until the two parts feel snug against one another. Don't tighten too hard or the acrylic may snap.
Then, add the smaller brace and large rectangular piece with a similar procedure, according to the photos. This becomes the mount on which the LIDAR will rest.
Repeat this procedure with the four remaining screws and nuts to attach this assemblage to the large gear.
Step 8: Install Stepper Motor
Gather the assembled bottom plate (with slip ring attached), stepper motor, small gear, two rubber grommets, and four 10mm M3 screws.
Using the M3 screws, screw the stepper motor into the bottom of bottom plate. Orient the stepper cables away from the center of the mount so they don't collide with a mounted tripod.
Slide a grommet halfway down the shaft of the motor. Slide the small gear on next, then finally a second grommet. Push these three down until they just clear the top of the shaft.
Step 9: Assemble Rig With Turntable
Gather the assembled bottom plate, assembled top gear, turntable, eight 3/8" 4-40 screws, and eight 4-40 nuts.
Run the B-mini end of the USB cable through the center of the turntable. Position the turntable directly in the center of the bottom plate (it may be wise to use a small bit of tape to secure it through this process). Secure the turntable with four screws and nuts, placing the nuts on the side of the turntable.
Place the large gear on top of the turntable and rotate so that two holes align on either side of the bottom plate. Begin with two screws and two nuts. Tighten only enough so that the gear can be repositioned with a nudge. Rotate the top gear to check that it's aligned. (Look at the space between the gear and the slip ring. Uneven gaps indicate that either the top gear is off-center on the turntable. If the uneven gaps don't go away, try repositioning the turntable on the bottom plate). Finally, add the last two screws to secure both parts to the turntable.
This forms the rig (minus the LIDAR).
Step 10: Mount LIDAR
Gather the rig, the LIDAR, and two 6mm M3 screws.
Position the LIDAR facing toward the center of the rig on the large rectangular plate. The lip of the LIDAR (that creates a blind spot) should be facing down toward the rig to maximize the amount of unobstructed view.
Screw the LIDAR into the mount.
Connect the USB cable (B-mini) end into the LIDAR.
This completes the rig.
Step 11: Assemble Motor Driver Electronics
Assemble all specified electronics. The arrangement of components on a protoboard is up to you; however, one possible arrangement is in the photographs above.
Solder all connects according to the circuit diagram provided above.
The switches allow you to switch between different stepping amounts for the stepper motor. The standard step I set to afford equal point spacing with a 52 second capture time is to turn the first switch on and the second two off.
The capacitor wards off voltage spikes when mounting and dismounting the 12V power supply.
Be careful not to program the Arduino while the 12V supply is connected for fear of powering the Arduino with two separate 5V sources.
The 4-pin cable is suggested as a way to connect and disconnect the rig (containing the servo) from the motor driver.
Once assembled, connect the rig to the motor driver.
Step 12: Program Motor Driver
Program the Motor Driver using the code provided here.
Changing the resolution variable will change the number of steps the motor takes in one cycle. The directionPin and stepPin refer to the digital pins on the Arduino that connect to the A4988.
Be sure to unplug the 12V supply while programming the Arduino so two 5V sources aren't powering the Arduino at the same time.
Step 13: Connecting and Powering the Assembly
First, connect the USB A-male end of the cable emanating from the LIDAR rig into the USB hub as a data source. Connect your computer via usb cable into the USB hub to ensure that the LIDAR rig draws power from the hub (and thus the wall), not your computer (since it can fry your USB ports otherwise).
To power on the assembly, connect the Motor Driver System to the 12V wall power supply. Then, power on the USB hub. Your computer should recognize a new USB connection and the LIDAR should power on. On this model, a small blinking yellow light appears on the top of the device and a faint red light can be seen pulsing from the clear cylindrical section at the right angle. The large gear should also begin rotating, in turn rotating the LIDAR with it.
Step 14: Recording Spherical Captures
To record spherical captures, first stabilize your rig by attaching it to a tripod. If you take your rig outdoors without a wall outlet near, you may need to purchase an external battery to power the motor system, USB HUB (and thus, LIDAR).
To record captures with the provided software, you will need OpenFrameworks to compile the applications. The first application you will need to compile and run (after your LIDAR is connected to your computer) is Dan Moore's ofxURG sender application. Navigate to releases > Sender to download the binaries. Follow the instructions on his README page for setting up this app.
The next application you will need to compile and run (after the sender application is running) is my urg_record application found here. OpenFrameworks familiarity is encouraged: instructions for downloading it and compiling projects can be found here.
Once both applications are open and connected to the correct OSC ports (an option you can change in the settings.xml file), you should see something like the screenshot above is all parts of the pipeline are working (of course, the scene captured will be whatever you are currently capturing).
Click New Recording to begin a recording and End Recording to end it. It will be saved in the bin > data folder of your application as a csv file. Each line in the file represents the information (682 points) recorded in one sweep of the laser. The first number is the number of elapsed milliseconds since the recording began. Each pair of points that follows represents the floating point value of the (X, Y) location in the planar space of a single scan in units of mm.
Step 15: Playing Back Spherical Captures
To play back recordings, compile the project urg_display here.
Set the path of the recorded data csv file by changing the path loaded in "ofApp.cpp"
Set the proper capture type at the top of "ofApp.h" Recordings fall into two categories: those made with the rig while it's rotating (these are spherical captures, for which this Instructable was designed), and those made with the LIDAR while it's standing still (these are linear captures, and don't need this rig or any rig for that matter).
The capture should load as soon as app is run. Change the view by translating, rescaling, and mirroring it. To slide through or rotate the scan (depending on its type), press 's' or 'r', respectively.
A few screenshots of captures that I've taken are included for reference above.
Step 16: Extensions
There are many ways you can extend this project. For example (in the order of included videos):
- Take linear captures to see how people get "extruded" through time.
- Take many sequential captures and splice them into a 3D timelapse.
- Apply shader effects to the resulting point clouds to bring the capture to life.
Runner Up in the
Make It Move Contest 2017