2

Author Topic: Butterworth Filter for PC, Need code references and notes  (Read 972 times)

0 Members and 1 Guest are viewing this topic.

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Butterworth Filter for PC, Need code references and notes
« on: August 22, 2012, 12:12:21 PM »
Hallo guys,

For once more I need your expertise in this matter. I need to implement a Butterworth filter in a PC application I am building.
I know google is full of references and I already have some materials to work on, but more in never bad.

So I am practically asking you, if you know any videos/sites/.pdf etc that you have used and you were satisfied with.

I know that there are other filters like Chebychev and Elliptic filters but I don't really need that fast of a response plus the ripple like
behaviour would be good for my project.

So thank you in advance for any replies,
My best regards,
Lefteris, Greece (still in Germany... ahem  :P )
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,935
  • Helpful? 98
Re: Butterworth Filter for PC, Need code references and notes
« Reply #1 on: August 22, 2012, 06:42:29 PM »
Cut-off frequency?
Passive or Active?
Number of Poles?

Microchip has a interactive design app for designing Active filters (using Op-amps).
Maybe this help.

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Re: Butterworth Filter for PC, Need code references and notes
« Reply #2 on: August 22, 2012, 07:11:14 PM »
Thank you for your reply!

It's not that I don't know how to do the math but thank you, I don't know the cut off frequency yet, I'll have  to find it out,
and that's going to be an experimentation process. I don't even know the order of the filter I am going to use yet.

And it's neither a passive nor an active design, it's going to be a digital filter, that's why I said PC application.
All the data are passed to the PC application and then I am going to build/code a low pass Butterworth.
And probably I'll go for a high order butterworth, I need it to have a very fast response and only smooth out
the switching noise from the electronics.

But thanks for the reply anyhow :-D


Best Regards,
Lefteris, Greece
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,935
  • Helpful? 98
Re: Butterworth Filter for PC, Need code references and notes
« Reply #3 on: August 24, 2012, 05:56:21 PM »
Ahh...I took "PC application" as meaning you wanted to filter a signal going to the PC (like the Audio input) with hardware.

What need to look for are algorithms for IIR and FIR filters. These should be covered in any good book (or web site) on DSP (Digital Signal Processing). These filters can be calculated for any of the response types including Butterworth.
Sorry I can't help more than that.

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Re: Butterworth Filter for PC, Need code references and notes
« Reply #4 on: August 26, 2012, 09:31:42 AM »
Don't be, I wasn't asking for a solution just some suggestions,

From my research it seems that the only thing to do is to take the Butterworth polynomials and turn them from the infinite s plane
to the cycle z plane with this transformation:

s = (1/K)*((z - 1)/(z + 1)) where K = tan(pi * Fc / Fs), where Fc is the cut-off frequency and Fs is the sampling frequency.

Also from my research I have found out that it's better when you want a higher order filter to cascade smaller order filters
than to take the direct equation for the sake of floating point maths in computers.

That's all for now, if someone knows something more or/and can correct me if I am wrong, please by all means!

Best Regards,
Lefteris, Greece
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

Offline Billy

  • Full Member
  • ***
  • Posts: 110
  • Helpful? 2
Re: Butterworth Filter for PC, Need code references and notes
« Reply #5 on: August 29, 2012, 02:53:23 PM »
Here is a link to a book that has code samples. Although you can download the book for free, I bought a hard copy and was very happy with it.
http://www.dspguide.com/

Anyone that wants to do anything with sensors and microcontrollers would be well served to spend some time with this book. It is well written and the material presented in a very pragmatic way. Limited math and with complex ideas presented in simple way.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,935
  • Helpful? 98
Re: Butterworth Filter for PC, Need code references and notes
« Reply #6 on: August 29, 2012, 06:14:22 PM »
Nice one Billy.

Offline TrickyNekroTopic starter

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,207
  • Helpful? 15
  • 1.6L Peugeot 307 tuner
Re: Butterworth Filter for PC, Need code references and notes
« Reply #7 on: August 29, 2012, 08:31:43 PM »
Thanks Billy,

I got the whole thing working by now and when I am finished I'll try to document it with examples.
The good thing is that generally I document good enough what I am doing now cause it's all about my thesis.
So expect some stuff after October from me :-D

Thanks again!
Best Regards,
Lefteris, Greece
For whom the interrupts toll...


P.S. I've been inactive for almost a year... Don't give promises but I'll try to complete my tutorials. I'll let you know when..

Cheers!

 


Get Your Ad Here