Author Topic: Mono Audio DAC for ~20Mhz Microcontroller Synthesizer  (Read 3671 times)

0 Members and 1 Guest are viewing this topic.

Offline jim5192Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
  • "Brains!"
Mono Audio DAC for ~20Mhz Microcontroller Synthesizer
« on: January 14, 2012, 10:50:05 PM »
I have just joined EE senior design class. We have decided on making a synthesizer box with bunches of controls available to us. Ultimately, we would like to be able to output sound analog straight to headphones or external speakers through a 3.5 mm jack (standard headphones plug).

I was looking through parts however, and can't seem to find a suitable audio DAC chip. The microcontroller we are using will be 16 bit architecture due to the error in 8bit calculations for audio. Would it be impossible to get a dac that can convert from digital to analog 1) mono channel or stereo 2) at a data rate of 48Ksamples/second.

Part of the problem might be that I'm not totally sure what I'm looking for. I initially assumed i was looking for something that looked like this in 16-bit form...

http://upload.wikimedia.org/wikipedia/commons/3/32/8_bit_DAC.jpg

....in which each input pin would be a digital output pin of the Microcontroller. But everything with quality output I find either seems to be using advanced communication techniques such as I2C such as the max5541 or SPDIF as seen in this demo...

http://scanlime.org/2011/04/spdif-digital-audio-on-a-microcontroller/

...but this requires much higher communication rates in the Ghz range. Can a microcontroller that's doing a whole bunch of other crap also output a 6Ghz Serial signal. Why is this crap so complex?  There is also this IC that keeps showing up in my searches called the PCM2902 that I can't make heads or tails of. It looks like filter for analog signals but implemented digitally; it's called a DAC but for some reason it has an ADC... what's going on here?

It must be easier than I'm making this, but as per usual, I'm missing something basic when it comes to applications of theoretical EE courses.
"Imagination is more important than knowledge."-Einstein

Offline billhowl

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 32
  • Your success is in your hands.
Re: Mono Audio DAC for ~20Mhz Microcontroller Synthesizer
« Reply #1 on: January 15, 2012, 12:53:08 AM »
You can use this R-2R resistor ladder network for digital to analog conversion (DAC).

http://en.wikipedia.org/wiki/Resistor_ladder

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Mono Audio DAC for ~20Mhz Microcontroller Synthesizer
« Reply #2 on: January 15, 2012, 12:59:44 AM »
Hi,

Would it be impossible to get a dac that can convert from digital to analog 1) mono channel or stereo 2) at a data rate of 48Ksamples/second.
1) No
2) No


Part of the problem might be that I'm not totally sure what I'm looking for. I initially assumed i was looking for something that looked like this in 16-bit form...
[...]
....in which each input pin would be a digital output pin of the Microcontroller.
Those days are over long ago - and we're all better off for it :)


But everything with quality output I find either seems to be using advanced communication techniques such as I2C such as the max5541 or SPDIF as seen in this demo...
IIC (Inter IC, which everyone and his uncle calls I2C [I square C, not I two C] these days as it's much easier to write ;)) is fairly old hat, born in the mist of ancient times, with wizards and dragons as its midwifes... Well, back on topic. SPDIF is not exactly a youngster either and I wouldn't call any of them advanced.


...but this requires much higher communication rates in the Ghz range. Can a microcontroller that's doing a whole bunch of other crap also output a 6Ghz Serial signal. Why is this crap so complex? 
Yeah, profanity might get you some answers and street cred, just not in this hood ;)
I'll suggest you consult your abacus once more for a rundown of 2 x 16 x 48k.
There's a bit of overhead of course (a bit), but perhaps some of that crap got into the calculation and made it complex (and we all know how crap gets into calculators - *cough*via the keypad*cough*)

The fact that you ask if a microcontroller can output a 6GHz serial signal tells me that you A) didn't read the datasheet very well and B) didn't do a sanity check - even if the controller did nothing besides generating this serial signal, you won't see it perform at more than double the frequency of a microwave oven.

So, inhale deeply (but just fresh air this time ;)), take a step back and regroup.


There is also this IC that keeps showing up in my searches called the PCM2902 that I can't make heads or tails of. It looks like filter for analog signals but implemented digitally; it's called a DAC but for some reason it has an ADC... what's going on here?
You really hate reading datasheets I guess.
It's more or less a USB soundcard and it cannot record sounds without an A/D-C.


It must be easier than I'm making this, but as per usual, I'm missing something basic when it comes to applications of theoretical EE courses.
I'll suggest the AD1866 for your project - download the datasheet (and read it thoroughly). The AD1866 is a 2x16bit stereo DAC, comes in 16 pin DIP (or SOIC) package, runs from +5V, has an impressive THD+noise of 0.005% and a 115dB channel separation. Its max. clock frequency is 13.5MHz guaranteed minimum and this makes room for 8 times over sampling (if you want to gain a few bits of extra resolution and have time for it).


BTW. Remember that your grades are not based on the sound quality made by a high sample rate or a certain bit width, but on your overall mastering of the subject (and how well you read and used the datasheets ;)) - prototyping is much more "grade bearing" than product development and maturing - know the difference... It'll change after graduation though :)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline jim5192Topic starter

  • Jr. Member
  • **
  • Posts: 18
  • Helpful? 0
  • "Brains!"
Re: Mono Audio DAC for ~20Mhz Microcontroller Synthesizer
« Reply #3 on: January 15, 2012, 06:06:55 PM »
Sorry for a lot of the Noob questions. I've never had to implement a real project in my EE courses until now, because everything is just theory and math. I would certainly like to understand applications as well as I do theory to reinvigorate my interest in the field....

I haven't read many datasheets so far because I don't know what I'm looking for. What use is looking for gritty details when I might pass it due to not know what gritty detail I'm looking for. I'm missing something fundamental about circuits and applications. And it looks like, in this project, it's interfacing between digital IC's.

And no, I don't believe the microcontroller can output a 6Ghz digital signal only from the sanity check that I did do. I know it can't, which is why I was asking how I'm supposed to use a serial DAC at "X" Ghz when the microcontroller can't output information that fast. Even the DAC that you did suggest operates with a serial interface. Again, how am I supposed to use this if the microcontroller can't output information that fast. This is a fundamental confusion.

You also stated "No" in response to me asking:

"Would it be impossible to get a dac that can convert from digital to analog 1) mono channel or stereo 2) at a data rate of 48Ksamples/second. "

1) Why would this not be true? I don't understand? Audio is in either mono or stereo.
2) Why not? CD players do this. Either you're lying or I'm missing something, and I'm pretty sure it's the latter.

I asked this same post on physics forums and I got the response of this chip:
http://search.digikey.com/us/en/products/LTC1657CGN%23PBF/LTC1657CGN%23PBF-ND/963782

This appears to be indeed what I was looking for. The data sheet suggests a lag time of 20us on the output for 16 bit parallel input. 1/20us = 50Khz ~ 48Khz which is the data rate I was searching for. This would also only require the microcontroller to output 16 parallel bits at ~48khz, which it should be able to do.


In response to  billhowl:

I have seen the R-2R ladder DAC before in my microcontrollers class, but I am unaware of the quality of the output. Is there are reason for all of these DAC's packeged in IC's, such as a quality improvement in the output? Also, The microcontroller won't be able to output each of the digital pins at exactly the same time, so wouldn't the R-2R ladder DAC start blending the two digital words together between samples, distorting the output? Or is this distortion negligible?

I look forward to hearing both of your replies.
« Last Edit: January 15, 2012, 06:12:34 PM by jim5192 »
"Imagination is more important than knowledge."-Einstein

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Mono Audio DAC for ~20Mhz Microcontroller Synthesizer
« Reply #4 on: January 15, 2012, 09:14:04 PM »
Even the DAC that you did suggest operates with a serial interface. Again, how am I supposed to use this if the microcontroller can't output information that fast. This is a fundamental confusion.
Why on earth do you think that you need 6GHz to output a 16 bit 48ksps stereo signal?
That's where the fundamental confusion lies!

I already gave you the numbers to tap into your plastic brain of choice, but once more...
2 channels x 16 bits x 48,000 samples per second
That's slightly over 1.5Mbps, far from 6Gbps and very realizable.


You also stated "No" in response to me asking:

"Would it be impossible to get a dac that can convert from digital to analog 1) mono channel or stereo 2) at a data rate of 48Ksamples/second. "
Yes...
Question: Would it be impossible...
Answer: No
To bend it in neon, that means that both mono and stereo is possible.


1) Why would this not be true? I don't understand? Audio is in either mono or stereo.
2) Why not? CD players do this. Either you're lying or I'm missing something, and I'm pretty sure it's the latter.
1) Yes (or 5.1 or 7.1 or whatever), but what does it have to do with anything?
2) Exactly and your insinuations really gives me a warm fuzzy feeling - makes me wanna really help you out... Or something.


I asked this same post on physics forums and I got the response of this chip:
[...]
This appears to be indeed what I was looking for.
By all means, go with it, as long as you don't expect too high a sound quality from it (over 100nV/sqr(Hz) noise), I'm sure they'll be very helpful over there.
BTW. Don't confuse settling time and lag.

Using two of the chips you mentioned will set you back $40 and you'll spend 37 output lines, while with the chip I mentioned, you'd only need one chip, could possibly get it as a free sample and you'd only need 4(5 tops) lines from your controller.


The microcontroller won't be able to output each of the digital pins at exactly the same time, so wouldn't the R-2R ladder DAC start blending the two digital words together between samples, distorting the output? Or is this distortion negligible?
You latch the outputs, either in the controller or in an external latch chip, so there's no mixing between samples, but you cannot get 16 bits precision from a discretely build R2R ladder.


Not to confuse the concepts, just for a glimpse into the real world - such a project, if targeted for commercial deployment, would be made in a DSP with A/D-C's and D/A-C's built in and all the filter functions and other sound effects (like reverb, echo, pitch change or whatever was wanted) would be implemented in code.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 

SMF spam blocked by CleanTalk