# How do I know to choose a first order filter vs a second order filter?

I have a DC signal coming off of a battery. The Arduino is reading the voltage. The issue is that the voltage signal contains a lot of noise (120hz frequency). I am planning on building a first order low pass filter but how can I know if first order is sufficient. Do i need to build a second order low pass filter? Note: When looking at the noise, the 120Hz noise has an amplitude 80mV (which is high)

How do you figure out when to use a low pass first order vs second order?

• What cut-off frequency will your filter have (or what frequency band do you need to allow to reach your ADC)? How much do you want to attenuate the 120 Hz by? – The Photon Sep 5 '19 at 23:07
• I have decided the cutoff frequency to be 40Hz since the signal I am measuring is a DC signal, and the only noise I am seeing is 120Hz noise. A low pass filter allowing 0 to 40Hz signal. How much do I want to attenuate the 120Hz? I just know that I don't want to see the 120 Hz noise. – Sam Shurp Sep 5 '19 at 23:11
• Well, it's 80 mV now. After filtering, what's the maximum you can allow it to be? 40 mV? 8 mV? 0.8 mV? "as low as possible" is not an engineering spec. – The Photon Sep 5 '19 at 23:13
• 8mV or lower. With 8mV noise, the signal to Noise ratio is big, which is good. – Sam Shurp Sep 5 '19 at 23:15
• You might consider augmenting a simple low pass filter with digital filtering. This might be as simple as adding together a string of ADC samples for a period of 8.333 ms., then divide by the number of samples taken. – glen_geek Sep 6 '19 at 0:27

Based on comments, you want 20 dB of attenuation.

A one pole low-pass filter rolls off at 20 dB per decade above its cut-off frequency. So you'd need to put your cut off one decade below the undesired signal frequency to achieve 20 dB attenuation with a one pole filter. That would be 12 Hz.

A two pole filter rolls of at 40 dB per decade. So you'd need to put your cut off half a decade below the undesired signal, which is $$\120 / \sqrt{10}\$$ or about 38 Hz, right about where you wanted to put it. I'd lower the cut-off frequency a bit further to be sure of reaching your goal of dropping the interference amplitude below 8 mV.

Or, consider using a notch filter instead, which can achieve higher attenuation in a narrow band around some target frequency for a similar design complexity.

Also, if your 120 Hz signal comes from your powerline, and you ever might want to use this circuit in a place with 50 Hz instead of 60 Hz power, you may want to adjust your filter design to cover 100-120 Hz (plus some margin) instead of just 120 Hz (hat tip to @TimWescott for suggesting this addition).

• 120Hz makes me think power-line hum. If it's that, you can't count on it being exactly what you think. First there's the whole 50Hz vs. 60Hz thing, then there's older gensets which don't stay on frequency very well. Unless it's only ever for one power grid. – TimWescott Sep 5 '19 at 23:36
• @TimWescott, good point, edited. – The Photon Sep 5 '19 at 23:41
• @TimWescott, I ran a 120 Hz twin-T notch design on the Okawa filter design site, and it looks like a 120 Hz design will just achieve 20 dB attenuation at 100 Hz. Moving the center to 110 Hz ought to cover both 100 and 120 Hz with a bit of margin. – The Photon Sep 5 '19 at 23:42
• @ThePhoton Where grid frequency is concerned, I'm rather suspicious myself, but I'd check that the frequency drift is of no/little concern. A 4th, or even 6th order willl cover more, if settling times are not of concern. I'm only mentioning this because I have seen some atrocities in the past. – a concerned citizen Sep 6 '19 at 14:02
• From your recommendation, the easiest would be to create a one pole low pass filter with a cutoff frequency of 10Hz. Thank you – Sam Shurp Sep 6 '19 at 16:20