Author Topic: µC ADC for audio  (Read 5103 times)

0 Members and 1 Guest are viewing this topic.

Offline thekhakinator

  • Contributor
  • Posts: 10
µC ADC for audio
« on: May 15, 2013, 10:08:55 am »
I'm working on a basic audio project at the moment, doing some very basic DSP. I chose to go with a dsPIC33FJ64GP802, as it's got a 16-bit audio DAC built in, as well as 12-bit ADC. However, I'm having major issues. Building on protoboard, I've been able to get a nice clean output from the DAC fed with a ramp function, however, when I use the inbuilt ADC to sample audio for the DAC, I'm having significant noise issues. The audio is passed through clearly but with significant noise added; unfortunately I lack a spectrum analyser to further characterise the noise beyond "it sounds white".

I've got a basic inverting op-amp stage to create some gain for the low-level signal from the magnetic pickups going into the ADC. However when this is driven straight into an amp, no noise is apparent. I eventually traced the source of the noise to the PIC's ADC itself - even when the ADC is held directly at a constant voltage (either the PIC's 3.3V supply or some split rail on a resistor divider) the ADC output is quite noisy. I'm not sure why this could be; I'm fairly confident I've set up the PIC correctly with all the necessary analog reference voltages, etc.

I have heard a lot from experienced hands on forums about "splitting analog and digital ground". Is this relevant at all? How does one achieve that? What other sources of noise on an ADC could be causing these issues?
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4566
  • Country: au
  • Question Everything... Except This Statement
Re: µC ADC for audio
« Reply #1 on: May 15, 2013, 10:19:19 am »
when you are getting into 12 bit accuracy, your probably bitten pretty hard with the datasheet to begin with,

the analog ground should be separate and clean, compared to the digital ground, as even a few hundred uA current pulse from the micro is going to throw you off quite a few bits on your reading, then depending on how large the error, you can get into some quite fancy improvements, but still the adc's specs may be biting you in the backside here,
 

Offline thekhakinator

  • Contributor
  • Posts: 10
Re: µC ADC for audio
« Reply #2 on: May 15, 2013, 10:28:29 am »
Yeah, I've heard as much - digital circuits with their fast switching (my dsPIC runs at 40MHz) can create a lot of noise; but how does one "separate" the grounds? To read the incoming audio voltage the PIC must have a ground reference of some sort?
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 19360
  • Country: nl
    • NCT Developments
Re: µC ADC for audio
« Reply #3 on: May 15, 2013, 05:49:48 pm »
First rule: don't split grounds. Just connect them together in a better way (a solid plane for example). You can still run into problems but you can avoid those by putting all the analog circuitry together and make sure no big/noisy currents have to run across the part where the analog circuitry is located.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 949
  • Country: pt
    • My AVR tutorials
Re: µC ADC for audio
« Reply #4 on: May 15, 2013, 07:08:53 pm »
What reference are you using?
Having the ADC oscillating with a dc signal can't be normal, are you using all the recommended decoupling caps, good capacitance in the power supply?
Maybe using a good external reference might help and putting the micro in sleep mode when doing the adc conversions.
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 6092
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: µC ADC for audio
« Reply #5 on: May 17, 2013, 03:27:31 am »
Run the ADC several times the sample rate, then average samples together.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline thekhakinator

  • Contributor
  • Posts: 10
Re: µC ADC for audio
« Reply #6 on: May 19, 2013, 07:34:32 am »
Thanks for the suggestions guys, unfortunately though none were the solution!

Actually found the real, bigger problem. The noise is coming from the dspic33FJ64GP802 DAC. The chip has an on-board 16 bit audio DAC which, unfortunately, is not very good. We've set it up with the reference design op-amp output buffer. When the DAC output voltage is increased to a certain point, done by setting the DAC output buffer to a manual value in the code, noise becomes a significant part of the signal. This is very strange behaviour, setting the DAC output buffer above approx. 2000 (16-bit buffer max is 65535) gives noisy output when it should be holding a constant DC value.

This is quite frustrating. Extensive Google research has found many a thread titled "dspic Audio DAC Noise" but no real solutions. :/
« Last Edit: May 19, 2013, 10:36:15 am by thekhakinator »
 

Offline smashIt

  • Contributor
  • Posts: 30
Re: µC ADC for audio
« Reply #7 on: May 20, 2013, 02:05:43 pm »
according to the datasheet the DACs will use a backup-value if you can't keep the buffer filled
could it be that what you are seeing is not noise but the alternating between your value and the backup-value?
 

Offline thekhakinator

  • Contributor
  • Posts: 10
Re: µC ADC for audio
« Reply #8 on: May 21, 2013, 03:58:23 am »
Yeah, checked into that. I set the value identical to the backup value, so no matter what the DAC would always be sitting at the same point and unfortunately no improvement.

Cheers anyway. I've ordered some DAC chips and am currently experimenting with a super-ancient 1980s Burr Brown DAC-85, see how that goes. If I've still got this amount of noise then, then I'm gonna have to go back and think about what I'm doing with my life.  :P
 

Offline Rasz

  • Super Contributor
  • ***
  • Posts: 2352
  • Country: 00
    • My random blog.
Re: µC ADC for audio
« Reply #9 on: May 21, 2013, 05:18:08 am »
for the DAC, I'm having significant noise issues. The audio is passed through clearly but with significant noise added; unfortunately I lack a spectrum analyser to further characterise the noise beyond "it sounds white".

Audacity + fft will at least give you a general idea
Who logs in to gdm? Not I, said the duck.
My fireplace is on fire, but in all the wrong places.
 

Offline thekhakinator

  • Contributor
  • Posts: 10
Re: µC ADC for audio
« Reply #10 on: May 21, 2013, 08:20:38 am »
Ah, good tip. I may try that.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf