High pass filter design
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:
 I don't care of phase distortion
 active filter is OK
 max amplitude of the signal +/ 8V
 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?
3 answers
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 highpass 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.
1 comment
Thank you for your answer Andy. Curiously, this is more or less what I tried to do. But I think this time, Olin was right: there is a limit of what is possible to do with analog electronics: Even a 9th order elliptic filter would not give me the required spec. Only a Fourier transform performed on a 100 pt curve will do. The other solution is to modify my probe to get 2 identical signals with a phase offset of 180 deg and to kill the common mode pickup by subtracting the signals.
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 systemlevel 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 5060Hz 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.
5 comments
@olin. Thank you for trying to help me. Indeed, the 5060Hz noise comes from ambiant capacitive coupling of my fieldmeter probe with the near power lines. Unfortunately, I have to amplify the tiny signal out of the probe and the noise is amplified as well. The fieldmeter works very well, but the 50Hz noise reduce the resolution.
@coquelicot Is the power supply part of your product or designed by someone else? Can you modify it or buy a better one? Does it have a commonmode choke? https://en.wikipedia.org/wiki/Choke_(electronics) It usually looks exactly like the one on the top of the wiki page: a somewhat big, throughhole mounted component with visible coils.
@Lundin. Thank you for helping me. The power supply is two 9V batteries inside a metal box (all the electronics is included inside the box to avoid main pickup, and the wire to the probe is a USB shielded wire). The problem is not the noise from the power supply, but the noise picked up by the extremity of the probe from the surrounding power lines, I'm sure. It is impossible to isolate the probe from the noise, since the probe has to be exposed to the field.
@Olin. Thank you for having updating your answer. Of course, I was perfectly aware that with a faster rotation speed, I could filter the noise easily. Unfortunately, my budget is restricted and I do everything by myself. In particular, I have to cope with the material I have in my lab: Modifying the probe I have built with hardness is now much more difficult for me than adding a filter inside the electronics.
@Olin. The field mill is interesting and I was unaware of it. But as far as I understand, it is not well suited to my needs (especially its physical aspect). The electrostatic field meter I've conceived and built is interesting because it is extremely simple and handy, can give very precise measurements (if built more cleverly than I could) and use the self capacitance of a rotating sheet (a unique feature). I've thought to write a "paper" in this forum about that, but I'm not sure.
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:
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 singleopamp 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 56 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 miniPCB that you'll have to handle for proper signal routing.
And what what do you get at the end of these? This:
V(ideal)
is the mathematical transfer function (truncated to float
terms), V(real)
is a quasireal 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, rethinking 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 allpole filters (their lowpass prototype transfer function has a constant in the numerator: Bessel, Butterworth, Chebyshev I, Papoulis, Pascal, Legendre, etc) and polezero 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 allpole filters, dB
Note that for allpole filters I am using Asc
for fp
, and leave it to Ap
for polezero 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 complexconjugate, 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^22\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:
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:
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/postfiltering, 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 XY problem.
9 comments
What a magnificent answer! I'm even surprised: it now appears that this is quite possible: I would choose the elliptic 6 stage elliptic II with 12 mv ripple, with banal 1% resistors and 5% cap!!! In your answer, I don't know what you mean by CGIC: is it an IC or the name of a filter? Also, what do you mean by IIR (infinite impulse response??) (continued in next comment)
Your answer is great from the practical point of view, but I don't know how you arrived to these design rules (I mean, number of stages etc.), which was the essence of the question. What calculator did you use that allowed you to arrive to those results ? is it available freely? If you can elaborate a bit about those points, I will greatly appreciate that, otherwise, I'm very grateful to you for this answer anyway. Thank you so many.
Before I continue, you do realize that you'll get something close to (maybe a bit worse) the black trace in the last picture? If you look closely, you'll see that the passband is no longer flat(tish), it has a droop of maybe 3 dB, which means measuring a signal at 90 Hz and one at 100 Hz will give two differrent readings. Not to mention the transient response. Even if this is just a personal project "for fun", you may be disappointed.
Yes, you are right, I missed that (decibels fooled me). Not what I originally desired. I am still curious about the other things though.
I've updated my answer. Be sure to not omit the last paragraph.
3 comments
Wouldn't you rather want a band pass filter at 100Hz +/ something? Could you give more details about the signals and application? What about currents? — Lundin about 1 month ago
Regarding currents, see my edit, no (4). Regarding the bandpass filter, I think it is always more complex than a high pass filter, so I've not precised that. But if that can help, I don't need more than 110 Hz (that is, the band would be 90Hz110Hz). — coquelicot about 1 month ago
You really need to step back and look at the whole problem, not the details of one imagined solution to the higher level problem. You are apparently trying to measure electric fields. Ask about that directly in a separate question. In particular, explain what fields you are trying to measure, their cause, their magnitude range, how fast you want to detect changes, and the like. Explain what you've tried, but don't get hung up on it since that's likely what needs to be rethought. — Olin Lathrop about 1 month ago