# Measuring Distance using Phase Shift

I'm trying to make a pair of devices which can measure their distance from each other (within 50 ft., irrespective of orientation). The basics of a robust solution are described in this comment, but I don't know what components are needed to realize it. Solution paraphrased below:

The master device emits a radio signal at $f$ Hz. The slave device detects the master's signal and produces an $f$ Hz signal which is phase-locked with it. The master determines the phase shift $\phi$ between its own signal and the slave's signal to determine the distance of the slave.

Since the total phase shift $\phi$ depends on the round-trip time, the distance between master and host can be computed, so long as the phase shift is less than $2\pi$within 50 ft. $$D = \frac{C}{4 \pi f}\phi$$

It seems $f$ = 10 MHz would be the best frequency since the half-wavelength is ~50 ft.

How does one realize the signal transmission, detection, phase-locking, and phase shift computation. I'm good with embedded systems, but know very little about producing or detecting radio signals. I assume there will be VCOs, PLLs, amplifiers, and antennas.

Also how can the master distinguish between its own signal and the slave's return signal, when determining the phase shift?

• 1. Rather than re-transmit a phase-locked signal at the slave, why not just put a reflector on the slave? The rest of the question then comes down to "How do I make a radar?". 2. "How do I make a radar?" is too big a question to expect an answer from this site. Oct 29, 2013 at 16:15
• Well, its been explained that distinguishing between the transmitted and returned signal is difficult if they are at the same carrier frequency. Also isn't radar sort of directional? I need the orientation between the two devices to not matter, only distance. Oct 29, 2013 at 19:34

Well, the last question you ask is what really makes this sort of problem difficult. If the returning signal is at the same frequency as the transmitted signal, it is extremely difficult to separate the two. However, if you're going to have a transponder on the other end, then you can have a little fun. Instead of transmitting and receiving at 10 MHz, what you need to do is transmit and receive on two different, higher frequencies, both modulated at 10 MHz. Say you choose the 2.4 GHz ISM band. That's probably a good idea because the antennas are small and there are lots of RFICs available that will work in that range. With a 10 MHz AM modulation, you need 20 MHz of bandwidth (double side bands). You probably want to transmit on 2.42 and 2.48 GHz as the ISM band is only 2.4 to 2.5 GHz. This will cover approximately 2.41 to 2.43 and 2.47 to 2.49 GHz. This leaves a good amount of separation in between. The transmitter is simple: just generate a 2.42 GHz sinewave and gate it at 10 MHz. The receiver is just a simple AM receiver, but first you need to isolate the transmit frequency. Mix it down with an LO of 2.42 GHz and bandpass around 10 MHz with a reasonably narrow bandwidth. You will likely need an AGC at some point along the way. After the mixer and bandpass filter, you may be able to get away with a limiting amp. Anyway, at this point you run your signal through an 10 MHz PLL and then use the output of that to gate a 2.48 GHz oscillator. It would be a good idea to turn off the transmit side if no signal is being received to save power, this can be done with a peak detector and comparator. Back on the original transmit side, you do the same down conversion again, and then compare the phase of the transmitted and received signals. This will give a partial estimate of the range. You will likely need to transmit a couple of different modulation frequencies to get a better estimate of the range as phase shifts are periodic. Perhaps gating the 10 MHz at 1 MHz or even 100 KHz.

This sort of a solution may be quite sensitive to interference due to other devices transmitting in the 2.4 GHz band. Also, CW detection like this is not very power efficient, nor does it lend itself to more than one system being in operation in the same physical location. A better idea might be to built it like the FAA builds their radars - ping a transponder. Basically, it's the same idea - transmit on one frequency, receive on another, but you measure the time of flight instead of the phase. You can also use higher transmit power on a shorter duty cycle for more range. It would also support multiple users with unique codes, and the transponders can be set up to reply only if they receive the proper code. The transmitter and receiver in this case would be mostly digitial, an implementation could use FPGAs to generate and receive the coded pings and measure the time delay.

• Thanks! To be clear, will the 10 MHz modulation of the higher-freq signal still experience a shift in phase proportional to the propagation time / distance? Signals stuff is a bit beyond me, haha. Oct 29, 2013 at 6:57
• Absolutely. The phase shift due to the travel time will affect all components of the signal. Now, you're going to have to calibrate it to figure out what the phase shift is at zero distance because the transmitter and receiver will both add phase shift. However, that phase shift should be constant. Oct 29, 2013 at 7:17
• Okay thank you so much! I will look into this in detail tomorrow, it's getting very late here in Eastern standard time. Oct 29, 2013 at 7:24
• You can possibly simplify the receiver with a 2.48GHz LO giving a 60MHz IF. The same oscillator is coupled to a power stage, gated on/off, to generate the return signal. Oct 29, 2013 at 10:03
• You could do that, but you're going to be picking up a lot of crap in the 2.4 GHz band from wifi and what not, so you may get better performance by regenerating the low frequency signal. Oct 29, 2013 at 14:50

One thing to consider would be to generate a chirp signal on the TR side (a signal that is linearly increasing in frequency). On the other end you can use a re-transmitter. Back on the TR side you mix the receive signal with your original chirp. The greater the beat frequency (the difference in frequency), the greater the distance. Alternatively, instead of a chirp you can generate a CW signal, split it into 2 parts (Rf and LO). Then use a fast solid state switch to gate the RF and generate a pulse. Use the same type of a switch to switch between Tx and Rx. Mix the RF with the LO and the calculate the time of flight. The advantage of this method is that you don't have to generate a chirp. The disadvantage is that there is a minimum separation that you can measure (determined by how fast these switches are ~15 ns). Another disadvantage is that you need a low dispersion antenna to transmit the pulses (e.g. ridged horn, spiral, etc vs dipole, log periodic)

It might be a lot easier to use received signal strength (RSS) and return this value digitally (via a different rf uplink) to the master. In a perfect environment with no obstacles this method will work just as well as trying to measure the time difference. In an imperfect environment with reflections and multipaths both will be subject to errors.

I'm pushing the RSS route because it will be far easier to construct; the receiver will only need to measure the amplitude of the carrier (modulated or not) to determine distance from the transmitter. Once measured (by a simple ADC probably built into an MCU) it can transmit this back as a value to the transmitter.

Levels of sophistication depend on the radios at each end but to overcome the effects of multipaths, several different frequencies can be used and the results tabulated and returned to the transmitter. I'm not going to go into the details of how different frequencies can help avoid eroneous RSS levels because it can be deep.

My money would be on using RSS at several different frequencies in the 2.45GHz range - measure RSS at each and compute best guess at distance between the two objects.

• Thanks for the thoughts. The final solution will certainly use a combination of both RSSI and the phase shift methods averaged over multiple carrier freqs. Oct 29, 2013 at 19:22