Notch Filter Hardware REVC

In a previous post (here) a new oscillator and notch filter were discussed as a tool for the lab. The third revision of the board has been built and measured. This post documents the measurements of new board. Please read the previous forum and blog post here to learn more background.

The board floorplan was previously discussed and is repeated here. Region A is USB CPU and relay control, region B is isolated +/-15V rails, region C is AGC and oscillator, region D is output stage, region E is attenuator, and region F is the notch.
image

The assembled board appears as follows. The board is powered by a USB connection, and the USB connection allows control of the eight on-board relays. The relays are set/reset type, ensuring zero nominal (non-switching) current and a clean drive setup that minimizes coupling from relay supply to relay signal. The finished board fits in a standard QuantAsylum case and will have a powder-coated aluminum front-panel like our other products.

Oscillator and AGC

For the oscillator and AGC, the schematic is below:

The previous posts have links to the lineage of these designs. The original source was an article Jim Williams published in 2011. That designed was advanced again in an article Janascard.nz published many years later. The folks at Januscard detail their improvements in their doc.

The schematic indicates OPA2156 opamps, but OPA1656 were used for this build. These are both pretty big wins over the opamps Jim Williams and Januscard had available at the time. The two opamps–2156 and 1656–are nearly the same, with the OPA1656 having some slightly degraded specs compared to the OPA2156. In the lower right quadrant of the schematic you can see the full wave rectifier. This theory behind this block is well covered in an app note by TI here.

Note that TI outlines some key parameters in the app note related to rectifier accuracy. The most visible artifact related to diode selection is the lower edges (highlighted in the plot above). A BAS7004E6327HTSA1 was used in this build, but probably some other diodes should be evaluated too as I suspect the sharp transitions in the rectifier are radiating energy throughout the board, albeit at very low levels (nanovolts) and these transitions are limiting the performance of the 2H. More on that later.

Williams make an important point in his article to understand the 2H level on the LED bias current in the NSL-32SR2 part. In the plot below, you can see the level of the 2H on the LED relative to the oscillator output. That is, the 2H on the LED bias is about -55 dB below the oscillator’s output level. This could be improved by making the integrator’s time constant larger, but that would degrade the startup time, and it’s not clear that if that would improve the output THD or not. But it’s something to keep in mind, especially with the issue of 2H degrading performance.

The first RC “tank” in the oscillator as shown in the schematic is comprised of 4 22nF + one 420 pF (44.44nF total) working alongside a 3.57K + 11 ohms (3581 ohms total). All C’s are 0805 COG 50V 1% (GRM21B5C1H223FA01L and CC0805FRNPO9BN821). The tank R’s are all thin-film 0805 25PPM 0.1% (ERA-6AEB3571V).

Combined, these are delivering phenomenal performance, with no need for anything more exotic like PET film.

Notch

The notch schematic is shown below. Note there’s a relay that can be switched to bypass the notch, and that the notch has a fixed 12 dB of gain built-in.

Hand Tuning

It’s important to keep the LED forward current around 5 mA. To achieve this, R56 will likely need to be modified on each board. If the forward current is less than 4 mA then increase R56 by a few ohms. If the LED forward current is greater than 6 mA then reduce R56 by a few ohms.

With the LED current stabilized around 5 mA, check the output level. With the attenuator set to 0 dB and the oscillator gain set to 0 dB, the level should be around 6 dBV. If the output level is too high, then increase R66. If too low, then increase R56.

Reviewing UI

The UI for the hardware is shown below. On the far left is the oscillator block. It has no UI controls. For the relay-based attenuator, you can dial in 0…63 dB in 1 dB steps. For the post-attenuator gain block, your choice is either 0 dB or 12 dB of gain.

The notch block has a single control element: The bypass switch.

Measuring Performance

ADC Input

Let’s start by taking the output of the oscillator, with atten at 0 dB and the 0/12 gain block at 0 dB. Running that straight into the QA401 gives the following spectrum:

We can read the amplitude is 6.34 dBV, just above the QA401’s max input of 6 dBV. The ADC is clearly overloaded at this point.

With 25 dB of attenuator added, the 2H and 3H disappear to about -150 dBV without any notch. This is important to understand, because it means that there’s not much benefit from attenuating the input signal below 20-30 dBFS. In fact, if you fall too far into the notch you can experience wild amplitude variations from the normal drifting of the oscillator as it rides up and down the steep skirts.

Next, let’s turn on the +12 dB gain block and increase the attenuators another 12 dB. This gives the same signal level (about -19 dB), almost the same 2H, and an increase in the N+D of about 4 dB. This is expected, because you usually want gain stages before an attenuator. But in this case, with +/-15V rails, it’s was thought not practical to have a 12 dB amp on the 6 dBV oscillator output as it gets to close to the rails. That decision might be revisited. The summary here is that the attenuator doesn’t add to the distortion at first blush (we’d not expect it to given if it purely resistive with a fixed load presented to the oscillator), but it can obviously raise the noise floor.

Checking Center Frequencies of Oscillator and Notch

Oscillator

To learn the oscillator center frequency, we can use the Wow and Flutter analyzer, which will give us some statistics on the measured frequency:

Here we see the oscillator is running at 1002.961 Hz. Startup settling hasn’t been examined.

ADC

Next, let’s connect the QA401 output to the notch input, and the notch output to the QA401 input. And then we’ll run a chirp on the notch. Note that the chirp level is -12 dBV coming out of the QA401, and that windowing and smoothing are disabled.

As we saw in the schematic, the notch has 12 dB of gain buit-in. So, when we sweep at -12 dBV, we can see the notch gain is working–the level at 100 Hz is 0 dBV. The notch depth is unaffected by the gain: We see we have an ultimate notch depth of 55 dB or so. We’ll learn the depth and center frequency when we export the notch.

When exporting the notch response, we need to know the oscillator center frequency. We learned that with the Wow and Flutter visualizer: it was 1002.961 Hz. The notch export is under the File-Export menu.

The export tool writes the notch values to the specified file. It also ensures that harmonics are in the correct spot when displaying corrections. Looking at the output from the tool above, we can see the notch has a center frequency of 999.02 Hz, and a max depth of 55.8 dB. At the 1H (fundamental), the notch gain is -50.57 dB. At the 2H, the notch gain is -9.04. And the 3H, the notch gain is -5.06. These harmonic values will be used to compensate the notch measurement and allows us to read the attenuated tone with true values for the fundamental and the harmonics.

Let’s sweep the notch with the weighting file we just exported loaded (see the previous posts on this for more detail on how):

Note that the additional processing has increased the notch gain at 1H, 2H, 3H, etc. so that they show 12 dB of gain. In other words, through additional processing, we have countered the effects of the notch precisely. With this processing, the notch appears as a 0 dB gain element at 1 kHz, 2 kHz, 3 kHz, etc.

First Measurement Through Notch

Next, let’s connect the Oscillator output to the Notch Input and then connect the Notch Output into the QA401. Our signal appears as below. Remember, the oscillator output is at 6 dBV, the notch knocks that down ~50 dB to -45 dBV, and then the notch gains it up 12 dB to -33 dB. And then the user-weighting we loaded (from the notch export) increases that to 17 dBV. The jump from -33 to 17 is 50 dB–the depth of the notch at the oscillator frequency, give or take.

We can hit the bypass button in the UI and bypass the User Weighting and we’re back to where we started: The Oscillator at ~6 dBV overloading the ADC:

Let’s re-engage the notch and User Weighting, and display that plot normalized to the peak. And let’s bump up the FFT size and add some averaging. This gives us our best-case THD of about -143 dB (with -121 dB THD+N).

Next, let’s engage the +12 dB amp on the oscillator:

And we now see the following plot (normalized to peak). This gives us our best-case THD+N of about -125 dB (with THD of -137 db).

Note that above we’ve traded THD+N for THD. That is, we lost about 5 dB of THD performance in return for almost 4 dB of THD+N.

One Last Test

It’s possible that what we’re seeing above is simply because of “lucky harmonic cancellation” so that the oscillator + notch + QA401 are lining up “just so” and the harmonics are cancelling. We can run some quick tests to nudge the harmonics at different stages and see how things change.

Case 1: No Atten.

This is what we generated above for the best-case THD.

Case 2: No Atten, Swap Inputs

This involves switching the inputs used on the QA401. Thus far, we’ve only used the L+ input and shorted the L- input on the QA401. For this case, we take the same configuration in Case 1 and route it to the L- input. Why? Because the L- input is 180 degrees out of phase with the L+ input, and if there were some magical phase alignment that was effectively cancelling the harmonics due to luck, this test would invert that cancellation and make things worse. But as you see in the plot below, it’s virtually identical to Case 1. Which means we’re not just getting lucky: What we’re measuring is very likely legit. Note that this case ensures there isn’t any lucky cancellation happening between the notch and the QA401.

Case 3: With 5 dB of atten

By introducing some attenuation, we can upset any beneficial harmonic balance that might be in place resulting in cancellation between the oscillator and notch. And this does show something interesting. In case 1, the absolute level of the 2H was -145 dBV. In case 2, it was was the same. When we dial in 5 dB of attenuation, the absolute level of the 2H is 144 dBV. But it should have dropped 5 dB if it was coming from the oscillator. In fact, it stayed the same. This suggests the 2H we’re seeing here originates in the notch. And as we’ll see below, the culprit is likely leakage from the rectifier. The 3H did in fact drop 5 dB. What we can infer from this is that 2H leakage into the notch is limiting performance. More on this later.

Given the result from the 3 cases above, we can be reasonably certain what we’re seeing is accurate and NOT due to favorable harmonic alignment between the different stages.

Lastly, just to again bring this full circle, let’s switch back to dBV mode. Note we’re effectively hitting the ADC at 18 dBV…and yet we’re on the +6 gain range and not overloading. How is this possible? Again, the answer is because of the gain corrections that have been applied. If we disable the gain corrections and bypass the notch, we’re back to square 1: The input is at +6 dBV (severely overloaded) and the N+D is absymal at -88 dBV (again because we’re overloaded).

Engaging the notch let’s us see what the ADC is actually seeing: The incoming signal (post notch) is hitting the ADC at -33.6 dBV. And look at N+D: It’s at -104.6 dBV. This noise floor is ~11 dB above the noise floor of the QA401. In other words, there’s plenty of margin.

Noise

The noise is an important contributor to the best-case THD that can be had–that’s not a typo where I meant THD+N. This is because of the corrections that are being applied. Noise can appear as harmonics that aren’t actually there. Remember this picture above:

This plot shows the corrections being applied at each frequency. You can see that at 2 kHz, the natural curve of the notch indicated around -9 dB of attenuation. And so, to counteract that, the math provides 9 dB of gain at 2 kHz. Remember, this takes into account the notch center and the oscillator frequency.

What is important to understand here is that if your harmonic height isn’t sitting above the noise floor already, then the correction will simply take the noise at that frequency and boost it and make it appear as a harmonic when really it’s just noise. Be very aware of this and as a quick sanity check remember this rule: If your 2H isn’t at least 9 dB above the noise, then it’s not a real harmonic.

Noise, obviously, must be minimized.

Opamps

If noise is so important, then why not use a really, really low noise opamp like the AD797? The answer is because of the impedances we’re dealing with. Once your in/out impedances get above a certain level, then low-noise bipolar opamps don’t look so hot because of their current noise. And you need CMOS opamps. The RCs in the oscillator and the notch set our limits. That is, if we wanted to reduce the R from 3.57K down to 357 ohms (where an AD797 would likely really shine) then we’d need to increase the C 10X. And it’s hard to find a C0G cap in that size (we’re already at the limit) and so it would require that we use 10X more caps in parallel OR more to something more exotic.

In the end, a higher noise CMOS opamp with an emphasis on getting the tank RCs manageable was the goal.

Notch Noise

We can measure the notch noise by shorting the input to the notch and measuring the output. That plot is below. There’s leakage apparent at 1 kHz, and the 2 kHz presence is a bit curious and the issue was hinted at above. The 1 kHz is likely leakage from the main oscillator. The 2 kHz is probably leakage from the rectifier. Some improvement to the layout and shielding will be looked at in a later version to address these. Note that this is an output referenced measurement.

If we indicate to the QA401 we have 12 dB of external gain, the plot appears as below. This is an input referenced measurement. If our oscillator has a 2H that is below -148 dBV, then it’s likely being contaminated by the 2H present in the notch. In other words, no matter how good the oscillator is, the notch will never allow the 2H to be better than -148 dBV or so.

From the two measurements above, we know the output referenced noise is -108.3 dBV (20 kHz BW, no weighting) and the input referenced noise is -120.3 dBV (same conditions). The QA401 noise floor is -115 dBV, and thus might be impacting these measurements by a dB.

Oscillator Noise

Measuring the oscillator noise is a bit tricky because the signal out of the oscillator is huge. Let’s try to estimate it by seeing how the notch noise degrades. In the plot below, the green trace is the notch output with the input shorted (output referenced). Then, then oscillator was fed into the notch. Here we can see the noise overall is higher, and it’s probably 5-6 dB higher when the oscillator is pushed through the notch. So, we can’t make a definitive statement about the oscillator noise, but we can state it probably on par with the notch noise. But let’s see if we can get a bit more definitive.

We’ll take the oscillator and run that through an ultra-low-noise 10 dB amp on the QA470. That gives us the plot below:

This suggests the oscillator noise is a bit lower than the notch. If we assume the notch noise is at -145 dBV (@100 Hz), the oscillator + notch noise is at -141 dBV, and that the oscillator through 10 dB amp then through notch is -133 dBV, then some back of the envelope math suggests the oscillator noise is about 2 dB better than the notch. Of course, it would be better to get the noise down in the notch even further and that might be an area for future exploration.

Performance Benchmarks

Above we were aiming to find the best-case THD and THD+N. For THD, that was measured at -142.8 dB at 6 dBV output. For THD+N, that was measured at -124.8 dB at 18 dBV output.

These outputs are much hotter than is useful in a lot of cases. Let’s look at THD and THD+N at some attenuated output levels. For these measurements, the FFT was 32K and 5 averages. Values were rounded to nearest whole number.

Osc Level (dBV) Atten Gain (dB) Output Level (dBV) THD (dB) THD+N (dB)
6 0 6 -143 -122
6 -5 1 -138 -118
6 -10 -4 -128 -113
6 -15 -9 -129 -108
6 -20 -14 -122 -103

For typical audio line level (around 0 dBV), the performance is excellent, and likely far exceeds the capability of all consumer and pro hardware.

Ultimately, beginning at an output level between -15 and -20 dBV, we can see the harmonic levels remain constant. If these harmonics were coming from the oscillator, then they’d be attenuated with the signal. But as we saw above, this appears to be another indication of the 2H coupled into in the notch.

Future Improvements

From above, there are some leanings to roll into a future iteration. But first, let’s recap where things are with the hardware :

Hardware

  • USB powered
  • 0…63 dB of relay attenuation in 1 dB steps
  • 0/12 dB gain on oscillator
  • Passive notch with 12 dB of gain
  • Total output range from +18 dBV to -57 dBV
  • All corrections performed automatically by QA401 software

Potential Future Improvements
If another lab unit is made, the following should be considered:

  • Shielding, especially the rectifier portion should be shielded alone.
  • Test OPA2156, as these opamps have roughly 4 dB more open-loop gain
  • Consider moving 12 dB amp after oscillator and before attenuator
  • Focus on noise in notch before focusing on oscillator noise
  • Noise, overall, seems reasonable. The performance limitation seems to be driven by 2H in the notch.
1 Like

Hi,

Just letting you know that I will buy one as soon as you have one available… notch/osc etal.

THx-RNMarsh

Hi @RNMarsh, noted! This probably won’t become a product as it’s mostly for lab use and thus hand placed. But if we ever build a batch I’ll for sure let you know.

Hello,
Really nice work there, big like. One question if i may: what is input impedance of stepped attenuator?
Regards!

Hi bmsorin, it’s 2K fixed input impedance. Next version will have the 0/12 dB gain moved to the input of the attenuator. and another non-inverting buffer at output.

1 Like

Hello Matt, thanks for clarification, that explain the low noise of input attentautor.
Best regards, and keep that road!

An update on the RevD hardware is HERE.

Maybe supply the pcb and parts list and I will do the rest.

??

THx -
-RNMarsh

Follow-up post is here: Introducing the QA480

Which simulator have you used to develop this, if any? Are you able to share any simulation files? I’m hoping to build one of these oscillators and a notch filter myself. If I can do a simulation I will be able to work out the correct components for different frequencies. I hope you can help. Thanks.

David.

Hi @djsb, some sims were run on stages to understand noise (eg where to put big gain stages), but these are small, throwaway simulations that save a few minutes of hand calculations. Oscillators don’t always simulate well, and closed loop oscillators are even harder. But the notch would simulate fine. However, it’s largely an academic exercise as the tools won’t do a good job of predicting distortion at these levels. I suspect the distortion is dominated by the caps. TI has a good plot (Figure 9) in the OPA1656 spec that puts the 2H approaching -170 dBC and all other harmonics are even lower. I’m not sure how they measured that (probably via distortion magnifier). But my guess is that NP0/C0G ceramics are around -150 dBc or so and pushing beyond what the QA480 delivers would probably need film.

Good luck, and please feel free to post what you learn.