2

What an iPhone Lidar Can Show About the Speed of Light

 2 years ago
source link: https://www.wired.com/story/what-an-iphone-lidar-can-show-about-the-speed-of-light/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

What an iPhone Lidar Can Show About the Speed of Light

Lidar measures distance by bouncing light off of objects—but there’s more to how light travels in the first place.
apple iPhone 12 Pro
Photograph: Neil Godwin/T3 Magazine/Getty Images

I'll be honest: I didn't know that an iPhone was able to do a lidar scan. (The iPhone 12 Pro, 13 Pro, and iPad Pro can all do it.) When I found out that my phone could, I became obsessed with scanning things.

Lidar is useful whenever you need to know something about the shape of an object or surface. It's used in autonomous vehicles to determine the edge of a road, and to detect people and cars. You can put lidar in an aircraft looking down at the surface of the Earth to get mapping data that is useful for both agriculture and archeology, like to find lost structures. It's also great for surveying a region to get a nice 3D map of buildings.

Here is a structure in my local downtown that I scanned recently:

Photograph: Rhett Allain

Lidar is an acronym that stands for "light detection and ranging." It's basically like a tape measure—except that it uses the speed of light to measure distance, instead of a physical object.

To help you visualize how it works, let's consider a different measuring system—I'm going to call this “BallDAR.” Here's how it goes: I find a tennis ball that I can consistently throw with a speed of 20 meters per second. Next, I throw a ball at a wall, and it bounces back to me and I catch it. I measure the time the ball took to go from my hand to the wall and back—let's call it 1 second.

Since I know the speed of the ball (v) and the time interval (Δt), I can calculate the total distance traveled (s) as:

Illustration: Rhett Allain

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.

On top of that, the iPhone uses its accelerometer and gyroscope to determine the location and orientation of the lidar sensor. That means that you can get a fairly accurate scan even while moving the phone around.

Lidar and the Index of Refraction

We like to say that the speed of light is constant with a value of 3 x 108 meters per second. But that's not quite true. That's the speed of light in a vacuum. If you have light traveling through some material, like glass or water, it will have a slower speed.

We can describe the velocity of light in a material with the index of refraction (n). This is just the ratio of the speed of light in a vacuum (c) to the speed in the material (v).

Illustration: Rhett Allain

If you look at a material like glass, it has an index of refraction with a value of 1.52. I mean, that's kind of a big deal. That means that when light is in glass, it travels with a speed that's only 0.667 times as fast as in a vacuum, with a value of 1.97 x 108 m/s.

How about some other materials? The air in our atmosphere has an index of refraction (n) of 1.000273, meaning the speed of light is nearly the same as in a vacuum. Water has an index value of 1.33. Diamond is at 2.417, which means light travels through a diamond at less than half the speed it travels in a vacuum.

But why does light travel slower in a material than it does in a vacuum? I'm going to tell you two very common—but very wrong—explanations.

The first is that when light enters something like glass, it is absorbed by the atoms in the glass and then re-emitted some very short time later, and this delay causes the light to travel slower. But it’s easy to see that this is wrong. Although atoms can indeed absorb light and then re-emit it, this process doesn't preserve the original direction of the light. If this was true, the light should scatter—and that doesn't happen.

The other wrong explanation is that light goes through the glass, hitting atoms and bouncing off, before eventually making its way through the material. This bouncing would cause the light to take a longer path than it would in a vacuum, where it has no atoms to bounce off. That seems to make sense—and wrong ideas often do make some sort of logical sense. But in science, things are wrong because they don't agree with experimental data.

In this case, a light beam entering glass would also spread out as it travels through the material, due to more "collisions." It would be just like a ball moving through a region with a bunch of pegs. Each random collision would send the ball off in a slightly different direction. Doing this for countless beams of light would mean that the light could end up moving in any number of directions. But in order to form an image, light beams have to move through the material in predictable ways and not randomly scatter. If the light had actually scattered, you would only see a diffuse glow, instead of being able to see an image.

OK, then why does light travel slower in glass? The first thing to understand is that light is an electromagnetic wave. It's a lot like a wave in the ocean, but so much cooler. An electromagnetic wave has both an oscillating electric field and an oscillating magnetic field, which are associated with the electric and magnetic force on an electric charge. An oscillating electric field creates a magnetic field, and an oscillating magnetic field makes an electric field, as described by Maxwell's equations. This interaction between the fields is what allows light to travel through empty space. (This doesn't happen with other waves. Just imagine having an ocean wave without water.)

When the oscillating electric field from a light wave interacts with atoms in a material like glass, it causes a disturbance in the atoms. This disturbance at the electron level means that those atoms also produce an electromagnetic wave. However, the electromagnetic wave from the atoms will be at a different frequency than that of the light that entered the glass. The combination of the original electromagnetic wave along with the wave from the excited atoms produces a new wave—one with a slower speed.

Speed of Light With Lidar

Now for a fun experiment: What happens if you use an iPhone’s lidar to look through a combination of glass and water? If the lidar determines distance based on the time it takes light to travel, shouldn't it give an incorrect distance when going through another material?

Let's try it out. I found this large container with glass walls about 1 centimeter thick. In the middle, I added some water to fill in the 7.4-cm-wide interior. When I put it up against a wall, it looked like this:

Photograph: Rhett Allain

But what happened when I scanned this with lidar? Here are two different views of the same scene:

Photograph: Rhett Allain

Of course, the wall is actually flat, but the lidar image shows an apparent indentation. That's because the light takes longer to go through the glass and water, so that the time of travel for the light is longer. Of course, the iPhone might be smart—but it's not that smart. It doesn't know that the light went through different materials at a different speed. It just calculates the distance with the speed of light in air, which, as we saw, is pretty much the same as the speed of light in a vacuum.

Let’s make a quick estimation: How much should the wall be indented in the scan?

We’ll start with the time it would take light to travel through the glass/water and then back again. Since the whole container—counting both sides of the glass and the water inside—has a width of 9.4 centimeters, the lidar assumes it would take light 62.7 nanoseconds to travel this distance in a vacuum. But the light has to go through a total of 4 cm of glass (remember, each side of the container is 1 cm, and the light goes through the whole thing twice, because it reflects back), which has an index of refraction equal to 1.52. And it goes through a total of 14.8 cm of water (again, because of the reflection), with an index of refraction equal to 1.33. So this takes an actual time of 85.9 nanoseconds.

That means that there is an extra travel time of 23.2 nanoseconds. During this time, light in a vacuum would travel 3 centimeters. That seems legit to me. While I'm not really an expert in 3D models, I could imagine that the wall indentation is about 3 centimeters.

Honestly, I'm sort of surprised that this experiment even works! But it does show two important things: Lidar determines distance by measuring the time it takes light to travel, and that light will slow down when going through something like glass or water.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK