A lock-in amplifier is an instrument to measure very small AC signals flooded with noise. A lock-in amplifier is able to clean up signals many times smaller than the noise, and measure their amplitude and phase.
To achieve that, it needs a clean reference signal that is synchronous with the small one we want to measure. The amplitude of the reference signal is irrelevant, same for the phase, just that the reference signal must be synchronous and clean.
The typical arrangement is like this: A generator of clean signal is feeding both the device under test and the reference input, while the small signal flooded in noise (that gets out from the device under test) is fed to the measuring input of the lock-in amplifier. At the output we will get the phase and the amplitude of the small signal.
The trick to achieve this is that the lock-in amplifier averages many periods of the signal, so the noise will average to zero. The signal of interest will average to zero, too, except that the averaging is made synchronous with the small signal of interest (that is why it needs a clean synchronous reference signal). As a result, the noise averages to zero, while the signal of interest averages to itself (stays the same).
Thus, all the noise is removed while the small signal of interest remains, because the small signal was synchronous with the averaging process.
Usually this functionality is implemented with analog multipliers followed by integrator circuits, sometimes by simply switching the polarity (multiply with +1/-1) followed by integrator, sometimes is made purely digital by DSP.
We will implement a lock-in amplifier with an oscilloscope, by synchronizing the oscilloscope on the clean Vref (Ch2), while feeding the small noisy signal to Channel 1, then setting the acquisition mode on Average (between consecutive traces), on DS1054Z by pressing Acquire -> Mode -> Average.
The multiplication here is made with 0/1 (by the triggering circuit) and the integration is made by the trace averaging mode (also there is no need to get the quadrature reference signal, since the multiplication and averaging happens for each and every ADC sample, including t=0, or t=pi/2, or any other point on the trace).
As a bonus, this kind of lock-in amplifier not only gives the amplitude and phase, but also shows the waveform of the small signal, which might be a big advantage, and also can work at much higher frequencies. As a drawback, an oscilloscope might not have such a big dynamic range as a dedicated lock-in amplifier.
As an application of this technique, let's measure the contact resistance of some random banana plugs.
We set a 50
DDS generator to output 10Vpp at 1.3kHz and measure the voltage drop on the contact resistance. The red and black alligator clips are coming from the generator, the probe is going to channel 1 of the oscilloscope. There is another cable not shown in the picture, cable going from the generator straight to the oscilloscope for synchronization.
The voltage drop on the banana plug is in the mV range, and the signal is very noisy. This is the signal without averaging and synchronizing:
Same signal synchronized:
And finally, the same signal locked and averaged for 1024 traces. Notice how all the noise has gone, and the oscilloscope can measure the Vpp without any problems:
All the noise has vanished because by synchronous averaging, the signal to noise ratio improves by \$\sqrt{N}\$ times, where \$N\$ is the number of averaged traces (here 1024).
In case you wonder what was the contact resistance for those bananas, not very good, in the ballpark of 25m\$\Omega\$: