CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Bandpass filter

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
prayami



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

Bandpass filter
PostPosted: Thu Apr 21, 2005 4:28 pm     Reply with quote

Hi..

We want to make band pass filter to pass 1KHz to 20Khz frequency.
This is to eliminate noise.
Is there any Microchip processor that CCS support have internal band
pass filter. Or we need to make software band pass filter.
How can we make software bandpass filter?
We don't want to use any external hardware IC to reduce cost.

Any advice appreciated....
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Thu Apr 21, 2005 4:59 pm     Reply with quote

Just shots in the dark because your post doesn't have enough information to be specific:

No PICs (to my knowledge) have built-in filtering hardware. You will have to do it with code.

You might be able to use a dsPIC and make a bandpass FIR filter. Depending on the number of taps you need you might be able to use an 18F part but probably can't get the 20kHz upper cut-off frequency. The number of taps in the FIR filter will be determined by the passband and stopband parameters which you didn't specify.

In fact for most PICs except some of the newer 18F's if you plan to sample the analog signal with the PIC, you are going to be out of luck sampling faster than 30ksps. There are some PICs that can hit 100ksps.

How cost sensitive is your design? I know you said you didn't want a hardware solution but a dual op-amp and about 5 resistors and 5 capacitors will get you an analog 2nd order bandpass filter. You could also get switched capacitor filter blocks from Linear Tech and Maxim that might do the job.

You can build very nice passive bandpass filters with RLC circuits too.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
prayami



Joined: 22 Dec 2004
Posts: 78

View user's profile Send private message

PostPosted: Thu Apr 21, 2005 8:04 pm     Reply with quote

Hi..

We want to pass frequency between 1KHz to 20KHz. We want to stop
frequency below1KHz and frequency above 20KHz. Is passband and stopband
parameters are different than this one then please let me know what is that?

Not only cost but we don't want to go for hardware because it reduces
the accuracy.

If we use PIC18, How much upper cutoff frequency we can get?
How exactly we can do it in the software? Is there any coding for that?
If you can then please send some sample coding so that I can get some
idea.

If we have to use dsPIC and make a bandpass FIR filter, How can we do
that in dsPIC? I don't have any indea. Please specify that as well.

Thanks ......
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Fri Apr 22, 2005 6:24 am     Reply with quote

Quote:
Hi..

We want to make band pass filter to pass 1KHz to 20Khz frequency.
This is to eliminate noise.
Is there any Microchip processor that CCS support have internal band
pass filter. Or we need to make software band pass filter.
How can we make software bandpass filter?
We don't want to use any external hardware IC to reduce cost.

Any advice appreciated....



Unless you can sample at approximately 50K, give up on the idea of filtering at 20K. Sampling theory says that any signal present at higher than half your sampling rate will "alias", or disguise itself as a lower frequency.

The right way to deal with noise at frequencies this high is to analog prefilter. Microchip has the design tools on the website for active filters.

Scott
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Apr 22, 2005 7:43 am     Reply with quote

Even sampling at 50kHz will only allow you to filter out noise up to 30kHz. Noise from 20kHz to 25kHz will be stopped by the filter. Noise from 25kHz to 30kHz will be aliased down to the 20 to 25kHz band and then stopped by the filter. Noise above 30kHz will be aliased down below 20kHz and will go sailing right through!
A cheap simple analog filter is the way to go. What is your "accuracy" requirement? If the low frequency cutoff is 1kHz you clearly don't care about DC offset.
_________________
The search for better is endless. Instead simply find very good and get the job done.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Fri Apr 22, 2005 7:43 am     Reply with quote

prayami wrote:
Hi..

We want to pass frequency between 1KHz to 20KHz. We want to stop
frequency below1KHz and frequency above 20KHz. Is passband and stopband
parameters are different than this one then please let me know what is that?..


Stopband attenuation (upper and lower frequencies)? Passband ripple? Passband attenuation and gain? Sampling frequency, keeping in mind that you need to sample at least 2x the highest frequency you expect to pass but that is the absolute minimum, you would get much better results with 10x to 20x oversampling.

You have a lot of research to do into FIR filters and their design and implementation forms before you can do this and my gut feeling is that a PIC18 running at 40MHz is going to be marginal for this application, if it is even able to perform the function at all.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Fri Apr 22, 2005 7:48 am     Reply with quote

rwyoung wrote:
Sampling frequency, keeping in mind that you need to sample at least 2x the highest frequency you expect to PASS but that is the absolute minimum, you would get much better results with 10x to 20x oversampling.


Acutally it is 2x the highest frequency you expect the software filter to STOP. Except that with aliasing you can actually stop a little higher, as long as everything in the system is linear.
_________________
The search for better is endless. Instead simply find very good and get the job done.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Fri Apr 22, 2005 9:15 am     Reply with quote

SherpaDoug wrote:
rwyoung wrote:
Sampling frequency, keeping in mind that you need to sample at least 2x the highest frequency you expect to PASS but that is the absolute minimum, you would get much better results with 10x to 20x oversampling.


Acutally it is 2x the highest frequency you expect the software filter to STOP. Except that with aliasing you can actually stop a little higher, as long as everything in the system is linear.


Yep, fingers got ahead of brain...
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group