Digital Filtering vs Analog Filtering? - Page 1
Forum section: electronics / general

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: October 17, 2015, 05:07:09 am
content: So first off im not an EE, my math goes to pre-calculus, which I have a hard time recalling. Usually if I need higher level math for theory I either do a lot of research on that equation or just can something someone else has written.....I understand first order RC/LC/RLC filtering. I just through a cap in and wrap a coil most of the time. I do not understand how to design something like a Butterworth/Sallenkey filter.... any advanced filter I just plug numbers in to a designer and use the components I am told. Im sure I could learn how to design my own 7 pole filters if I wished but I am also sure it would take me a while and wouldn't gain much from it over design software.I have recently been thinking about DSP, I have never really gotten in to DSP thinking thats a pretty specialty area but im sure there are good functions out there on most platform to do a FIR or IIR filter. I was trying to get the basics down so I googled Arduino code LP filter, well all the post I read said to put an LC filter in front of the pin also!!!?! Why is that, if your filtering out specific bandwidths why would you need hardware on top of software? Why not just use an LC filter and call it a day?My understanding is that digital filters dont have issues like analog do, theres no drift or precision issues, nothing degrades with age. So what is the pitfall of digital only? Secondly lets say you want to clean up a power rail, what if you just had a bunch of sot attinys around programed to do this, this is almost cheaper than a decent coil and cap? And if that is an awfull idea what about using something like a coolrunner or even a GAL to do filtering?One reason in interested in this for regular power rail and pwm filtering etc... but what if I wanted to use this in a bigger way, what about making something like a broadband antenna pre selector for something like a 1.8ghz sdr. Is there any reason this would be a horrible idea? it seems to me like maybe a true FPGA or a ton of small micros would be a much cheaper and compact method if you wanted to maybe do a good bandpass for every 10mhz? Then what is the difference between a DSP like the blackfin and just using an fpga for DSP? Whouls a DSP chip just be much easier if your plan is to use canned code, i.e this is one of those projects where I wouldnt want to copy and paste it as much as possible because im sure it wouldn't be easy to learn and would take a lot of time awayf from learning other things... im even confident wrapping coils would be quicker than learning FPGAs and DSP math as the same time!One last unrelated question I bought one of these, im not to sure why they just call it a common mode filter. I e-mailed the maker to ask what frequencys that acually meant and never heard back. Unfortunately the components are unreadable so I can figure it out that way. I was going to stick it across the power rails of a USB connector for sdr/radi equiptment but im not sure its needed or does much more than feright.https://www.tindie.com/products/ivc/lc-common-mode-power-filter/there documentation mostly shows it connected to motor controllers, which if it will clean up motor noise that good, you dont want your motor noise getting in to an accelerometer.... but if anyone can give me some type of specific details on what this should be filtering It would help, as there is no specific frequency for common mode noise!

author: hagster
author_rank: Frequent Contributor
timestamp: October 17, 2015, 06:04:36 am
content: Lots of questions.You need an analogue filter in front of you ADC to satisfy the Shannon sampling rule and prevent aliasing. Digital filters can be great, but their bandwidth is limited by the sampling rate.A DSP chip and an FPGA are just 2 of the methods for processing the samples. The DSP is a kind of processor that can handle really large vector maths. I.e. doing a thousand multiply and accumulates in parralell. From what I know it seems that FPGAs are far more popular than DSP chips.If you want to get into RF and DSP stuff, the easiest way in is via GNUradio and a cheap RTL dongle. With this you mostly just use the shear grunt of modern desktop or laptop computer to do the number crunching. It's a sledgehammer approach, but by far the easiest and most flexible approach. There is a great series of tutorials from Michael Ossmann onhttp://greatscottgadgets.com/sdr/I can't recomend these highly enough.

author: DimitriP
author_rank: Super Contributor
timestamp: October 17, 2015, 06:22:40 am
content: QuoteIf you take off the shrink wrap, the part will be much more easily recognizable. Chance are it's using an inductor "similar" or "like" these:http://www.digikey.com/product-search/en?pv69=80&FV=fff40034%2Cfff802a9%2C30000a%2C300024%2C3001ea%2C30047a&k=common+mode+filter&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25My browser is on fire tonight !

author: DimitriP
author_rank: Super Contributor
timestamp: October 17, 2015, 06:37:07 am
content: QuoteI sure hope someone can explain it in five sentences or less, otherwise we are in for a looooong thread.Anyone...anyone...Bueler ....

author: Hypernova
author_rank: Unknown
timestamp: October 17, 2015, 07:01:15 am
content: You still need analog filtering especially low pass in any A/D process chain due to:1) aliasing2) Aliasing3) ALIASING!!!Due to sampling speed restrictions of your ADC you will often get errors from high frequency signals after it's digitized. Once turned into a stream of numbers it is mathematically impossible (for all practical purposes) to tell if the stuff you want to filter in/out was actually in the original signal.That and sometimes you just don't have to processing power left with what ever you are using.

author: Karel
author_rank: Super Contributor
timestamp: October 17, 2015, 07:27:33 am
content: Quote from: Hypernova on October 17, 2015, 07:01:15 amIt depends on the application. For example, most of the times when using delta sigma converters,the analog anti-aliasing filter can be as simple as a single pole rc-filter.Also, in some applications there are not much high-frequency components, like in biomedical appliances such as ECG and EEG.Just a simple rc filter in order to block radio interference is usually sufficient.In other words, it depends on how much out of band frequency components are to be expected and how strong they are.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 17, 2015, 07:41:43 am
content: A digital filtering can only be applied directly to information, not for example to smooth out a power rail. Yeah I guess that can be argued, but passive analogue filters remove energy from a signal to achieve their aim, while active filters can also inject energy into a signal (e.g boost a selected frequency) - but a digital filter just crunches numbers.Analogue filters have superior dynamic range (e.g an RC filter works a well with a 10V signal as a 1uV signal), as well as superior bandwidth - a 100Hz low pass filter might still filter into the MHz range. But the also have performance limits like phase shifts that are very hard to remove.Digital filters offer superior performance in parameters like roll-off and ripple (e.g can seperate a 100.1 Hz signal from a 99.9 Hz signal with 96db), and offer a lot more flexibility in transfer characteristics, allowing control of both phase and amplitufe, but they have far less dynamic range (only 6db per bit), and have bandwidth limitations that prevent them working with frequencies over half the sample rate.Digital filters also have the unpleasant side effect that if signals from outside of the bandwidth limit enter the system they break.and create false signals. This is why there is always an analogue low pass filter in front of a digital system. In some ways this is the opposite of an overdriven active analogue filter, that creates high frequency noise while distorting the output.On other important thing is that analogue filters can only be adjusted though changing the electrical properties of a physical component (e.g a variable capacitor, a pot or a tuning coil) where at a digital filter can be changed quite radically just be altering the filter coefficients.

author: MrAl
author_rank: Super Contributor
timestamp: October 17, 2015, 03:22:23 pm
content: Hello there,Most basically, a single LC filter is only second order while a digital filter can have an order much higher and thus provide for much sharper tuning. It can also be adjusted on the fly during the real time operation of the system, which is much harder to do with a fixed L and fixed C filter.Digital filters usually have an ADC front end however, and the ADC often requires some sort of anti aliasing because the sample rate could sync with the input signal and thus end up giving readings for only one particular phase of the input signal. So a small filter in hardware is often used as the pre-filter to help avoid this.

author: Galenbo
author_rank: Super Contributor
timestamp: October 17, 2015, 03:32:28 pm
content: As said, a (simple) analog filter is always used before a digital filter, and often the signal is digitalised afterwards anyway. (Cd DVD USB TV...)So in most designs, it won't be a AorD question, but a decision ofhowto combine A+D.

author: Marco
author_rank: Super Contributor
timestamp: October 17, 2015, 05:13:35 pm
content: Quote from: rwgast_lowlevellogicdesin on October 17, 2015, 05:07:09 amSwitching regulators already try to maintain the supply voltage at high switching frequencies to keep the passives small, the attiny would add nothing. Or if you don't care about efficiency and just want to remove ripple from a traditional rectified transformer the attiny couldn't beat a linear regulator at it's own game either.QuoteThe only power supply filtering you will have on most boards is decoupling and sometimes noise filters, a 100 nF decoupling cap has GHz of bandwidth which your attiny won't have and the attiny would introduce noise rather than remove it.QuoteRF digital processing isn't a horrible idea, but it is rather cutting edge, you need ridiculously high frequency ADCs and signal processing. IF digital processing is more common.QuoteCommon mode filters have two opposite direction inductors on the same core, if the currents in those inductors are equal there is a net 0 magnetic field in the core so it won't saturate. Only the common mode current (ie. the difference between incoming and outgoing current) "sees" inductance and will thus be attenuated.Without this common mode setup you would require physically much larger inductors for the same inductance because of the DC currents.You need to brush up on the basics, you lack a feel for the underlying physics of electronics at the moment.

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: October 17, 2015, 05:15:19 pm
content: Ok I understand now, digital is basically a way to give an analog filter a brick wall characteristic so they complement each other and really are only applicable in situations where you want to filter data. So analog still has its purpose, but this is nice to know when trying to clean up an ADC input. Ive always tapped the analog power off its own regulator with a small point to the digital ground and used RC filters on lines and references. Using DSP could greatly improve precision applications using mixed signals?Lets say your working on a precision measurement tool, for electronic.. maybe you want 16 bit resolution at the least, and you use a good 5v reference on the ADC. Would this be a good use case for implementing DSP after the AtoD, or would a regular hi order analog filter be better? I would think think DSP would be better since it introduces no new noise in to the overall system, while resistors and op amps will? Lets just for example through a precision instrument out there like a kiethly smu. I mean I dont consider this data as far as audio or RF, but it is still a 0 to 5v to 5v signal getting digitized that needs a high degree of precision. I guess the question is what is the best way to get a good clean analog DC level in to an AtoD with h i resolution and low noise floor.And would anyone out there have any good links to using DSP or RF in a more general term than Ossmans videos (these are great, and Ossman is just a smart guy). Lets say you do something like a simple RC filter in to an ADC with and appropriate bandwidth then in to a micro and back out a DAC so you theoretically filter the RF and get an analog output that would work with any analog radio, or is this stupid and impossible?

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: October 17, 2015, 05:24:29 pm
content: Oh I know im no analog EE engineer, I do understand filtering and and even actually know what cap sizes cut off at what frequency's for decoupling. What I am new to is RF and digital filtering and A to D sampling for anything other than simple DC sensors. Like I said I have always tried to use appropriate ground techniques along with adequate analog filtering weather that be passive of active. Its hard to always understand everythingand in 5 years of electrical/electronics this is the first time Ive thought of any type of digital filtering other than a simple average.I guess I just wasnt thinking obviously the a to d in an attiny cant sample fast enough to filter most anything usefull than LF, im not even sure what an AVR adc's sample rate is, If im doing more than reading battery voltage I use an dedicated chip, layed out to reject as much digital crap as possible as mentioned in the post above.

author: hamster_nz
author_rank: Super Contributor
timestamp: October 17, 2015, 05:49:32 pm
content: Oh, about the best thing you can do as a newbie to DSP is download a few chapters of the book fromhttp://dspguide.com/pdfbook.htmand get reading!Gosh - this sounds like clickbait spam, but in this case it isn't - it really is a free book on the basics of DSP.

author: hagster
author_rank: Frequent Contributor
timestamp: October 17, 2015, 07:58:27 pm
content: Quote from: hamster_nz on October 17, 2015, 05:49:32 pmYes, that's a good book.

author: codeboy2k
author_rank: Super Contributor
timestamp: October 18, 2015, 12:40:50 am
content: I could not get much of that site to work for me. Page not found errors, "server refused connection", and clicks that do nothing...So I found it here on Analog's site too:http://www.analog.com/en/education/education-library/scientist_engineers_guide.html

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: October 18, 2015, 05:21:45 am
content: Wow thanks for the link I never new analog devices had all this educational stuff!!!

author: codeboy2k
author_rank: Super Contributor
timestamp: October 18, 2015, 05:47:17 am
content: Yes, Analog Devices has some great educational material on their site. Look up the Analog Dialogue too, a series of app notes from their applications engineers that goes back to 1967 !http://www.analog.com/library/analogDialogue/index.html

author: rwgast_lowlevellogicdesin
author_rank: Frequent Contributor
timestamp: October 18, 2015, 02:59:01 pm
content: Im always excited to get the LT journal, but they come in the mail so rare that when I do get them if there about something I have no intrest in I get a little upset lol. These are great resources! Really thank you for sharing these links. I think I heard an amphour where Chris and Ossman were hosting, and they mentioned this stuff but I haven't been able to remember the mixed signal engineer they had as a guest and I haven't been able to find the podcast again for these resources.Great stuff