Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How can I create a digital filter in practice?

Status
Not open for further replies.

matrixofdynamism

Advanced Member level 2
Joined
Apr 17, 2011
Messages
593
Helped
24
Reputation
48
Reaction score
23
Trophy points
1,298
Activity points
7,681
I have created and "experienced" analogue filters made using passive components and op-amps. I also created a 6th order buuterworth low pass filter using OPA series op-amps. It was immense fun.

I now want to create digital filter and by doing so experience and understand how digital filter creation works and see one in practice (havne't done so in life yet :( ).

Lets take an example. I want to create a LPF with 40kHz cut-off frequency. Now I decide to create it using FIR filter topology. Where do I go next?
 

Nowardays, except if the goal is to learn the concept step by step, we no longer have to deal with the theory behind how this is done to implement digital filters in practice, but we just insert the performance parameters in one of the available online tools on the web and take the C code there, ready to use. The main thing you need to know is that the sampling frequency must be exactly the same with which the filter will work, once it was considered when its parameters were calculated.
 
Actually the goal in my case actually is to experience the process step by step
 

I think that MATLAB/Scilab are nice tools to get you introduced to the funamentals.
There are a lot of functions, aswell toolboxes related to that subject there.
Anyway, this don't release you from reading online tutorials covering the subject in deep.
 

There are two types of digital filters. So start by googling two terms:

Finite Impulse Response filters. Also called non-recursive filters.
Infinite Impulse Response filters. Also called recursive filters.

But before you do that............are you familiar with sampling theory, aliasing and the Z-transform?
 

Hi,

Before you can use a digital filter, you need digital data.
Where do you get it from?
Do you use an ADC? Are there analog filters used, or oversampling...maybe undersampling...
What data rate, what bit width?

And what after the filter?

Do you know about biquads? If not, then read about them.

*******

Digital filters are everywhere. Sometimes you don't recognize them as filters.
Audio, delay, echo, sound.....
Oversampling in an UART. Debouncing of digital inputs. Averaging of any values. PID regulation loops.
Changing brightness, contrast, or anything other in a picture

Once you know how they work you will use them many times..

Klaus
 

An analog LPF is equivalent to a digital IIR filter. In some ways it may be easier to start there. Here is a specific example of a single pole digital RC filter equivalent:

y = a*x[n] + (1-a)*y[n-1]
Or in words: [next output] = a*[incoming sample] + (1-a) * [previous output]

Where a is a constant ranging from 0-1 that sets your time constant:
Tc = RC = [clock period]*(1-a)/a

You can see that if a is small the impact of the incoming sample is small compared to the previous state, this creates a low cutoff frequency.

As other people have said in regards to your original question there are many types of digital filters. Even a simple average is a form of FIR filter. It's a very deep subject but it's not hard to get a grasp on some of the pieces.
 
asdf44, I am confused when looking into DSP books. They talk of Fourier Series, Fourier Transform then FFT and then go into filters and filters are of FIR and IIR type and then there are so many topologies and then there are these enigmatic things called windows and then there are so many ways to design filters so so so many ways. I am lost.

I took a dip but getting no where I posted this question.
 

They talk of Fourier Series, Fourier Transform then FFT and then go into filters and filters are of FIR and IIR type and then there are so many topologies and then there are these enigmatic things called windows
The topics are in fact closely related when learning about digital filters. You can hardly bypass it if you want to get a deeper understanding.

asdf44 however suggests a simple problem to start with, designing the digital equivalent of a first order analog filter. Try to follow his considerations, simulate the behavior of the simple filter with pencil and paper method or in a spreadsheet calculator. If you see how it works, you may continue with second order IIR. Or small FIR.
 

Yes well it's a very deep subject. So that's to be expected.

If you want more help it would be useful to know what platform and application you have in mind. For example FIR, which you cited tend to be computationally more intensive and tend to add time delay. So you're less likely to find them on microcontrollers or FPGAs in many common real-time applications.

Second your strategy should be to become familiar with one type of filter and one implementation and learn a set of tools to manipulate that. If we know the application we can point you to examples for that.

When I was starting I got a lot of use out of PSIM which is a spice-like circuit simulator that also crosses over into control and signal processing. They have a free version.

When I started I literally dropped down an R and C in PSIM. Then I put their single pole filter block next to that and verified it was the same. Then an S-domain block (after calculating the coefficients). Then a z-domain IIR block. Then I constructed my own IIR implementation with discrete additions and multiplies. Having that progression all in one place was extremely useful and no single step was particularly large.
 

Yes, digital filter theory can be quite deep.

That is the reason that myself and other posters have stated, you must be thoroughly acquainted with sampling theory, and be comfortable with the equations required to express the signals and systems used in the sampled domain.

Many years ago, I was introduced to the subject by a book called "DSP without tears" if I remember the title correctly.
It provided a basic overview which allowed one to become conversant with sampled systems. It also came with a 5 1/4" floppy, which would install a simple DOS-based program, which would allow you to actually write and evaluate different DSP functions.

Once that you master it, you can then plunge deep into the heavy stuff.

But the real thrill is when one actually writes some simple code, feeds it into an actual evaluation board and watching it to work. I can still remember the elation of creating a simple, low tap count FIR low pass filter. Then speaking to a microphone, and listening to the change in the response on a speaker!!!
 
Hi,
You can use Mathlab digital filter package. Result will be better if you familiar with filter theory. However reviewing help and examples you can achieve appropriated result as well
Thank you
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top