But since this uses the total time of flight for the ball, it gives the total distance the ball traveled—to the wall and back. If you take that distance and divide by 2, you get the distance from my hand to the wall, which in this case would be 10 meters.
I like this BallDAR method because you can easily imagine throwing a ball and measuring the time. But lidar is essentially the same idea: Instead of using a ball that travels back and forth, lidar uses light. (That’s the “li” part of lidar.)
Theoretically, you could create a DIY version of lidar with a flashlight or even a laser pointer. Just aim your laser at some object, and as soon as you turn on the laser, start a stopwatch. The light will travel outward, hit the wall, and then reflect back. As soon as you see that laser spot on the wall, stop the stopwatch. Then you just need the speed of light to calculate the distance.
There is, of course, a practical issue: Light travels really fast. Its speed is 3 x 108 meters per second. That’s over 670 million miles per hour. If you’re measuring a distance of 10 meters (like in the BallDAR example), the flight time would be around 0.000000067 seconds, or 67 nanoseconds.
If you want to get lidar to work, you would need a really quick stopwatch. Galileo actually attempted something like this with his experiment to determine the speed of light. Of course, he didn’t have lasers or even a nice stopwatch, but that didn’t stop him from trying. (He couldn’t actually get a measurement.)
Most versions of lidar use a single laser with a detector. When a short pulse is emitted, a computer measures the time it takes to get a signal back to the device. Then it’s a simple calculation to get the distance the light traveled.
But that only measures a single distance. It isn’t enough to make one of these awesome 3D lidar surface images that shows the shapes of objects. In order to get that, you need more data.
If you know where the laser is pointing, you can get a distance and bearing to give you one point on the surface of an object. Next, you just need to repeat this with the laser pointing in a slightly different direction, usually by using a spinning mirror. Keep doing this and you can get a whole bunch of points. After you have collected thousands of them, these points will merge to form an image shaped like the surface of the object you are scanning.
But using a laser plus a spinning mirror isn’t just expensive, it’s also too bulky to fit in your phone. So how does lidar work on an iPhone? I want to just say “It’s magic”—because it seems that way to me. All I know is that instead of one beam of light to measure distance, the iPhone uses a grid of dots emitted from the phone in the near infrared wavelengths (like the light from your infrared TV remote). These multiple beams of light are due to an array of vertical cavity surface-emitting lasers, or VCSELs. It’s basically many lasers on a single chip, and it’s what makes it possible to put lidar in a smartphone.