Low frequency audio level detector using PIC ADC?


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

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

    Audio has a large dynamic range. I wanted to get as much range as possible. I needed to “zero” at 512 (10 bit). Resistors at 1% and even 0.1% did not always get me to zero. I also tried resistors to get within 1% of zero and then used the PWM output to move the ˝ voltage point +/- a little. I know in software I could have move the zero point to correct for this error. I wanted to do all the math slightly faster than the ADC could work and there was no time.

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by ronsimpson View Post
    Audio has a large dynamic range. I wanted to get as much range as possible. I needed to “zero” at 512 (10 bit). Resistors at 1% and even 0.1% did not always get me to zero. I also tried resistors to get within 1% of zero and then used the PWM output to move the ˝ voltage point +/- a little. I know in software I could have move the zero point to correct for this error. I wanted to do all the math slightly faster than the ADC could work and there was no time.
    I can live with the 1% (even 2%)....quiescently, I was seeing jitter of just over 1%.(ie readings of 127,127,126,127,17,126, etc)

    The accuracy of your ADC 'zero' point is obviously going to be down to how you approach DC biasing your AC signal feeding into the ADC pin - as a late suggestion, have you tried a DC blocking cap between your AC signal input & your chosen ADC pin? Obviously you then have to rebias the ADC pin - but 2 x 1% tolerance resistors between your PIC VCC & Gnd should ...with the the resistor junction connected to your ADC pin, should get you incredibly close to a reading of 512.

  3. #3
    Join Date
    Oct 2005
    Location
    Loveland CO USA
    Posts
    83


    Did you find this post helpful? Yes | No

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

    127,127,126,127,127,126, etc) APPROX. = 126.67
    If you have a voltage =126.66 in 8 bit mode you will likely get 127 and 126 readings.

    If I use 1% resistors then the error from resistors could be as great as 2%. Typically under 0.5%

    The ADC is not perfect. point 128 may be off a little. Typically it is close but it could be several counts off. I wanted to correct for both resistor and ADC worst case errors.

    Yes I have a DC blocking cap.

    It appears you read in data in 8 bit mode. After rectificaton you have 7 bit data.
    I chose to read in data in 10 bit mode. Rectify to 9 bit data. Loose the LSB to get 8 bit data.
    The math is done in 8 bit mode to keep the speed high.

    In RMS mode I square the 8 bit number to get a 16 bit number that is averaged.

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