## Friday, January 21, 2011

### EEeeeaaaaooooow (Doppler Effect)

I'm uploading a funkily-dimensioned video. It makes me feel pretty bad in terms of fidelity/efficiency. It's a screen capture of my laptop webcam and a wx/Chaco/python application displaying the input from the soundcard. I'll try to do this better next time (by actually using a video compositing program).

So the video depicts the radar detecting the speed of my hand. Maybe it's time for me to describe this system a bit more. The system operates between 2.315-2.536 GHz (that's the nominal spec. on the VCO, a Mini-Circuits ZX95-2536C-S+). The signal being transmitted and the signal being received are multiplied together ("frequency mixed"). Multiplying two sinusoids together produces two different sinusoids: one with frequency equal to the sum and one with frequency equal to the difference of the original sinusoids being multiplied. I think the easiest way to convince yourself is with complex exponentials. But then you have to convince yourself that complex exponentials work. And probably the best way to do that is with Taylor serie--somuchmathscaffolding. Also a digression.

Right. So the frequency corresponding to the sum is somewhere in 5Ghz range and I'm not going to do anything with that. Maybe it dies thanks to the parasitic capacitance on one rail of the breadboard, but it definitely dies by after the first stage of the op-amp MAX414, which is rated at 28MHz. The frequency equal to the difference contains neat information in an easy-to-process form. It contains the amount of Doppler shift!

Doppler shift occurs when some source of waves (a reflector or a transmitter) is moving relative to the point where the waves are observed (the receiver). You might imagine that if the wave source moves at the speed at which waves propagate, then all the wavefronts get smashed together and maybe the wavelength goes to zero and sonic boom. I don't know how valid this is. I'm just the software guy?

Anyway, things are moving pretty slowly relative to the speed of light so it should be okay to use the non-relativistic Doppler formulation. For a source moving toward/away from a receiver at 1 m/s transmitting at 2.4 GHz at a speed c=3*10^9, the received signal is 2.4GHz +/- 8 Hz. So the difference is 8Hz and this is the frequency measured at the output of the frequency mixer.The frequency difference scales linearly with the speed, so a speed of 10m/s, the difference would be 80Hz. My intuition says that there is a factor of two involved when measuring the speed of a reflector, but I need to check this.

As an exercise to determine how feasible it is to use LaTeX markup in blogger (answer: not very?) I wanted to convince you that multiplying to signals together produces the sum and difference in frequency:

$\begin{eqnarray*} \cos\left(\omega_{1}t\right)\cdot\cos\left(\omega_{2}t\right) & = & \frac{1}{2}\left(e^{it\omega_{1}}+e^{-it\omega_{1}}\right)\cdot\frac{1}{2}\left(e^{it\omega_{2}}+e^{-it\omega_{2}}\right)\\ & = & \frac{1}{4}\left(e^{it\left(\omega_{1}+\omega_{2}\right)}+e^{-it\left(\omega_{1}+\omega_{2}\right)}+e^{it\left(\omega_{1}-\omega_{2}\right)}+e^{-it\left(\omega_{1}-\omega_{2}\right)}\right)\\ & = & \frac{1}{2}\left(\cos\left(\left(\omega_{1}+\omega_{2}\right)t\right)+\cos\left(\left(\omega_{1}-\omega_{2}\right)t\right)\right)\end{eqnarray*}$

Notice that if there were a phase shift (in order to generalize the above) it would just appear as a complex amplitude in front of each exponential but the sum/difference of frequencies would still hold.

This should make it more evident that this circuit cannot tell whether an object is moving toward or away from the receiver, but only the speed of the object.

The amplitude of the output from the mixer depends on how strong the reflection is. When the reflector (my hand) is closer to the cantennae (j.k. : cantennas) the signal is stronger. To emphasize: the frequency of the output of the frequency mixer is proportional to the speed of the reflector.

More on the code that generated the plots: I've enjoyed using Python for "scientific computing". It uses the NumPy and SciPy matrix/math libraries and PyAudio (bindings for PortAudio) to capture. The plots are being done with Chaco ( by Enthought) with a wx backend. The code is heavily based on an example by Enthought. All these software projects are open source, so that's pretty nice.