Audio input into PIC ADC

Discussion in 'Embedded Systems and Microcontrollers' started by Synaps3, May 23, 2015.

  1. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    I have a line level 800mV audio source and I want to use it with a PIC ADC input pin as a very crude VU meter (I know it won't use the full range). Will this pull down the voltage too much? I want to be able to still use the audio afterward without lowering the amplitude.
     
  2. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    I only need this to detect an audio signal. It doesn't really 'need' to be a VU meter. I just want to be sure it is not going to effect the audio level.

    Do I need to rectify the audio signal or does it not matter?

    Can I just hook up directly to ADC pin?
     
    Last edited: May 23, 2015
  3. upand_at_them

    Active Member

    May 15, 2010
    246
    29
    I would buffer it through an op-amp with gain so that you get better resolution on the ADC and so that you don't load down the signal source.
     
    djsfantasi likes this.
  4. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    I’ve read into a digital pin and rectified it.
    I wasn’t sure it was a good idea to supply anything that can swing below zero, and your Pic ADC should read 0-5 Volts.
    Prior to rectifying it, you could use a potentiometer to bias the audio signal.
    I used LM358 to drive a condenser mic.
     
  5. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    [​IMG]

    I found this posted somewhere. Does this need to be altered for a 800mV audio signal and 3.3V microcontroller? I've seen a version with 3.3uF, 10uF and 100uF caps. What should I use?

    Also do you think this will lower the audio volume at all?
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,418
    3,355
    Use 10μF.
    The audio volume will be ok.
     
  7. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    Sounds good (no pun intended), but what does changing the value of C do exactly?

    I am guessing there is some frequency cutoff. What is it?
     
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,632
    224
    I'd have thought that the best input conditioning would be a "lossy peak detector" with rectification, so that you wouldn't have to catch the audio wave at its peak in order to get a measure of maximum amplitude. As for "I want to be able to still use the audio afterward without lowering the amplitude", that might depend on the output impedance of whatever supplies the signal.

    Edited to say somehow I wrote "sample and hold" when I meant "peak detector". Big duh for that one. Fixed now.
     
    Last edited: May 23, 2015
  9. MrChips

    Moderator

    Oct 2, 2009
    12,418
    3,355
    Yes there is. It is all about impedance.
    The source has output impedance. The ADC has input impedance. In an ideal case you want the output impedance to be low and the input impedance to be high.

    Your circuit has two 10k resistors in order to bias the signal to mid point between Vdd and GND. Together this looks like a 5k input impedance. Together with the input C you have a high pass filter. You can determine the cut off frequency for this using fc = 1/(2πRC).
     
  10. Synaps3

    Thread Starter Member

    Jun 5, 2013
    67
    2
    So if the device I'm sending my audio into after the PIC has a rated audio input impedance of 30k, do I need to better match the resistance on the PIC ADC?

    Thanks for helping me. I know these are noobish questions :)
     
  11. MrChips

    Moderator

    Oct 2, 2009
    12,418
    3,355
    No matching required. A high input impedance means that it will not take too much current from the source.
    You will be ok.
     
  12. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    Make R1 & R2 a potentiometer where the ADC and other side of the audio cap connected together are the potentiometer centre pin.
     
Loading...