Episode 1425 Notch filter from a THD meter. I do a spice model then layout a PCB PCB: www.pcbway.com... THD Meter: www.nutsvolts.... Be a Patron: / imsaiguy
Op Amp filters are amazing.....You would like to look over the Automatic Self Tuning Notch & Hi-pass filter designs used in the 1972 Kustom Signals MR-7 Moving police radar.....I couldn't believe how complex it was for '72 where Both the Low Doppler (road speed audio doppler return) & High Doppler audio (oncoming Lane vehicle Target return) signals are automatically Simultaneously tuned, separated & digitally displayed.....First time I ever saw analog Self-Tuning op amp filter circuitry.....
The article in audio magazine is interesting, thanks for pointing it out. But I believe, you can make a THD with a good A2D convertor and digital processing. May be you can put a notch filter before A2D converter to get increased resolution. This made me think phase nose is specific case of THD. For phase noise we measure amplitude of "one" offset frequency from carrier and compare it with amplitude of the carrier, whereas in THD we are measure amplitude of all offset frequencies from carrier and sum their power up . Here also it made me think that in THD do we compare that with the power of the carrier? That is a 1V pp carrier causes different THD than say 10V pp carrier. In RF we have 1dB comparison point, and 3rd order intercept point. I guess the true THD should be measured at 1dB comparison point of an Amp, but this is not specified in the defination of THD. This made me research the subject and found out that THD has different variants. THDr, THDf, THD+N. You can read about it in Wikipedia.
If you want to see a more-symmetrical response, use a logarithmic frequency scale for the Spice output plot. (The responses of any types of electrical networks look better using a logarithmic frequency scale, and it becomes easier to see all the response details of a complicated network over multiple orders of magnitude of frequency.) 🙂 The notch is not super-deep because R3 and R4 are mismatched in the model, but there is something odd about the Spice model output. Why is the output below -270 dB? At frequencies well-removed from the notch, the output voltage should be very close in magnitude to the input. I would expect the phase response to be near zero degrees at low frequency since the op-amps are connected in non-inverting configuration. Also, the notch looks too wide, given the presence of the feedback. Perhaps one or both power supplies for the op-amps were not enabled??
The feedback opamp U2A increases the filter Q. Without feedback the notch shape is too wide and attenuates the first few harmonics too much giving inaccurate THD measurements.
I don't know where to get them.... But old motherboards have 0.1 "headers" that are a loop that are used for securing heatsinks. They would be great for scope connections
You don't interact with me hahaha I'm joking. I don't blame you. I'm sick in bed reading datasheets for the different opamps I have and drawing circuits. Op amp circuits are by far the coolest thing I've studied since I got into theory a few years ago. Not enough people do circuits containing op amps assuming the the viewer is taking notes and really passionate. I have thousands of pages of notes and circuits and pictures of them on veroboard or breadboard.
#define mu 0.2f //convergence rate #define M 5 //order of filter #define I 1000 //number of samples double Input[I] = { 0.0 }; double Desired[I] = { 0.0 }; //double H[M] = { 1, 0.5, 0.25, 0.125, 0.0625 }; //the main system double H[M] = { 0.0625, 0.125, 0.25, 0.5, 1 }; //we need inverse of main system to convolution void initialize() { for (int i = 0; i < I; i++) Input[i] = rand() / (float)RAND_MAX; for (int i = 0; i < I; i++) for (int j = 0; j < M; j++) if (i - j >= 0) Desired[i] += Input[i - j] * H[j]; } void main() { initialize(); long T, n = 0; double D, Y, E; double W[M] = { 0.0 }; double X[M] = { 0.0 }; FILE *Y_out, *error, *weights; Y_out = fopen("Y_OUT", "w++"); //file for output samples error = fopen("ERROR", "w++"); //file for error samples weights = fopen("WEIGHTS", "w++"); //file for weights samples for (T = 0; T < I; T++) { for (int m = T; m > T - M; m--){ if (m >= 0) X[M + (m - T) - 1] = Input[m]; //X new input sample for //LMS filter else break; } D = Desired[T]; //desired signal Y = 0; //filter’output set to zero for (int i = 0; i < M; i++) Y += (W[i] * X[i]); //calculate filter output E = D - Y; //calculate error signal for (int i = 0; i < M; i++) W[i] = W[i] + (mu * E * X[i]); //update filter coefficients fprintf(Y_out, " % 10g % 10f", (float)T, Y); fprintf(error, " % 10g % 10f", (float)T, E); } for (int i = 0; i < M; i++) fprintf(weights, " % 10d % 10f", i, W[i]); fclose(Y_out); fclose(error); fclose(weights); }
"Everyone succumbs to Spice!" - IMSAI Guy Atreides
I'll start calling it a Melange model
@@IMSAIGuy :)
Such a filter fanatic! Thanks or the vid, and tutorial on board plug in. 😀
Excellent video, thanks! So many great ideas here, including me getting round to installing microcap.
Op Amp filters are amazing.....You would like to look over the Automatic Self Tuning Notch & Hi-pass filter designs used in the 1972 Kustom Signals MR-7 Moving police radar.....I couldn't believe how complex it was for '72 where Both the Low Doppler (road speed audio doppler return) & High Doppler audio (oncoming Lane vehicle Target return) signals are automatically Simultaneously tuned, separated & digitally displayed.....First time I ever saw analog Self-Tuning op amp filter circuitry.....
The article in audio magazine is interesting, thanks for pointing it out.
But I believe, you can make a THD with a good A2D convertor and digital processing.
May be you can put a notch filter before A2D converter to get increased resolution.
This made me think phase nose is specific case of THD.
For phase noise we measure amplitude of "one" offset frequency from carrier and compare it with amplitude of the carrier, whereas in THD we are measure amplitude of all offset frequencies from carrier and sum their power up .
Here also it made me think that in THD do we compare that with the power of the carrier? That is a 1V pp carrier causes different THD than say 10V pp carrier.
In RF we have 1dB comparison point, and 3rd order intercept point. I guess the true THD should be measured at 1dB comparison point of an Amp, but this is not specified in the defination of THD.
This made me research the subject and found out that THD has different variants. THDr, THDf, THD+N. You can read about it in Wikipedia.
I think it was first created by a Frenchman, and so in typical French it would normally be pronounced "Key-Cad."
That's correct !
Good video. Love that software too.👍
If you want to see a more-symmetrical response, use a logarithmic frequency scale for the Spice output plot. (The responses of any types of electrical networks look better using a logarithmic frequency scale, and it becomes easier to see all the response details of a complicated network over multiple orders of magnitude of frequency.) 🙂 The notch is not super-deep because R3 and R4 are mismatched in the model, but there is something odd about the Spice model output. Why is the output below -270 dB? At frequencies well-removed from the notch, the output voltage should be very close in magnitude to the input. I would expect the phase response to be near zero degrees at low frequency since the op-amps are connected in non-inverting configuration. Also, the notch looks too wide, given the presence of the feedback. Perhaps one or both power supplies for the op-amps were not enabled??
Merci for this video.
As a guy who has to fix boards from time to time. Don't use those "+" via's. They make (un)soldering them a pain.
The feedback opamp U2A increases the filter Q. Without feedback the notch shape is too wide and attenuates the first few harmonics too much giving inaccurate THD measurements.
I don't know where to get them.... But old motherboards have 0.1 "headers" that are a loop that are used for securing heatsinks. They would be great for scope connections
there are many to choose from, but they are stupid expensive: www.digikey.com/en/products/filter/test-points/616
@@IMSAIGuy note to self... Definitely add them to scavenged parts list.
You don't interact with me hahaha I'm joking. I don't blame you. I'm sick in bed reading datasheets for the different opamps I have and drawing circuits.
Op amp circuits are by far the coolest thing I've studied since I got into theory a few years ago. Not enough people do circuits containing op amps assuming the the viewer is taking notes and really passionate. I have thousands of pages of notes and circuits and pictures of them on veroboard or breadboard.
If you take out that odd feedback op-amp, does the notch get more symmetric?
please excuse my question , but this filter is good for a transceiver on audio output ?
sure, as an audio filter for highs and lows or the bandpass for a CW filter
What are the settings for V3 and the values?
#define mu 0.2f //convergence rate
#define M 5 //order of filter
#define I 1000 //number of samples
double Input[I] = { 0.0 };
double Desired[I] = { 0.0 };
//double H[M] = { 1, 0.5, 0.25, 0.125, 0.0625 }; //the main system
double H[M] = { 0.0625, 0.125, 0.25, 0.5, 1 }; //we need inverse of main system to convolution
void initialize()
{
for (int i = 0; i < I; i++)
Input[i] = rand() / (float)RAND_MAX;
for (int i = 0; i < I; i++)
for (int j = 0; j < M; j++)
if (i - j >= 0)
Desired[i] += Input[i - j] * H[j];
}
void main()
{
initialize();
long T, n = 0;
double D, Y, E;
double W[M] = { 0.0 };
double X[M] = { 0.0 };
FILE *Y_out, *error, *weights;
Y_out = fopen("Y_OUT", "w++"); //file for output samples
error = fopen("ERROR", "w++"); //file for error samples
weights = fopen("WEIGHTS", "w++"); //file for weights samples
for (T = 0; T < I; T++)
{
for (int m = T; m > T - M; m--){
if (m >= 0)
X[M + (m - T) - 1] = Input[m]; //X new input sample for
//LMS filter
else break;
}
D = Desired[T]; //desired signal
Y = 0; //filter’output set to zero
for (int i = 0; i < M; i++)
Y += (W[i] * X[i]); //calculate filter output
E = D - Y; //calculate error signal
for (int i = 0; i < M; i++)
W[i] = W[i] + (mu * E * X[i]); //update filter coefficients
fprintf(Y_out, "
% 10g % 10f", (float)T, Y);
fprintf(error, "
% 10g % 10f", (float)T, E);
}
for (int i = 0; i < M; i++)
fprintf(weights, "
% 10d % 10f", i, W[i]);
fclose(Y_out);
fclose(error);
fclose(weights);
}