TL;DR: A lock-in amplifier is just a homodyne where one uses the DC output. Would have saved me personally some time to get it explained with
this simple sentence.
The following article is a short (overview, not in depth) summary about the topic of Lock-In amplifiers
as often used in physics. Iāve written this down since I only discovered that a lock-in amplifier is
basically the same as an homodyne when I had the chance to work with such a device after having had
some more experience with heterodyne receivers, modulators, demodulators and detectors. To narrow down
to the topic it also takes a look at the heterodyne receiver (for up- and downconverison), the
superheterodyne and the homodyne which are commonly used in RF communication equipment as of today.
All are based on the same concept - mixing of two different periodic RF signal. So letās first look
into the optimal mixing behavior.
Optimal mixing behavior
This is just a quick reminder of what a mixer really does and some basic math behind multiplication
of trigonometric functions.
Letās assume oneās simply multiplying to sine functions:
[
\begin{aligned}
f_1(t) &= \sin(\omega_1 t) \\
f_2(t) &= \sin(\omega_2 t)
\end{aligned}
]
Using the Euler identities
[
\begin{aligned}
\sin(\omega t) &= \frac{1}{2i} (e^{i \omega t} - e^{-i \omega t}) \\
\cos(\omega t) &= \frac{1}{2} (e^{i \omega t} + e^{-i \omega t})
\end{aligned}
]
one can simply show how the product of $f_1(t)$ and $f_2(t)$ looks like:
[
\begin{aligned}
f_1(t) * f_2(t) &= \sin(\omega_1 t) * \sin(\omega_2 t) \\
&= (\frac{e^{i \omega_1 t} - e^{-i \omega_1 t}}{2i}) * (\frac{e^{i \omega_2 t} - e^{-i \omega_2 t}}{2i}) \\
&= -\frac{1}{4} ( e^{i(\omega_1 + \omega_2) t} - e^{i(\omega_1 - \omega_2) t} - e^{-i(\omega_1 - \omega_2) t} + e^{-i(\omega_1 + \omega_2) t}) \\
&= \frac{1}{4} ( (e^{i(\omega_1 + \omega_2) t} + e^{-i (\omega_1 + \omega_2) t} ) - (e^{i(\omega_1 - \omega_2) t} + e^{-i (\omega_1 - \omega_2) t} ) ) \\
&= \frac{1}{2} ( \cos((\omega_1 - \omega_2) t) - \cos((\omega_1 + \omega_2) t) )
\end{aligned}
]
The second interesting identity will arise when multiplying sine and cosine functions - the same trick using the Euler functions, multiplying all terms and rearranging will be used:
[
\begin{aligned}
\sin(\omega_1 t) * \cos(\omega_2 t) &= \frac{1}{2i} (e^{i \omega_1 t} - e^{-i \omega_1 t}) * \frac{1}{2} (e^{i \omega_2 t} + e^{-i \omega_2 t}) \\
&= \frac{1}{2} ( \sin((\omega_1 + \omega_2) t) + \sin((\omega_1 - \omega_2) t) )
\end{aligned}
]
Taking phases into account
Especially for the lock-in amplifier phases play a huge role. One can use exactly the same trick via Euler
identities to see the - unsurprisingly simple - behavior of phases during the mixing process:
[
\begin{aligned}
f_1(t) &= \sin(\omega_1 t + \phi_1) \\
f_2(t) &= \sin(\omega_2 t + \phi_2)
\end{aligned}
]
[
\begin{aligned}
f_1(t) * f_2(t) &= \sin(\omega_1 t + \phi_1) * \sin(\omega_2 t + \phi_2) \\
&= \frac{1}{4i^2} (e^{i \omega_1 t + i\phi_1} - e^{-i \omega_1 t - i \phi_1}) * (e^{i \omega_2 t + i \phi_2} - e^{-i \omega_2 t - i \phi_2}) \\
&= - \frac{1}{4} (e^{i ((\omega_1 + \omega_2) t + \phi_1 + \phi_2)} - e^{i((\omega_1 - \omega_2)t + \phi_1 - \phi_2)} - e^{-i((\omega_1 - \omega_2)t + \phi_1 - \phi_2)} + e^{-i((\omega_1 + \omega_2 t) + \phi_1 + \phi_2)}) \\
&= \frac{1}{2} ( \cos((\omega_1 - \omega_2)t + \phi_1 - \phi_2) - \cos((\omega_1 + \omega_2)t + \phi_1 + \phi_2)
\end{aligned}
]
Also doing the same to the sine-cosine multiplication:
[
\begin{aligned}
f_1(t) &= \sin(\omega_1 t + \phi_1) \\
f_2(t) &= \cos(\omega_2 t + \phi_2)
\end{aligned}
]
yields
[
\begin{aligned}
f_1(t) * f_2(t) &= \sin(\omega_1 t + \phi_1) * \cos(\omega_2 t + \phi_2) \\
&= \frac{1}{4 i} (e^{i \omega_1 t + i \phi_1} - e^{-i \omega_1 t - i \phi_1}) (e^{i \omega_2 t + i \phi_2} + e^{- i \omega_2 t - i \phi_2}) \\
&= \frac{1}{4 i} (e^{i ((\omega_1 + \omega_2) t + \phi_1 + \phi_2} + e^{i((\omega_1 - \omega_2) t + \phi_1 - \phi_2)} - e^{-i((\omega_1 - \omega_2)t + \phi_1 - \phi_2)} - e^{-i((\omega_1 + \omega_2)t + \phi_1 + \phi_2)}) \\
&= \frac{1}{2} (\sin((\omega_1 + \omega_2)t + \phi_1 + \phi_2) + \sin((\omega_1 - \omega_2)t + \phi_1 - \phi_2))
\end{aligned}
]
Technical realization for electronics
In the optimal case signals are multiplied. This can be done using dual gate transistors or MosFETs as well as circuits such as Gilbert
cells. Gilbert cells operate balanced - their output amplitude is a precise algebraic product of itās two input signals. This is whatās found
in most scientific equipment. In many cases - such as radio receivers and telecommunication equipment - one can use much simpler mixing systems
based on any nonlinear device like a simple diode or a transistor - often itās even sufficient to just modulate using a rectangular wave. Itās
also possible to use simple OpAmp circuits based on diodes to multiply signals.
Heterodynes
So first letās look at heterodynes. The name heterodyne refers to two intermediate frequencies arising when multiplying an input signal - in the
first case of an heterodyne receiver itās assumed to be the received signal $f_{RF}$ - with a local oscillator $f_{LO}$. Usually one uses an antenna,
input bandpass filter that is usually also tuned and an pre-amplifier at high RF frequencies in front of the mixer that then performs the downconversion:

The input signal $f_{RF} = \sin(\omega_{RF} * t)$ is simply multiplied by the local oscillator (LO) signal $f_{LO} = \sin(\omega_{LO} * t)$. The two
intermediate signals $\cos((\omega_{RF} - \omega_{LO}) t)$ and $\cos((\omega_{RF} + \omega_{LO}) t)$ - which are called the heterodynes are then passed
through a bandpass filter. This filter is usually designed to reject one of the two heterodynes so only one passes at the intermediate
frequency $\omega_{RF} + \omega_{LO}$ or $\omega_{RF} - \omega_{LO}$
This technique is used very often in todayās telecommunication systems. For example satellite TV operates at frequencies up to around $10 GHz$. Those are not
directly processable by demodulators or direct analog to digital converters. Thus itās first reduced directly at the antenna at the low noise block
downconverter (LNB) to an intermediate frequency band. The intermediate frequency usually is in the range of $1.1 GHz$ to $2 GHz$. Thus local oscillator
frequencies in the ranges of $9.75 GHz$ (Astra 1KR) or $10.60 GHz$ (Astra 2A and Astra 2B) are used. For C band setups an LO of $5.150 GHz$ is used. Depending
on the mode for Ku bands the signal of $f_{RF} - f_{LO}$ or for C bands the $f_{LO} - f_{RF}$ heterodyne is selected by the filters afterwards. The
downconverted signals are then transmitted through standard $75\Omega$ coax cable (which is simply not possible with signals in the $10 GHz$ range) to the
receivers which then perform the remaining downconversion - usually again using a superheterodyne or homodyne - and demodulation stages.
The same process can be used for upconversion - in this case the intermediate signal is multiplied by the local oscillator. Then one does not use
the $f_{RF} - f_{LO}$ heterodyne but the $f_{RF} + f_{LO}$ one. Again a bandpass filter is used after the mixer to reject one of the heterodynes.
Note that one also has to take care of leakage when designing such receivers - the LO leakage is one of the common interference sources when running
such systems without proper termination - either on the LNB side or on the receiver side.
The superheterodyne
So what is the superheterodyne? This is a way to build the receiver for a fixed demodulation (intermediate) frequency while still supporting different
RF frequencies. This is pretty simple and similar to the above setup. The only difference being a tuneable local oscillator and in addition usually
tuneable input bandpass filter. This allows one to sweep different frequencies that are mapped to a single intermediate frequency thatās then decoded
by a demodulator after passing through a fixed frequency bandpass filter.
Homodynes
The next type of receiver or converter is a homodyne. The main difference to a heterodyne is that the local oscillator is set to the same frequency
as the carrier frequency of the original signal and then uses the output of the mixer directly instead of having to apply additional demodulation. One
could for example directly upconvert the amplitudes recorded by an microphone - and transmit them directly via an antenna. On the receiver side one just
had to multiply the received signal with the carrier frequency and can directly recover the amplitudes made hearable by a speaker. Such a setup is less
used for most telecommunication systems or radio since this makes stuff like automatic gain control on the intermediate side much harder. When one uses
an intermediate frequency one can just perform automatic control of the amplifiers gain till one receives always the same intermediate frequency
amplitude which makes life on the receiver and demodulator side much easier.
Homodynes are often used in physics - for example each interferometer can be described just as an homodyne that detects the phase of the manipulated
signal with an unmanipulated reference signal. The local oscillator is once transmitted to some device under test, a splitted part of the local
oscillator is simply bypassing the testing area. Then afterwards both signals - the reference as well as the influenced one - are combined in an optical
mixer. Homodynes are also often used in nuclear magnetic resonance equipment, time domain thermal reflectance systems and as of today even in
telecommunication equipment in the lower frequency range such as cellphones or SDR systems.
Usage of a homodyne in telecommunication is also often called direct conversion since no more demodulation is needed after the mixing step (or itās
only done on the digital side of the device - such as in an digital signal processor or an FPGA)
I/Q samples
One term one often hears when using downconversion systems - especially homodynes or direct conversion systems where one is directly converting the voltages
using analog to digital converters (ADCs) - is the notion of so called I/Q samples. Those are often not understand by beginners though being a pretty simple
concept. The main problem when using a setup directly as described above would be that:
- One would loose all phase information
- There is a phase relationship (demodulation local oscillator vs. modulation local oscillator shifted by 90 degrees) where one would not receive any signal
To counter that one usually does not multiply once with the local oscillator but in parallel with a 90 degree shifted local oscillator. Due to relation
of sine and cosine one can also imagine that:
[
\begin{aligned}
f_{LO,1} &= \sin(\omega_{LO}t + \phi_{LO}) \\
f_{LO,2} &= \sin(\omega_{LO}t + \phi_{LO} + \frac{\pi}{2}) \\
&= \cos(\omega_{LO}t + \phi_{LO})
\end{aligned}
]
Thus one multiplies once with the sine and once with the cosine to obtain the I and Q samples - which also gives the reason for the naming of the in phase (I)
and quadrature (Q) samples. The remaining downstream setup for both channels should be the same (filters, analog to digital conversion, etc.). This allows to extract
phase information as well as the real amplitude of the signal independent of the phase relation between the oscillators as will be later shown.

After having received the $I(t)$ and $Q(t)$ signal one can simply recover the amplitude and phase at a given time:
[
\begin{aligned}
R(t) &= \sqrt{I^2(t) + Q^2(t)} \\
\phi &= \arctan{\frac{Q(t)}{I(t)}}
\end{aligned}
]
Lock-in amplifiers
So why that much of writing about Heterodynes and Homodynes in the same context as lock-in amplifiers that are usually described as phase
sensitive detectors? Because they are simple homodynes:

In contrast to a normal homodyne the output of a lock-in amplifier is usually assumed to be a DC voltage. They usually add a low pass filter
as well as an integrator circuit after the downconversion - that way they add phase sensitive detection:
[
\begin{aligned}
f_{in} &= \sin(\omega_{in} t + \phi_{in}) \\
f_{lo} &= \sin(\omega_{ref} t + \phi_{ref})
\end{aligned}
]
Now one assumes that the local oscillator frequency $\omega_{ref}$ is the same as the carrier frequency $\omega_{in}$:
[
\begin{aligned}
\omega_{in} &= \omega_{ref} \\
f_{in} * f_{lo} &= \frac{1}{2} ( \cos(\underbrace{(\omega_{in} - \omega_{ref})t}_{0} + \phi_{in} - \phi_{ref}) - \cos((\omega_{in} + \omega_{ref})t + \phi_{in} + \phi_{ref})) \\
&= \frac{1}{2} (\cos(\phi_{in} - \phi_{ref}) - \cos((\underbrace{\omega_{in} + \omega_{ref}}_{2 \omega_{ref}})t + \phi_{in} + \phi_{ref}))
\end{aligned}
]
Applying a low pass filter that filters out the $2 * \omega_{ref}$ signal (ideally it would only pass DC) yields:
[
\begin{aligned}
X(t) &= \frac{1}{2} \cos(\underbrace{\phi_{in} - \phi_{ref}}_{\Delta \phi}) \\
X(t) &= \frac{1}{2} \cos(\Delta \phi)
\end{aligned}
]
In addition one again uses a 90 degree shifted second local oscillator:
[
\begin{aligned}
Y(t) &= \frac{1}{2} \cos(\Delta \phi - \frac{\pi}{2}) \\
\to Y(t) &= \frac{1}{2} \sin(\Delta \phi)
\end{aligned}
]
Now one usually recovers the amplitude and the phase of the detected signal:
[
\begin{aligned}
R &= \sqrt{X^2 + Y^2} \\
\Delta \phi &= \arctan{\frac{Y}{X}}
\end{aligned}
]
Another possible way to use such a measurement system is to maximize the desired signal in one of the channels (I/Q) in case the desired
signal and some parasitics are measured with different phases.
Why one sees the derivative when modulating and scanning the same dimension
When using lock-in amplifiers in physics one often sees the approximate derivative of a signal. This is the case
when scanning particle resonances, optical absorption curves (also when performing laser locking) or when measuring
for nuclear magnetic or electron spin resonances. Why is this the case? The idea is pretty simple - one does not measure
the resonance directly, one sees an approximation of the derivative in case the modulation is happening along the
same axis as the scanned quantity (for example for electron spin resonance or nuclear magnetic resonance while scanning
the magnetic fields or excitation frequencies while adding an offset modulation field or modulation frequency respectively)
or for example when modulating the current of a laser diode while also scanning itās current. When one looks at the following
graph the $x$ axis is the scanned quantity (magnetic field, current, collision energy, etc.). The point between $E_1$ and $E_2$
is the currently selected scanning position, the modulation of along the same quantity oscillates between $E_1$ and $E_2$ - in this
case assumed to be a sine wave. So one moves between the two points on the resonance curve (usually a Lorentzian in optics, particle
physics or NMR/EPR or a Gaussian model like in this graph). This leads to a modulation of the measured intensity one
sees on the $y$ axis.

When one looks closely the intensity oscillates along $\Delta I = I(E_2) - I(E_1)$ while the scanned energy or field oscillates
along $\Delta E = E_2 - E_1$. The lock-in amplifier only sees modulated intensity components and thus only sees $\Delta I$ after
the downconversion to DC, filtering and integration. Thus it basically sees $\frac{\Delta I}{\Delta E}$. This already reminds one
of the definition of a derivative:
[
\frac{\partial f}{\partial x} = \lim_{\Delta x \to 0} \frac{f(x + \Delta x) - f(x)}{\Delta x}
]
In this case one can see the approximation of the derivative of the signal with respect to the modulated quantity:
[
\frac{\partial I(E)}{\partial E} = \lim_{E_2 \to E_1} \frac{I(E_2) - I(E_1)}{E_2 - E_1}
]
Thus the received intensity seen by the homodyne approximates the derivative when the difference in modulation is small with
respect to the observed structure (for example modulating only a few Hz to kHz when measuring a MHz wide peak).
This article is tagged: Physics, Tutorial, Basics, How stuff works, Electronics, Measurement