New software filter for adc reading


Results 1 to 29 of 29

Threaded View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825

    Default New software filter for adc reading

    To overcome the ADC reading instability, several type of software filters have been devised and
    among these the average, or mean value, is the simpler and most widely used.

    I came to the conclusion that a better method is the MEDIAN and not the MEAN since the average
    incorporate into the final result (the mean) also any anomalous reading due to spikes or other
    electrical noisy phenomenon could occur during the sampling.

    The MEDIAN which is the central value of the frequency distribution of our ADC reading, coincide
    with the mean if the frequency distribution is normal, while the MEAN drift from the MEDIAN
    all the time that anomalous reading are taken.

    Here the contradiction, we make the average to get rid of anomalous reading but we just incorporate
    them, in other words, the mean value is a way to dilute anomalous reading while, the MEDIAN is a mean to
    get rid of them.

    Rock stable results have been obtained extracting the MEDIAN out of 15 consecutive readings, with
    the INCLUDE module "Al_ADC_Median.PBP", which I am glad to post here and share it with the community.

    The use is rather simple, just assign the ADC channel to the channel variable and call the module
    with "GOSUB GetADC" the ADC_Value (word variable) returned, will contain the ADC MEDIAN of 15 reading.

    I have also posted a working code using PIC 12F683 as an example on how to use the include module.

    Place the "Al_ADC_Median.PBP in the PBP folder, add the include to your code and you are done.

    I hope the folks working with analog can find it useful. Comments on the subject and on the stability
    of the MEDIAN filter are welcome.

    Cheer and All the best wishes for the new year.

    Al.

    PS. You need to rename the extention form .TXT to .PBP since I was anable to upload the files with the original extention
    Attached Files Attached Files
    Last edited by aratti; - 5th January 2013 at 22:55.
    All progress began with an idea

Similar Threads

  1. Help with multiple ADC inputs
    By wdmagic in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 4th January 2013, 00: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, 14:33
  3. Filter for PWM
    By Tobias in forum General
    Replies: 1
    Last Post: - 24th August 2008, 10:26
  4. Replies: 3
    Last Post: - 26th November 2006, 21:47
  5. ADC filter
    By leonel in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th May 2005, 17:46

Members who have read this thread : 4

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