How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The...

33
6.1 How does the iPhone know where you are and what you’re doing? Answer: MODULE 6: Use of the global positioning system in the iPhone The global positioning system Pseudo-random codes Applications of GPS Accelerometers and gyroscopes Capacitance

Transcript of How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The...

Page 1: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.1

How does the iPhone know where you are and what you’re

doing?

Answer:

MODULE 6: Use of the global positioning system in the iPhone

The global positioning system

Pseudo-random codes

Applications of GPS

Accelerometers and gyroscopes

Capacitance

Page 2: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.2

GPS

The Global Positioning System

Completed in 1995, at cost of $12B, the GPS is a system of 24

satellites plus spares and the supporting infrastructure.

Purpose: to determine the precise location of a portable receiver

(latitude, longitude, altitude) anywhere on earth.

Satellite constellation: 6 orbits, 20,200 km up (12,600 miles),

about 12 hour orbital period, seven year lifetime (oops!)

Page 3: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.3

Developed and operated by DoD.

o Submarine launch of ICBM's to hit missile silos

o Need precise location at launch (and subs move!)

o Several other applications emerged later…

Accuracy Possible:

o "standard" GPS – using only satellites, tens of meters

(Assisted GPS or A-GPS is when a phone like the

iPhone is assisted by the cellular network with satellite

information; the iPhone gets an accuracy of about 8m)

o "differential" GPS – uses ground stations in addition, 1-2

meters (Decommissioned in March 2018)

o cm accuracy possible with advanced receivers

o Until Pres. Bill Clinton changed the policy in May 2000, the

US military added noise to give civilians only 100m

accuracy

The government does not degrade civilian accuracy any

more.

Page 4: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.4

Augmented GPS accuracy Source: FAA GPS Performance Analysis Report January 31, 2017

Page 5: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.5

Requirements

o Accuracy

100m tells you that you're somewhere on a football

field, doesn't help in landing planes. If you miss the

ground by 100m, it’s called a …

1m accuracy tells you the yard marker you're standing

on in the football field. Many applications require <

10m accuracy. Ex: marking a well or a tree to be cut

down.

o Cheap, lightweight Receivers

Cannot have atomic clock in the receiver (costs more

than $20K) but the receiver needs precise timing…

more on this later.

Electronics cannot be too expensive – cannot afford low

noise components.

Can't tote around a huge antenna.

Page 6: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.6

How it Works

Basic idea: trilateration (5 s = 1 mile away)

Satellite sends signal out, receiver determines distance (e.g., 11,000

miles)

Time of Arrival Ranging Principle

Speed of light ~ 300,000 km/sSpeed of sound ~ 0.33 km/s

distance = velocity * time

Page 7: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.7

If three satellites put your location at one of two points, one of

which is off the surface of the earth, why use four?

It's not to eliminate the other "point," it's for time correction.

More later.

Page 8: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.8

Distances here are determined by a microwave signal (an EM

wave) that travels at c = 3x108 m/s.

Thus, travel times are very short (if directly overhead, it's about

70 microseconds).

Suppose that the timing is off by one microsecond.

o Error in Range = d = vt = 3x108 x 10-6 = 300 m

How is propagation time determined?

Each of the 24 satellites has a unique code. The code is

transmitted repeatedly.

* Take three satellites, ST1, ST2, ST3

Each satellite broadcasts message continuously. Each receiver

knows to listen for each code.

Suppose that the receiver has contact with ST3 – the received

signal (*ST3A) is very noisy

The receiver can "clean" the signal by filtering and compare it to

an internally stored version to identify the satellite. (*ST3B)

But the internal code and the received signal are offset, and the

offset gives the time offset – which gives the distance!

Page 9: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.9

So, the receiver just needs to "slide" its internal code until we

have a match (*ST3B, C, D, E)

The amount of "slide", when the two signals are correlated, gives

the distance to the satellite.

The satellite actually do not send clips from geeky TV programs,

they send a pseudo-random code.

Pseudo-Random Code

Satellite Signal

Signal Generated by Receiver

Delay Time Proportional to Range

Page 10: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.10

PRC: Pseudo-Random Code

We’ve already seen several coding schemes connected with the

iPhone.

This code is a string of 1024 one and zeros.

Not random at all. Each satellite has its own code, carefully

chosen.

Each of the 24 PRC's are orthogonal (like x, y, z vectors).

Each has equal number of ones and zeros (512 and 512). Why?

So, the receiver knows the PRC's of each satellite.

It needs to compare the noisy, weak signal received with the

internally stored PRC.

First the incoming signal must be "chipped" – sampled at discrete

periods of time:

Stored PRC Received PRC

Delay = Propagation time = 3

Page 11: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.11

In the real world, we receive a noisy signal and other satellites.

Stored PRC Received PRC

Delay = ?

Shift and count matches – mismatches for signal duration:

Shift = 0 Shift = 3

Shift = 5 Shift = 7

Shift 5 matches best. Delay = Propagation time = 5.

Page 12: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.12

After performing the +1/-1 equality operation for each "bit", we

add up the scores.

Pure noise at the input would give a score of 0, since 1's and 0's

are equally likely.

If the signal matches, even with a weak signal, the sum will be

positive.

So, the receiver shifts the internally stored code and tries to

match. This shifting and matching is called cross-correlation:

o The key to GPS.

o The reason we don't need a big antenna!

Received signal used both for timing and data:

Page 13: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.13

Timing

Recall that the signal propagation time from the satellite to the

receiver is determined by "sliding" the internally stored PRC until

it matches the incoming PRC.

The amount of sliding gives the distance:

o d = c t

Ex: At 12:01:04.320 the satellite broadcasts a signal, which says "It

is now 12:01:04.320."

The signal then travels 24,000 km to a receiver.

It takes t = d/c = 24,000,000/3x108 = .08 seconds.

The receiver receives at 12:01:04.400.

The difference is the propagation time.

Satellite and receiver must be synchronized.

Good news: each satellite has four atomic clocks that are

periodically synchronized.

Bad news: the receiver has a quartz Timex. (The iPhone clock,

even with updates from carrier, may be too inaccurate for GPS.)

Solution: Use a fourth satellite.

Page 14: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.14

Idea: If the receiver clock has drifted, all of the four satellites will

have the same error.

One-dimensional example:

Suppose we are at position 𝑥, which is somewhere between position

𝑠0 = 0 and position 𝑠1 = 1.

Suppose signal is sent at time 0 from 𝑠0 and received at time Δ𝑡0.

Then

𝑥 = 𝑐 Δ𝑡0

If our watch is 𝜖 seconds fast, then

𝑥 = 𝑐(Δ𝑡0 − 𝜖).

If we don’t know what 𝜖 is, we can’t find 𝑥. But, if we have another

transmitter at 𝑠1 = 1, then:

𝑥 = 𝑐 (Δ𝑡0 − 𝜖)

1 − 𝑥 = 𝑐 (Δ𝑡1 − 𝜖)

Which we can solve

𝑥 =1 + 𝑐(Δ𝑡0 − Δ𝑡1)

2,

𝜖 =𝑐(Δ𝑡0 + Δ𝑡1) − 1

2

Not only found location, but also can make our watch accurate!

Page 15: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.15

Two-dimensional case:

Satellites A and B transmit signals that are received at position X.

The signals take 4 s and 6 s to propagate.

Page 16: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.16

But the clock in the receiver is running 1 s too fast, so it thinks the

times are 5 s and 7 s respectively.

Using the 5 s and 7 s times, the position is (incorrectly)

determined to be XX…

Page 17: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.17

Suppose that a third satellite signal, C, which is 8 s away, is used.

The receiver believes that C is 9 s away.

Combining range information from A & C and B & C results in

two different receiver locations that are different from XX.

Page 18: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.18

The receiver can now adjust its time, say by ¾ s, to see if the

positions calculated agree. This process is repeated until the

correct disparity in time (l s in this case) is attempted.

The receiver adjusts its clock and is sync'd with the satellites.

Now the GPS receiver is a portable, low cost clock with near

atomic accuracy!

To extend to 3-D, we just need 4 satellites instead of 3.

Now the receiver knows how far it is from the 3 or 4 satellites. To

find the receiver location, we need to know where the satellites

are positioned with respect to the earth.

The satellites are in orbit, moving at 3.9 km/s (about 22,500 mph)

Page 19: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.19

Concerns

High orbit so drag is minimal

iPhone receivers know ephemeris (position of sat. for a given

time)

But, there are departures from ideal orbits, because…

o Earth is not a precise sphere, as assumed in ephemeris

calculation (who founded this theory?)

o The earth has a nonuniform density and therefore a

nonuniform gravitational force through the satellite orbit

o Other planets, the moon and the sun exert forces on the

satellites

o Radiation pressure from sunlight changes the orbit and is

difficult to predict (changes with reflectivity of satellite)

Page 20: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.20

Each of these "headaches" results in ephemeris error.

So, these errors are corrected by giving feedback from known

ground positions.

Corrections to the satellites are uploaded and rebroadcast to the

receivers.

Updates are made hourly.

Atmospheric errors (from highly charged ionosphere and the

troposphere with water vapor content) can be corrected by using

signals with two different frequencies. What is frequency?

GPS broadcasts at two frequencies: 1.57GHz and 1.23GHz

Atmospheric Errors

Page 21: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.21

Multipath Error

What if you get a reflected signal?

The direct and indirect paths will produce different timing offsets

and thus different distances!

Solution: Use signal processing techniques to determine earliest

signal (direct path). Same idea as eliminating "ghosting" on the

TV.

Multipath Error

Page 22: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.22

GDOP: Geometric Dilution of Precision

Range Error (what we've been talking about) is not Position Error

(what we care about).

Rule of Thumb: GDOP = 1.5 to 2

So Position Error ≈ 2 x Range Error

Geometric Dilution of Precision (GDOP)

Page 23: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.23

Applications of GPS

Location

o Emergency services

o Everest is moving 6cm per year (but not getting any higher)!

Navigation

o Evacuation

o Aircraft (landing systems, optimal course)

o Cars (drive in Paris or Tokyo like a native)

o Marine (find favorite fishing hole, find international fishing

boundary, find lobster trap, navigate to Havana)

o Ignorance (walk around UVA with your nose pressed to the

iPhone screen)

Tracking

o Where's my fedex package?

o Where is the parolee?

o Where's my kid?

o Where's my stolen car?

o Where’s my iPhone?

Page 24: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.24

Mapping

o More complete and accurate maps

o Digital databases: What's GIS?

How fast am I going and what’s the speed limit?

Timing

o Accurate portable clock

o Useful for reference – Ex: synchronize packets for streaming

video.

Earthquake research – is the earth's crust moving?

Page 25: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.25

Construction: faster and cheaper than traditional surveying

How do I get around this museum? And where is the Hope

Diamond? (It’s in DC dummy; you might find the “star of India” in

NYC though…)

Page 26: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.26

Precision Farming: GPS on tractors knows where to fertilize

(according to crop yield), where to apply pesticides, where to

irrigate

Crop Yield Determined Using GPS

Page 27: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.27

Autopilot for your favorite UAV…

BTW, these researchers “spoofed” GPS of a drone at White Sands

NM by sending “fake” radio signals that made the drone think it was

hovering at 60 feet when it was really landing (and then hijacked).

Page 28: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.28

Summary Statement

The GPS system is an excellent example of how information is

coded, modulated, transmitted, received, decoded, converted to

usable form and applied.

The communication process has many error sources. As

engineers, we can compensate for some of these errors.

GPS lets the iPhone know where it is.

But how does the iPhone know if you’re sleeping well?

Page 29: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.29

Accelerometers and Gyroscopes

Gyroscope: uses gravity to determine orientation

Accelerometer: measures non-gravitational acceleration

In the iPhone: these terms are used interchangeably as the

accelerometer can function as a gyroscope.

Page 30: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.30

Mechanical Accelerometer

Here’s the idea: think of yourself as the passenger in my ’68

Corvette. I accelerate. You feel a force (your back moving

backward to back of seat). This is your internal accelerometer

telling you that I’m accelerating.

With the spring, the distance the mass moves above is

proportional to the force.

And the distance is proportional to the acceleration.

o Hooke’s law: F= kx (k = stiffness of spring in N/m)

o Combine with Newton’s second law of motion: F=ma and

you understand the theory of the accelerometer.

o If you can measure acceleration, you can measure velocity

(by integrating acceleration).

o If you can measure velocity, then you can measure position

(displacement) by integrating velocity.

Page 31: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.31

Old lab-based accelerometers used to measure the distance x with

a pen attached to the weight – but this won’t work for the iPhone!

Capacitive Accelerometer

The moving mass alters the distance between two metal plates.

This distance changes the capacitance (more shortly).

Measuring the change in their capacitance gives a measurement

of the force. (And given the mass, we then know the

acceleration.)

Page 32: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.32

Capacitance

But what is capacitance? (For us non-EE, non-physics, non-TJ

types)

Capacitance quantifies the ability to store a charge

Consider a charge storing device made of two parallel plates

(called a capacitor): (A is area, d is distance between plates,

is permittivity)

Capacitance is measured in Farads (F), where a storage device

of 1 farad, when charged with 1 coulomb, has a 1 volt potential

between the plates. C = q/V

In the above we notice that changes in C are inversely

proportional to changes in d. This is how the iPhone measures

measures acceleration (in multiple directions, e.g. 6 directions)

by way of the theory on the preceding pages.

We need capacitance to understand the screen and the

fingerprint scanner in the iPhone. More soon.

Page 33: How does the iPhone know where you are and what you’reffh8x/d/soi18F/Module06.pdf · 6.2 GPS The Global Positioning System Completed in 1995, at cost of $12B, the GPS is a system

6.33

Now, on to Module 7! Keeping your stuff secret on the iPhone.