Why is there a DC offset in my QA403 data? Why is RMS not computed correctly?

I set up my QA403, with N=32768 points, Max Input 0dBV, Fs=48,000Hz. My inputs are all connected to ground through 50Ohm resistors. The outputs are all open, but I think disabled by default.

One way to calculate RMS is RMS = sqrt(mean(x)^2 + std(x)^2).
The other normal way is RMS = sqrt(mean(x^2)).

When I read the raw time series data, and post process in python, I get the following:

left channel: mean = 0.0124372, std = 2.053e-6, rms = 0.0124372
right channel: mean = 0.0019536, std = 1.901e-6, rms = 0.0019536

When I select RMS Volts measurements in the QA403 Audio Analyzer software, I see the following RMS values:

left channel: rms = 1.4uV = 1.4e-6V
left channel: rms = 1.5uV = 1.5e-6V

Here is the plot I see, where it also shows this large DC hump …

Does anyone know why the RMS calculator is not working right in the Audio Analyzer?

More importantly does anyone know why I’m seeing any DC at all in an AC coupled system?

The datasheet shows the input coupling as being < 1Hz …

Hi @nathanbaltz,

When you select an RMS measurement, it is calculated in the frequency domain. That is, you specify a region of interest of 20-20 kHz (by right clicking on the RMS or THDN button) and then each frequency amplitude in that region is squared, summed, rooted, etc to arrive at the RMS value. So, if you’ve specified 20 to 20 kHz, then the DC value is ignored. However, as your display shows, there is what appears to be bit of DC bleed into the active spectrum area.

Let’s try this with the left channel inputs shorted:

  1. File->New Settings. This puts us to a known state, with a 4k FFT.
  2. Turn off right channel (see DISPLAY control group)
  3. Add “RMS dBV” and “Sys:FFT”
  4. Change displayed X axis from 2 Hz to 20 kHz (right click on XLOG button in AXIS control group)
  5. Set 0 dBV full scale input

The plot should look as follows:

Notice the RMS measurement is very high, and we can also see the low frequency bump extends to 40 Hz or so. So that bump is inside the 20-20 kHz measurement window used for the RMS calculation (which you can change by right clicking on RMS or THD or THD+N in MEASUREMENTS control group)…

Now, the default window is Flat Top. This is a broader windowing function. Switch to Hann.

That helped, and now the low frequency bump extends to 30 Hz or so. Note that our RMS measurement (20 to 20 kHz) bandwidth has dropped from -58.03 dBV to -116.94.

And now switch to a RECT window, and you should see the following:

The low frequency bump has dropped again. But this time, the improvement was below 20 Hz, and so it doesn’t show up in the RMS computation.

OK, now switch back to Flat Top and verify we get back to the big bump and the ~58 dBV RMS reading (dominated by the bump above 20 Hz):

Now, increase the FFT from 4K to 32K:

Note that even with FlatTop, the the larger FFT has dramatically reduced the width of the bump.

That should help explain how the RMS is calculated and how FFT size and window settings can impact your RMS measurements.

More importantly does anyone know why I’m seeing any DC at all in an AC coupled system?

The DC that you see happens AFTER the input caps. There is a buffer amp (OPA1612) that can have +/-500uV or so of offset, which is similar to the FDA that follows it. And finally, the ADC has offset. If you want to learn the overall offset present, you can use the Oscilloscope visualizer and see what it displays with the inputs shorted.

The unit on my desk shows about 2.5mV of offset:

If you want to null the offset, it can be done. You will first need to generate an ADC offset file. (See File->Generate ADC DC Offset file. That will go through each input gain setting (0, 6, 12…42 dBV) and measure the offset, and then place those values for the left and right channel into a file.

And then, you need to go into the Edit->Settings, and enable “Apply DC offset to Acquistions.” If you hover over the checkbox, it will tell you a bit more about the process.

Note the settings file is tied to the serial number of the QA403. So, if you have several, you will need to do for each since offset is different for every unit and temperature. Also the settings file is for a moment in time. Temperature, ageing, etc, can all impact offsets. And so, the process isn’t perfect, and what works well on a Monday will be different on a Tuesday.

Here’s the unit on my desk using an offset file from a while back. As you can see the offset is around 360uV, which is quite a bit better than the 2.5mV above. But still not zero.

Since you are able to write code and dealing with sines, the easiest way to remove any offset is to compute the mean and then subtract that from every sample. And don’t even worry about the DC offset adjustments in hardware.

1 Like

Thank you! Some of the other sigma delta’s I’ve used, have built in digital HPF which knock down the DC, like in this AKM part … https://www.akm.com/content/dam/documents/products/audio/audio-adc/ak5522vn/ak5522vn-en-datasheet.pdf
It would be nice to have a HPF switch that could be turned on/off.

I wasn’t aware that you can select the RMS calculation range. Also, I figured out that you can select the “XLIN”, option and set the frequency all the way to zero Hz. Then it also lets you set the RMS measurement all the way to zero also, so that the RMS measurement also includes the DC component.

Behaviorally, it would be nice if there were measurement RMS calculations for “WYSIWYG”, based on the window of data shown in the plot, versus measurement (RMS) calculations based on the underlying full measured spectrum. When we select the XLOG scale, it will never see the DC value.

I did see the variation in the spectrum with the Window type also, illustrating some of the spectral leakage properties, based on the DC component.

Thanks again! I will remove the DC before post processing as you suggested.

@matt I was reading this on dc offset and decided to do do the offsets for my qa402. I got some results I don’t understand. Here are 2 pics of the left channel. One before and one after. The one after is worse.
I did the calibration with 50 ohm shirts on all inputs.

Hi @Moto, you can look in the MyDocs\QuantAsylum\QA40x\CalibrationData\MySerialNumber.dcOffsts file and see the measured offsets for each full scale input level. And if you’d like, you can adjust those to your liking to zero everything out.

I was more just curious about why it happened. Also is it odd that the offset is so small even without the correction?
@matt, it appears that if the original dc offset is negative that the correction just subtracts the absolute value of the offset, thereby doubling it as you can see in my case?
If I go to the cal file and reverse the sign, it correctly sets it to 0 with Dc offsets on.

@matt am I correct in assuming that there is a bug if the offset is negative?

Hi @Moto, I tested this by injecting (in code) a + or - one volt offset in the acquisition data. This was done very early in the pipeline right as the data was pulled from the ADC.

In both cases, I could observe the offset in the time domain, and in both cases calibrating out of the offsets got rid of the injected offset.

So, unless there is something I don’t get happening, I don’t think there is a bug here.

@matt maybe its me just doing something wrong, but the first pic is no offset, the second pic is after recalibrating, and the 3rd is the offset file.
It just seems to double my offset rather than eliminate it.
If I change the sign of the offset in the cal file manually, it does correct graph to 0.

Hi @Moto, I can’t explain what you are seeing. Does anyone else see similar?

Hi @Moto, release 1.193 is HERE and has code to remove all DC offsets at acquisition. There’s no way to turn on or off, so just know it’s always on. Maybe a switch will be added later. But I though we’d play with this for a pre-release or two to see how it feels.

@matt, whatever you did fixed it. What changed?

Hi @Moto, upon acquisition, the average of each channel is taken, and subtracted from the channel data. There could be implications for other types of measurements, so that’s why the release is marked as a pre-release (not for production). But if issues aren’t found, then the File menu DC offset compensation will be removed and this left in place.

1 Like