Low frequency audio level detector using PIC ADC?


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

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

    what is your device ID and REV?
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  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 cncmachineguy View Post
    what is your device ID and REV?
    I don't know...and it's possible they've fixed the problem for the ones I have (purchased just a couple of weeks ago)

    I use a Pickit2 programmer & can't seem to find anything that tells me such device info?

    In the light of needing more 'main loop time', I've actually just cranked the Oscillator up to 16Mhz...and the ADC aspect still seems to be working ok.
    Last edited by HankMcSpank; - 24th February 2011 at 21:55.

  3. #3
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

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

    Per the errata, they have fixed it for all current stuff. So unless your supplier has old stock, you are prolly good. I didn't think to look at the date on the errata, that may shed some light on if it will work. It sounded like it will either work or not. It didn't sound like it could be interminent.

    And remember to change your ccpr values to reflect the faster clock. - unless you want to double the samples
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  4. #4
    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 cncmachineguy View Post
    Per the errata, they have fixed it for all current stuff. So unless your supplier has old stock, you are prolly good. I didn't think to look at the date on the errata, that may shed some light on if it will work. It sounded like it will either work or not. It didn't sound like it could be interminent.

    And remember to change your ccpr values to reflect the faster clock. - unless you want to double the samples
    Thanks Bert - Actually, I think we're done here would you believe! (Bert sighs in relief!)

    I've aborted any attempt to confirm the sampling rate & have reasonable faith in our calculations! I've got the PIC Internal Oscillator running at 16 Mhz, and a special event trigger frequency of of 16Khz (ADC sample rate ), ie Timer1 matching against this....

    CCPR4H = 0
    CCPR4L = 250

    (16Mhz clock, 4Mhz Instruction = 0.00000025sec period, therefore 250 x 0.00000025 = 0.0000625 sec .....so 1/0.0000625 sec= 16Khz)

    ....I've integrated the 'peak detect' code above into the final destination main loop - I've scoped a pin toggling within my my main loop @50khz which means it's looping at 100khz (so plenty of time to do other stuff in the main loop if I so desire). I don't use any interrupts except for switch presses,...and when a switch is pressed, I'm not worried about losing ADC samples.

    ...just connected it up to my guitar (vs the sig gen I've been testing with)....it's working as expected

    A *very* happy Hank...thanks for all your input.
    Last edited by HankMcSpank; - 24th February 2011 at 23:46.

  5. #5
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

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

    Quote Originally Posted by HankMcSpank View Post
    Thanks Bert - Actually, I think we're done here would you believe! (Bert sighs in relief!)
    No sigh at all Hank, I really enjoy these kinds of threads. Lots of new things learned by all. I don't seem to have the imagination or desire to make such projects, but I LOVE thinking about them.

    So Thank YOU and I look forward to your next one.

    BTW, I agree you should consider making a WIKI of this. Your coding is fine, as Dave said you underestimate yourself. I do get the time aspect of it.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,116


    Did you find this post helpful? Yes | No

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

    Thumbs up from me too.

    Good idea with just a few components and clever programming. To the Wiki absolutely!

    Ioannis

  7. #7
    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?

    Back at post #42 there is a picture of a square wave, (not so square wave) and a comment about how bad it looks. The wave looks like this because it has just passed through a capacitor. (A high pass filter) (DC blocking capacitor)

    What are you trying to do? Measure the output of your electric guitar in peak response mode?

    For long before I was born, audio has been measured in two modes.

    Average mode: Full wave rectify. Then use a 2hz low pass filter. The response time is set to about the spoken syllable rate. (half wave produces little error)

    Peak mode: Full wave rectify. Use a filter with an attack time of 1.7mS and a decay time of 660mS. You need the 1.7mS attack time or any very small peak will peg you meter but you ear can not hear that small peak.

    Do you want RMS response?

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