Q-Control Example VI Tutorial

Using a Zurich Instruments lock-in amplifier, you are enabled to measure the quality factor of an arbitrary resonator – typically a resonant beam used in non-contact atomic force microscopy (NC-AFM) applications. This can be useful e.g. to increase phase sensitivity in a PLL setup or to increase the characteristic frequency of a cantilever to enable faster responses.

Hardware Requirements

Software Requirements

  • National Instruments LabVIEW
  • The Zurich Instruments Q-Control Example VI which can be found in the Zurich Instruments LabVIEW API’s example folder

Q-control principle

Q-control modifies the Q factor of a resonator by providing a feedback signal that compensates for losses that occur during an oscillating cycle – therefore increasing the decay time of an oscillation – or by introducing losses – therefore reducing the decay time of the oscillation.

Providing a feedback signal can be accomplished by a variable gain stage and a phase shifter used to compensate phase shifts caused by the system (typically but not necessarily 90 degrees at resonance). As there is no direct feed through from the Hf2LI’s HF inputs to the HF outputs, the input signal is first down-converted to the base band, amplified, and then up-converted again to drive the HF outputs. The following schematic depicts this procedure.

Q-control functional diagram

To copy an input signal to the outputs, a quadrature demodulation is done to acquire the sine and cosine amplitudes. This amplitude information is then forwarded to drive a sine and cosine output signal line which are added to result in a sine that is phase shifted by the same amount as the input signal. Now, if the demodulator used for the quadrature detection is provided with a reference signal that is phase shifted to some extent, the total shift can be balanced in a way to achieve either positive (0°) or negative (180°) feedback in the loop.

Step 1: Performing a reference sweep

To find out about relevant parameters of the resonator, a prospecting sweep has to be performed as a first step. Parameters that can be obtained in this way are the resonance frequency f0 (which is later used as the center or carrier frequency for Q-Control), the phase shift at resonance Δφ and the gain margin 1/Asys (ratio between drive voltage and input amplitude at resonance). Remember that the total loop gain in case of positive feedback has to be A = Asys*Aqc< 1 to keep the feedback loop stable.

  • Connect your resonator to one of the HF inputs and select the Q-Control channel accordingly
  • Enter the estimated center frequency of the resonator to the center frequency input field and specify a Q-Control bandwidth that covers the resonance peak
  • Set the drive voltage to a level that does not destroy the resonator
  • Start the reference sweep by clicking the sweep button

A 1.84 MHz quartz resonator is used in this example.
Settings for Step 1

Sweep for Step 1

Step 2: Refining the resonance sweep

Refine the prospecting sweep to get more accurate parameters for Q-Control. This is particularly important if you are aiming for a high Q factor. An inaccurate prospecting sweep could lead to instabilities due to wrong parameter assumptions in the modelling. Keep in mind that – depending on the measurement setup – the resonator might change properties. An increase of the resonance peak amplitude over time might lead to a loop gain A of >1 and result in instabilities as well.

  • Click the auto center button
  • Reduce the Q-Control bandwidth so that the resonance peak fills the sweep window. Dont reduce it too much if you want to lower the Q factor.
  • Make sure the sweep bandwidth is smaller than the characteristic frequency fc=f0/2Q of the resonator
  • Do another prospecting sweep

Settings for Step 2

Sweep for Step 2

Step 3: Setting up the feedback loop

The easiest way to set up the feedback parameters for Q-Control is to use the Q-Enhancement slider. Using the slider, the feedback gain and feedback phase are set according to the resulting phase shift and gain margin of the prospecting sweep.

  • Move the Q-Enhancement slider to a value of your desire
  • Enable Q-Control

Alternatively you can setup these parameters manually by going to the Advanced Settings tab. Disable Auto Phase and Auto Gain and mind the stability warning and ADC-Over indicator.

  • Set feedback gain
  • Set feedback phase shift
  • Enable Q-Control

Step 4: Make sure you get what you expect

By performing another sweep and looking at the sweep window, you can compare the native frequency sweep to the frequency sweep with Q-Control turned on. The resulting Q-factors can be read directly. Q is calculated using the point of steepest slope: Δφ/df=2Q/fc.

Q-Control Example VI Screenshot

Step 5: Do your measurements

After setting up Q-Control using the described LabVIEW VI, turn Q-Control on and off as you like. Make sure, you don’t change any settings relevant to Q-Control. If you are controlling channel one, don’t modify demodulators 1-3. E.g. if you are using channel 2, don’t modify demodulators 4-6.


To achieve self-excitation, all you need to do is driving the feedback gain to a level that leads to a (positive) loop gain A>1. Just increase Q by a factor of say 10 and then go to the “Advanced Settings” tab and manually move the feedback gain slider a bit further up. The system will start resonating at its resonance frequency with an amplitude that is best set by restricting the HF input range. You can read the resonance frequency by locking to the input signal using one of the reference acquisition PLLs.
Note that the frequency that is read in this way in the following screenshot differs from the frequencies that were manually set (such as the Q-control center frequency)

Q-Control: Self Excitation

ziControl: Self Excitation


  • If you are working on resonators that exhibit a non ideal resonance curve, i.e. the resonance is heavily influenced by its environment so that the point of highest phase slope does not correlate with the resonance point, you need to manually tune the feedback phase and gain as the model assumption for the automatic tuning is incorrect in this case.
  • The Q-control bandwidth has an influence on the loop phase transfer function. This does not become visual when Q is increased, but if Q is decreased, negative feedback will only properly be provided exactly at the resonance frequency. At frequencies other than this, a relevant phase shift of the feedback can lead to transfer peaks at either side of the resonance making it look like a camel back.


  • Change the sliders’ min and max values by double clicking them in order to change their range. This helps e.g. for manually fine tuning the feedback gain.
  • Sweeps can be exported to e.g. excel directly by right-clicking the graph. This also applies to all graphs available in ziControl.


I’d like to acknowledge the contributions of Dragan Lesic (Q-control block diagram) and Daniel Wright (PID controller support) as well as Kei Kobayashi and Tino Wagner (field testing).