New software filter for adc reading


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Quote Originally Posted by Darrel Taylor View Post
    And it's when it's close to the real value then it doesn't move anymore.
    Well, that's sort of the objective of filtering, right?

    But I think I'm getting my head around this - it's an issue of the SIZE of change needed to make an impact on the reading. So if there is no averaging, a change is recorded when the reading changes by a whole number value of 1. If you are averaging 4 readings, then the change must be at least a whole number value of 4 before it gets included. With 16 samples, the reading has to change by at least 16 before it registers, and so on. In effect you are not integrating small changes, you are tossing them out... which is sort of where this thread started.

    I think I'd better revisit several projects where I've used a rolling average, although I don't believe I've ever used more than 4 samples.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    You need to use floats whatever the sample are.

    Ioannis

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Interesting thread!
    A while back (2+ years as it turns out) I did some work on a "general purpose" low pass filter routine which, like many projects, never really made it to the finish line.
    I based it on one of Tracy Allens filter routines and it's basically that 15/16 type filter disussed in later posts of the thread - with some adjustments. With my version you're able to select one out of 9 different filter constants and it handles negative values (two's complement). Seeing the dissusions here on that type of filter not converging properly, I tool a look at the old plots I did while testing and the output of my filter does seem to converge to the actual input value:

    Name:  LP_Filter_step.jpg
Views: 11598
Size:  76.4 KB

    It's a bit hard to see in the plot but all "traces" does end up at the actual input value when given enough time, here's a detailed view of the first step of signal:

    Name:  LP_Filter_Step_zoom.jpg
Views: 11594
Size:  69.5 KB

    Finally here's a plot that shows an "ideal" sinewave and that same sine with another sine (f=10x) on top. Then it shows what the filter output looks like at a couple of different filter constants:

    Name:  LP_Filter_sine.jpg
Views: 11572
Size:  60.8 KB

    I should probably note that all of the above tests was performed with "simulated data" ie the waveform fed to the filter was stored in the PIC so no ADC was involved. I don't think that actually makes any difference though.

    If there's any interest in it I can clean it up a bit and post it. It will not be the smallest and most likely not the fastest but it may have other benefits.

    /Henrik.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: New software filter for adc reading

    Moved posts pertaining to my jitter issue over to here:

    https://www.picbasic.co.uk/forum/sho...ng-ADC-capture
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

Similar Threads

  1. Help with multiple ADC inputs
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th January 2013, 01:27
  2. Need help on ADC : Software R/C filter
    By luminas in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th November 2010, 15:33
  3. Filter for PWM
    By Tobias in forum General
    Replies: 1
    Last Post: - 24th August 2008, 11:26
  4. Replies: 3
    Last Post: - 26th November 2006, 22:47
  5. ADC filter
    By leonel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th May 2005, 18:46

Members who have read this thread : 7

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts