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 CCS Technical Support

Adaptative filter?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Mon Sep 12, 2005 10:23 am     Reply with quote

Quote:
Again, how fast are you sampling, and what RC values are you using? Just because the RC you've chosen isn't doing the job, it doesn't mean that an analog filter isn't the right approach.


Hi Scott,

I am sampling at 40hz... started using 1k and 15uF and it had slow response. Now it is 1k and 1uF but I didn't test it yet as I am working on the GUI code.

I dont know much about the theory of filters as you can see.

The idea is to have a filter that can go from heavy filtering to no filtering through a 'software command'.
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Mon Sep 12, 2005 12:08 pm     Reply with quote

future wrote:
Quote:
Again, how fast are you sampling, and what RC values are you using? Just because the RC you've chosen isn't doing the job, it doesn't mean that an analog filter isn't the right approach.


Hi Scott,

I am sampling at 40hz... started using 1k and 15uF and it had slow response. Now it is 1k and 1uF but I didn't test it yet as I am working on the GUI code.

I dont know much about the theory of filters as you can see.

The idea is to have a filter that can go from heavy filtering to no filtering through a 'software command'.


Sampling theory says that you can't represent signals faster than 20Hz when you sample at 40Hz, and that's for the mathematically ideal case. Practically, I'd think your pushing it at about 16-18 Hz. Any signals above 20Hz will be aliased, or disguised as a lower frequency.

The 15uF cap gives you a 10Hz filter, which is about what where you want it when using for a 40Hz sampling rate. The time constant is at 15ms, which means that a step response (your DC change) will take about 45 ms to asymptote, or less than 2 samples at 40Hz.

You can use a multi-pole filter at about 15 Hz, and some more signal will get through, but if you need less than 2 samples at your current frequency to respond to your DC change, you need to sample faster.

Again, practically, your system cannot respond reliably to any frequencies faster than about 40% of your sample rate--period. No filter, adaptive or otherwise, can do any better. Higher frequencies on your input will disguise themselves as lowere frequencies. For your system, it seems absolutely critical to take care of this right at the input stage, as I don't think a simple RC filter will provide you with the attenuation you need to prevent aliasing. In other words, when you complain about slow changes, I think you are having high frequencies not stopped by your RC filter disguising themselves as low frequencies. No digital signal processing technique in the world can fix this--if this is what's happening, its a mathematical certainty that can't be avoided. You need to fix this BEFORE you sample, not after. Changing your capacitor value the way you describe will only make it worse.

The answer-- get yourself a good 8-pole filter chip, clocked or otherwise, and tune it to about 15 Hz. Then see if your response looks any better. If you go with a clocked filter, you need to provide a clock of the proper frequency to drive it. If you use an analog filter, your resistors will be big, in the Megaohm range.

Also, consider sampling at least an order of magnitude faster (i.e., 400Hz), and leave your RC in place. You'll then have at least 20dB attenuation of frequencies above the Nyquist frequency (half your sample rate), which still isn't great, but its much better than what you have now. If your problem gets a little better, this is evidence that your problem is aliasing. If you can sample faster, this might be all the help you need.


Scott
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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