Designing a USB sound card

(This is an English translation of my article at Ruuvipenkki forum.)

1. Introduction

In this article I will discuss my own experiences about designing a USB sound card, which is the USBDAC. DAC is an acronym for Digital-to-Analog Converter because in a sound card, digital data representing the sound is converted into analog voltage that moves the speaker cone.

My device is loosely based on the PCM2706 reference design. I will not go through the tecnical details but instead concentrate on my own experiences in the design of the device. This is to keep people not familiar with electronics, as well as newcomers to electronics design, interested. You will see that one working product is the result of many failed prototypes.

2. The PCM2706

First, let me introduce the star of the occasion. PCM2706 is a USB 1.1-compliant peripheral, that implements the USB audio device class. This means that when you plug in the PCM2706, the operating system knows that its a standard device and can start using it without a separate driver.

The PCM2706 was designed by Burr-Brown, but since TI bought BB, it’s now being manufactured by TI. PCM2706 supports up to 16-bit 48 kHz sampling rate. This corresponds to CD level quality. It has a built-in headphone amplifier and a digital S/PDIF output for example home theater amplifiers. The headphone amplifier puts out a reasonable 175 milliwatts (0.175 W). The device is available in prototyping-friendly 32-pin TQFP package. It has a built-in 3.3 V regulator, so practically it doesn’t need any other than passive components to function.

More details and datasheet can be found at TI’s PCM2706 info page.

One PCM2706 costs around 8.4 euros (0% VAT) at Digi-Key, so it’s not very cheap. In volume the price will, of course, drop, but hobbyists might want to check out TI’s excellent sample service. A few PCM2706 samples will arrive from USA in less than a week and TI pays all the expenses (duties and taxes included, if applicable).

A small moral notice on behalf of the electronics enthusiast community: don’t order samples just because it’s free. If you have no intention of using the samples, don’t order them. Manufacturers give out samples very generously, and if people start taking advantage of them just for the fun of it, they might stop. This has happened in the past with some smaller semiconductor companies.

 

3. A Gallery of Failures

In this chapter I will go through all the revision from the first to the last. You will see that to make one functional device, you have to fail atleast once or twice. :-)

3.1 Prototype Revision A

Prototype A was a 1:1 copy of the datasheet reference design. I had made atleast five different mistakes that caused the device not to function even after I had bypassed the mistakes with jumper wires. The device was caught in an endless USB enumeration loop that was illustrated by the Windows “new device found” sound being heard ad infinitum. The PCM2706 was probably killed because USB’s 5 volts was fed into its 3.3-volt regulated pins. In addition, I was missing crucial pull-ups/pull-downs and the digital out lines that I chose to include didn’t work because they were configured incorrectly (also pull-ups/pull-downs).

In respect of PCB layout design, no rules were followed. There isn’t even a copper fill on the top layer. The design is in effect one-sided since the whole bottom layer is a ground plane.

Populating this board was the first time I did surface-mount soldering and it shows. All small resistors and caps are 1206. Bigger electrolytic caps have wrong footprint, so I had to bend their leads down to get them soldered.

3.2 Prototype Revision B

B-version was much more polished. I removed all the errors that I found in the A-version and checked the schematics a couple of times before ordering. I ordered the PCBs for the revision A without even a second look which of course was very stupid. Experience has taught me that.

The “beta” didn’t work the first go (surprise!). A couple of mistakes made it through to this version as well. The device VDD (3.3 V) does not equal USB VBUS (5.0 V), so I cut that trace. In addition the USB D+ line has to have a 1.5 kilo-ohm pull-up but I had instead specified a 1 megaohm resistor. These were easy fixes though. It wasn’t recognized by Windows though. The USBDAC was caught in the enumeration limbo again, just like the prevision version. I deducted it must be toast because I again fed five volts into its regulated pins. I soldered together another board with the aforementioned fixes and this time it was recognized immediately. The feeling of success was intoxicating as I watched the analog output bounce up and down on the oscilloscope screen.

I quickly soldered together the analog output stage and added the 3.5-millimeter headphone jack that was now part of the PCB design. After connecting the headphones I made to discoveries. Firstly; the headphone amp is very powerful. On earbuds (Sennheiser CX-300) Windows mixer’s sound level has to be 1/100 so that it’s not too loud. On bigger headphones (Beyerdynamic DT331) a nice level is around 5 to 10/100. Secondly; the bass was completely non-existing. Otherwise the sound was very nice, with a lot of crispness in the mid-tones and higher end. I started to investigate the bass problem by looking at my schematics. It didn’t take long to find the source of the problem.

The output stage has an RC-type high-pass filter with a 100 microfarad electrolytic cap and a 3.3 kilo-ohm resistor. The corner frequency of the filter is around 0.5 Hz to filter out DC from getting into, and ruining your speakers. Somehow in my schematic I had specified 100 uF cap and a 16 ohm resistor giving me a corner frequency of 100 Hz which nicely cuts out all the bass frequencies. This was, again, a quick fix as I replaced the resistors and now it sounded magnificent. About 25% of that magnificence was just from the success but in the following days I used it to listen to a lot of music while at work and it didn’t start to sound any worse. Compared to my work PC’s built-in Realtek HD, it actually sounds better. The reference setup consists of Edirol MA-10A monitor speakers’ headphone out and Beyerdynamic DT331 headphones.

There was one problem with the layout as well; the audio channels were swapped. This is no problem with music but it would have to be fixed to the next revision.

3.3 Revision C — Third Time’s the Charm

I worked on the third revision patiently since I no longer had any rush to success. I started designing the schematic back in September 2011. I drew the board layout on one hung-over sunday in one go in October 2011. I made necessary modifications and fixes in the following months as I perfected the design.

The PCB design was again in practice one-sided since the bottom was a single continuous ground plane. This time I paid attention to signal trace lengths (clock signal), USB differential signal routing and grounding. The grounding is star-type since all ground points are connected directly to the ground plane. The clock source is no longer a crystal with parallel loading caps, but a self-contained crystal oscillator. At the moment I have a regular XO (Xtal Oscillator) installed but in the future I plan to try out if a TCXO (Temperature-Compensated Xtal Oscillator) makes any difference. There is also a spot for a 128-byte I2C EEPROM on the PCB for providing a custom USB identification. By default the device enumerates as “USB Audio DAC”.

A bigger change in this revision is that I designed it to fit in an existing case. The case is a Hammond 1551S, which is small at 50×50 millimeters. I got the case only in March 2012 and even though I designed the board in October 2011, it fit perfectly.

After populating the board it worked instantly. It sounded like it should. The only “problem” at the moment is the output stage aluminum electrolytic caps which are too tall to fit in the case. I have ordered the replacements, Nichicon Muse F95 premium audio tantalums. They should make the bass even better. I haven’t yet tried the I2C EEPROM identification but after checking the schematics and comparing to the datasheet many times, I don’t think it will be a problem. A bigger problem will probably be the tiny physical size of the EEPROM. :-) There is a solder jumper P4 on the board that selects between default ID and the EEPROM.

Here is the finished Rev C board being tested:

 

4. Thoughts After The Project

When I started this project I didn’t really have much experience or knowledge in designing a PCB. It showed. In the past year I’ve gathered a huge amount of real-world knowledge and experience which is invaluable. I don’t think I will learn quite as much in such a short time ever again.

The foremost thought on my mind is that you should never be too rushed to order the PCBs. Part of that problem for me was that getting finished PCBs from ITead Studio takes almost a month. The other part of the problem is my short attention span. :-)

I’m happy with the project. The only thing that I think about is the real performance of the device. Does it meet TI’s specs (THD, SNR)? Does it exceed them? What is the real power of the headphone amp? I have no way of measuring these, so they will be a mystery.

I would be happy to receive comments from more experienced designers about my PCB design and other things. What could I have done better? What did I do well? If you are a beginner, I hope this brings your expectations about electronics projects closer to reality.

This entry was posted in Uncategorized. Bookmark the permalink.

30 Responses to Designing a USB sound card

  1. bryan says:

    there’s some rightmark audio mark or something… dunno much about it, but some sites use it. the other downside is that may only be as good as the ADC…

    http://audio.rightmark.org/

  2. Pingback: From reference design to USB sound card - Hack a Day

  3. Pingback: From reference design to USB sound card » Dirty Old Device

  4. Pingback: From reference design to USB sound card « Hackaday « Cool Internet Projects

  5. Pingback: From reference design to USB sound card » Geko Geek

  6. Anton says:

    Really neat implementation and a good idea. I had almost the exact same one a while back actually, but i wanted to add thebuttons for play/pause, volume etc. I also thought of pairing it with a opamp-based headphone amp. But i was kind of put off by the smd package though. Anyhow, du you think I could buy one of the spare boards? (If you have any left)

  7. brad says:

    With a 16bit audio part like that, the best way to go is to have windows at full power (100%) and have proper volume limiting happening on the analog side. This is why there is “no bass” (the rest of the sound is most likely off as well).

  8. Janek says:

    Don’t forget about the impedance of your headphones which also form part of the RC filter at the output… for my headphones the impedance goes down to 16R so the bass response would still be very poor (I have tried an “ebay” USB dac also following the PCM2706 reference design and it does indeed have poor bass response as expected). I would add an output stage with a capless headphone amp chip.

    Great writeup :)

  9. Pingback: From reference design to USB sound card « « The Depot of Talk

  10. Pingback: From reference design to USB sound card | CisforComputers

  11. Ishan Karve says:

    Mikko, that’s a fantastic build and equally well documented.. Buddying hobbyist like me have a lot to learn form this post.. Happy circuit-ing..

  12. ScottInNH says:

    Nice build. I’ve yet to try something like this, but I’m getting close.

    What do you mean when you say you have no way to measure the power of the amp? Do you mean power consumption on the USB, or power output? I might misunderstand, but I thought you could measure either by using a multimeter inline to the USB or headphone (but really, I don’t know… I’m still figuring a lot of things out). Cheers.

    • Mikko says:

      I meant the actual power output into the load (the headphones in this case). I think I could do a measurement by outputting a 1 kHz sinewave to a dummy load and measure the current as well as the voltage. I’m not sure about this, though. Measuring the power consumption would be interesting as well.

  13. TimC says:

    Mikko, Inspiring build, well done! Would you be interested in developing a custom version of this project? Please contact me directly and we’ll discuss it.

    Thanks!

  14. Jan says:

    That’s the way it works!

    Connect a (for example) 100Ohm resistor turn the volume up and measure the voltage at a sinewave of about 1khz. That gives you the average power output.

  15. Jeremiah says:

    Care to share a schematic and/or board design? I’d love to build one of these.

  16. max says:

    Great project Mikko!

    Could you post the schematic of rev.C? I find very difficult understand what you did just looking at the PCB.

  17. Alex says:

    Beautifully made, I’m happy for your success!

    btw, why do you chose to make bottom ground plane?

  18. Ryan Gibson says:

    Insanely awesome build. Looks great too :)

    Do you have an email I can grab you on and ask some further questions?

    Thanks

    Ryan

  19. dzsombor says:

    Could you upload the whole eagle project or it’s private? Thank’s.

    • Mikko says:

      This was not designed in EAGLE. The board layout is already published as a JPEG along with the schematics so you have all you need to recreate this.

Leave a Reply