+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Advanced Member level 2
    Points: 4,099, Level: 15
    Achievements:
    7 years registered

    Join Date
    Apr 2011
    Posts
    550
    Helped
    24 / 24
    Points
    4,099
    Level
    15

    How can I create a digital filter in practice?

    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?

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 29,619, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,858
    Helped
    1114 / 1114
    Points
    29,619
    Level
    41
    Blog Entries
    9

    Re: How can I create a digital filter in practice?

    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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )


    1 members found this post helpful.

  3. #3
    Advanced Member level 2
    Points: 4,099, Level: 15
    Achievements:
    7 years registered

    Join Date
    Apr 2011
    Posts
    550
    Helped
    24 / 24
    Points
    4,099
    Level
    15

    Re: How can I create a digital filter in practice?

    Actually the goal in my case actually is to experience the process step by step



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 29,619, Level: 41
    andre_teprom's Avatar
    Join Date
    Nov 2006
    Location
    Brazil
    Posts
    8,858
    Helped
    1114 / 1114
    Points
    29,619
    Level
    41
    Blog Entries
    9

    Re: How can I create a digital filter in practice?

    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.
    --------------------------------------------------------------------------------------------------
    Part of the world that you live in, You are the part that you're giving ( Renaissance )



    •   AltAdvertisement

        
       

  5. #5
    Advanced Member level 5
    Points: 14,929, Level: 29
    schmitt trigger's Avatar
    Join Date
    Apr 2013
    Posts
    2,480
    Helped
    804 / 804
    Points
    14,929
    Level
    29

    Re: How can I create a digital filter in practice?

    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?
    My batteries are recharged by "Helpful Post" ratings.
    If you feel that I've helped you, please indicate it as a Helpful Post



  6. #6
    Super Moderator
    Points: 77,645, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,729
    Helped
    3586 / 3586
    Points
    77,645
    Level
    67

    Re: How can I create a digital filter in practice?

    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



  7. #7
    Advanced Member level 3
    Points: 5,789, Level: 18

    Join Date
    Feb 2014
    Posts
    824
    Helped
    271 / 271
    Points
    5,789
    Level
    18

    Re: How can I create a digital filter in practice?

    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.


    1 members found this post helpful.

  8. #8
    Advanced Member level 2
    Points: 4,099, Level: 15
    Achievements:
    7 years registered

    Join Date
    Apr 2011
    Posts
    550
    Helped
    24 / 24
    Points
    4,099
    Level
    15

    Re: How can I create a digital filter in practice?

    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.



  9. #9
    Super Moderator
    Points: 260,175, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    45,436
    Helped
    13823 / 13823
    Points
    260,175
    Level
    100

    Re: How can I create a digital filter in practice?

    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.



  10. #10
    Advanced Member level 3
    Points: 5,789, Level: 18

    Join Date
    Feb 2014
    Posts
    824
    Helped
    271 / 271
    Points
    5,789
    Level
    18

    Re: How can I create a digital filter in practice?

    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.



  11. #11
    Advanced Member level 5
    Points: 14,929, Level: 29
    schmitt trigger's Avatar
    Join Date
    Apr 2013
    Posts
    2,480
    Helped
    804 / 804
    Points
    14,929
    Level
    29

    Re: How can I create a digital filter in practice?

    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!!!
    My batteries are recharged by "Helpful Post" ratings.
    If you feel that I've helped you, please indicate it as a Helpful Post


    1 members found this post helpful.

    •   AltAdvertisement

        
       

  12. #12
    Full Member level 1
    Points: 2,527, Level: 11
    Achievements:
    7 years registered

    Join Date
    Jun 2008
    Posts
    116
    Helped
    2 / 2
    Points
    2,527
    Level
    11

    Re: How can I create a digital filter in practice?

    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


    1 members found this post helpful.

--[[ ]]--