Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

High pass filter design

+1
−0

Despite there are many filter calculators available on the web, I still have difficulties to translate what I need into calculator design parameters.

For my application, I need ideally a high pass filter that kill everything below 60Hz, and keep everything near 100Hz. More mathematically, I would like a HP filter that keep 99% of the signal (voltage) at 90 Hz, and kill x % of the signal at 60Hz (say x = 98%, but I can compromise to reduce the complexity of the filter).

Other considerations are:

  1. I don't care of phase distortion
  2. active filter is OK
  3. max amplitude of the signal +/- 8V
  4. very weak current (it is to be the input of an oamp).

How the real pros would translate these needs into design rules for a calculator?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (3 comments)

3 answers

You are accessing this answer with a direct link, so it's being shown above all other answers regardless of its score. You can return to the normal view.

+2
−0

How the real pros would translate these needs into design rules for a calculator?

Speaking as a pro I wouldn't use a calculator because I'd use a simulator and tinker with a few values until I got the response I wanted. I'd probably use standard building blocks like high-pass sallen key filters and cascade them until I got the desired response.

I might also consider using a notch filter to remove the problematic frequency area sufficiently.

I'd also be concerned about the filter circuit adding noise to what might be a very small input signal.

Bottom line: I would simulate to find the right type of filter that fits the requirements and then do calculations on what unwanted noise that filter might bring to the party.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (1 comment)
+2
−0

I saw this link by accident and, while Andy's and Olin's answers are spot on, I thought I'd expand a bit on the complications they describe, just so you know what you're missing (or meeting, should you decide to continue). Also, it might get a bit long, but that's why the voting system exists.

First, your requirements are quite tight, that is, you need a corner frequency of 90 Hz and a stopband frequency of 60 Hz. You also need some 100x attenuation of the signal, which means 40 dB stopband attenuation. You don't specifiy the corner attenuation, but let's assume you can live with the usual -3 dB, or better. That means you'll no longer have a flat(ter) passband, but that's not the problem: the order of the filter is directly proportional to the transition width.

Analog filters have 5 established classic approaches: Bessel(-Thompson), Butterworth, Chebyshev I & II, and elliptic (Cauer). There are many others, but these are known all over literature. Out of these, Bessel filters are somewhat special (they're meant to be used for a flat group delay, as opposed to frequency characteristics), so I'll not consider them. The other four would result in the following minimum orders to meet the requirements: 12 for Butterworth, 9 for Chebyshev I, and 6 for inverse Chebyshev (Chebyshev II) and elliptic, where I considered a 0.01 dB ripple for both Chebyshev I and elliptic, which would result in some 1.2 mV ripple, thus negligeable. If you can live with ~11.5 mV ripple, then 0.1 dB results in only a 5th order for elliptic (9th for Chebyshev I).

Let's assume N=6 for Chebyshev II and elliptic. Out of these two, Chebyshev II has a clear advantage over the elliptic due to the maximum flatness of the passband, but that means the 90 Hz corner frequency will be at -3 dB compared to the rest of the passband. To get a clearer picture, here's a zoom in the passband for elliptic with 0.01 and 0.1 dB ripple, and for Chebyshev II:

passband

But all this is for an ideal case, a mathematical transfer function. This needs to be put in practice and, if an analog way is chosen, then you would need N/2 2nd order sections to build a filter. And this is where the problems appear:

  • You have to decide whether you need only one opamp per 2nd order section, or two, or three. This is not as simple as it may sound, because single opamp stages are limited in terms of quality factor and need special considerations for stage gain (additional dividers or even opamp attenuators might be needed). And if you do decide that you want single-opamp stages (and let's assume you can get around with only dividers), you'll find out that pole/zero stages that are closer to the corner frequency have higher Q that cannot be built, or will be too sensitive to component tolerances. Which means using at least two opamps per stage, thus 6 opamps in total. Let's say you have a quad opamp, that means two opamps. So far.

  • Then decide what tolerance your components will have (5% resistors? 1%, less?, capacitors?). You'll find out that you'll need quite a few passive elements per stage: at least two capacitors, and 5-6 and upwards resistors.

Even if "only" these two are the only ones that you have to take care of, the result will be a noise and thermal susceptible filter, that will no longer give you that clear mathematical frequency response. Not to mention you'll get a nice mini-PCB that you'll have to handle for proper signal routing.

And what what do you get at the end of these? This:

result

V(ideal) is the mathematical transfer function (truncated to float terms), V(real) is a quasi-real approach (1% resistors, 5% caps, ideal opamps -- these also contribute), and an IIR approach, V(iir), which almost overlaps with the ideal, due to roundings & co. The BOM (bill of materials): 7 resistors + 3 caps per 2nd order stage, 3 stages, where I have used a 2 opamp verion, CGIC (current generalized immitance converter). (I set the corner frequency to 100, instead of 90, by accident -- same thing)

So, if you can live with that, good luck, otherwise, as the others have said, re-thinking your strategy is the way to go.


To expand on the filter design would mean at least a thick book, so I'll thin it down to some bare necessities. I'll mention that there are all-pole filters (their lowpass prototype transfer function has a constant in the numerator: Bessel, Butterworth, Chebyshev I, Papoulis, Pascal, Legendre, etc) and pole-zero filters (the numerator has zeroes: elliptic, Chebyshev II or inverse Chebyshev, inverse Pascal, in fact all inverse filters); here we're dealing with the latter.

I'll use Octave to show the steps for the filter design, but I have my own scripts & co, i.e. there are numerical differences between what Octave will show and what I calculated, because of the differences in approaches. The methodology is what matters. There may be software around the Internet, Iowa Hills comes to mind, but most of the ones I know deal with IIR (digital) filters.

To determine the values, I used your requrements:

fp = 90;   # passband (corner) frequency
fs = 60;   # stopband frequency
delta_s = 1/99;  # attenuation
delta_p = 0.001; # arbitrary allowable passband ripple
Ap  = -20*log10(1 - delta_p);  # passband ripple, dB
As  = -20*log10(delta_s);      # stopband attenuation, dB
Asc = 3;         # attenuation @fp for all-pole filters, dB

Note that for all-pole filters I am using Asc for fp, and leave it to Ap for pole-zero filters (even if frequency scaling can adjust that). The exact values for the passband and stopband ripple are Ap=0.0086902 and As=39.913; even if I used rounded values in the answer above, the orders don't change.

To calculate the minimum order:

Nbutt  = buttord(fp, fs, Asc, As, 's');
Ncheb1 = cheb1ord(fp, fs, Ap, As, 's');
Ncheb2 = cheb2ord(fp, fs, Asc, As, 's');
Nellip = ellipord(fp, fs, Ap, As, 's');
Nellip2 = ellipord(fp, fs, 0.01, As, 's'); # for the 2nd elliptic case

There are 7 ways to design an elliptic filter, Octave does it differently than what I used before. I'll show how Octave does it, but I'll use the values as calculated before, to avoid reclaculating everything. So, calculate the poles, zeroes, and gain for the elliptic filter, but use normalized (unity) frequency to avoid large numbers (also use Ap=0.01 and As=40 to get the same numbers):

[z, p, g] = ellip(Nellip, 0.01, 40, 1, "high", 's');

With these you can make the transfer function but it will come out as an expanded version:

[num, den] = zp2tf(z, p, g);
tf(num, den)
                  0.9988 s^6 + 0.9 s^4 + 0.2146 s^2 + 0.008854
 y1:  --------------------------------------------------------------------
      s^6 + 2.691 s^5 + 4.551 s^4 + 5.075 s^3 + 4.193 s^2 + 2.2 s + 0.8854

If the transfer function is kept this way it will be made of 6th degree polynomials, which means that any small perturbance at the input will translate into a 6th power at the output. This is a cause for instablilites and overflow (for digital filters), so the usual step is to break it down into 2nd order sections. For this, since the poles are complex-conjugate, group them in pairs so that each section would look like this ($z_n$ = zeroes, $p_n$ = poles):

$$H_{2^{nd}}(s)=\frac{s^2+|z_n|^2}{s^2-2\Re(p_n)s+|p_n|^2}$$

With the inital values (for the reason mentioned above):

$$ H(s)=\frac{s^2+0.029502}{s^2+0.18934s+0.77767} \frac{s^2+0.2}{s^2+0.79928s+0.96608} \frac{s^2+0.34054}{s^2+2.1379s+1.4822} $$

I've chosen the modified CGIC for this, which has the basic topology like this:

CGIC

and if $\mu=2\lambda$ its transfer function is reduced to this:

$$H(s)=(2\kappa-\mu)\frac{s^2+\frac{1}{\left(\frac{2\kappa}{\mu}-1\right)R^2C^2}}{s^2+\frac{1}{QRC}s+\frac{1}{R^2C^2}}$$

Since this resembles the transfer function of the 2nd order stages above, a system of equations is formed to solve the values of the elements, with C imposed. The results are scaled upwards from the unity frequency that was used, and the result is this:

final

For the IIR omit 's' in the ellip() function above. I used a 8192 Hz sampling frequency (quite large, a whim). Implementation is more involved, though, it requires some sort of DSP, with ADC/DAC, proper pre-/post-filtering, etc. For a case of "a simple measuring" it might not be worth it.


I will end by reinforcing what the other answers hinted at: that what you want and what you need are two different things, so even if this answer deals with the filter design, it doesn't change the underlying X-Y problem.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (9 comments)
+2
−0

You are asking for a filter that passes 2% at 60 Hz and 99% at 90 Hz. That comes out to a transition of 97% of the amplitude within 0.6 of an octave, which is quite aggressive.

The real answer

My first reaction is that this smells like attempting to fix bad system-level design in the wrong place. Step back a few levels and think about the real problem, not the imagined solution of filtering out 60 Hz in a specific location in the signal path. What are you really trying to measure? What frequency range is the desired signal? Where is the source of 60 Hz noise coming from?

If your real problem is 60 Hz noise from the power line is getting into some low level signal, ask about that directly, probably in a separate question here.

It is also suspicious that a ±8 V signal of limited bandwidth needs to go into an opamp at all. Manipulating a signal like that in the analog domain went out in the 1980s. Again, pop up a few levels and explain what the overall system is trying to accomplish. It smells like this signal should go into a microcontroller, perhaps with DSP capability, and be dealt with digitally from there.

Answer about the filter

Forget about doing this with analog components. A purely analog filter would be quite complex, the part values would need to be within an accuracy you can't get, and would likely require complicated trimming.

What you want is a sinc filter. Actually the convolution with a sinc yields a low pass filter. You want the inverse of that, but the underlying math is still that of a sinc. For the specified sharpness of the transition region, you will probably need several 100 points in the convolution kernel. How tractable this is depends on the highest frequency of interest, which you haven't told us.

Again, though, the right answer is to not be in this predicament in the first place. Go back and fix whatever the real problem is at the system level.


Indeed, the 50-60Hz noise comes from ambiant capacitive coupling of my fieldmeter probe with the near power lines.

I'll assume by "fieldmeter" you mean what is usually called a "field mill"? That is two electrodes rotating on a drum, used to measure static electric field. These are used, for example, to measure the field buildup before a lightning strike.

If the above is true, then there is a much easier way to deal with 50 or 60 Hz power line interference. That is to process the measurements synchronously to the drum rotation. With the drum rotation speed sufficiently different from the noise frequency, a notch filter at the drum frequency should do.

Put another way, your frequency range of interest is only a narrow band around the drum rotation frequency. Selecting only for that is much easier than trying to make a tight high or low pass filter.

Since the drum speed is "slow" compared to what a modern microcontroller can do, this is rather easily done digitally. The measured signal is multiplied by sin and cos of the drum frequency. After some additional manipulation, you get the field amplitude and direction in the plane of the drum rotation.

You could also probably just buy a field mill.


I know nothing about digital electronics, microprocessor etc. It's a pity because this would probably simplify things, but it's not really needed for this research project. In a word, you can see me as a high level analog electronic tinkerer.

That doesn't change what is possible with analog electronics. Although we need more details about this "fieldmeter" you are trying to build, it sounds like the processing would be rather simple in a microcontroller, and quite difficult in analog electronics.

If this is not your area of expertise, work with someone for whom it is.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (5 comments)

Sign up to answer this question »