Low frequency audio level detector using PIC ADC?


Results 1 to 40 of 69

Threaded View

  1. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default Re: Low frequency audio RMS signal level detector using PIC ADC?

    Quote Originally Posted by HankMcSpank View Post
    2. Is this methodology correct....

    setup a time to interrupt at a rate of 10khz
    in the interrupt routine take an ADC sample into a variable, compare it to the last if it's bigger keep it, if it's smaller ignore it.
    run a bit of maths to convert peak voltage to RMS (ie multipy by .0707 using some FP workaround)
    Have another timer setup to reset the ADC sample variable every 20ms (ie 50hz the lowest frequency)
    Actually I think my revised method below will be better....

    (VCC is 5V, AC signal will sit on 2.5V, therefore positive half of cycle samples @10 bits will be between 512 & 1024, negative parts of the cycle will be between 0 & 512)

    1. Setup a timer to interrupt at a rate of 20khz

    2. In the timer interrupt routine take an ADC sample into a variable

    3. Compare the ADC sample to the last sample - if it's higher keep it, if it's smaller ignore it.

    4. If the sample reads below 512 (half VCC - the signal's zero cross), then the highest sample from step 3 is signal 'peak', now zero the variable ready for the next positive cycle (ie samples above 512)

    5. Run a bit of maths to convert peak voltage sample to RMS (ie multipy peak sample by .707 using some FP workaround)


    Anything else?
    Last edited by HankMcSpank; - 16th February 2011 at 12:20.

Members who have read this thread : 0

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