Total Pageviews

Thursday, July 20, 2017

My Hi-Fi Raspberry Pi DAC project. The Build Phase

    This is part two of my Raspberry Pi DAC project. If you  want to know how this came about, you might want to read part one

So, the fun begins.

The PCB are here!

     Oh, happy day!.

  I ordered my PCBs from PCBWay, and they're not half bad. Pads look OK, the footprints for the TPA op-amp, which had me worried a bit,  turned out nice and so did the solder mask.

Of course, the first thing was to check and see if the PCBs actually fit the Pi....and they do. Phew!

Next up for inspection, the PSU boards:

Lovely. Except, this is the last time I order black solder mask. Every speck of dust is visible, the flux residue looks horrible on it and you can't see anything if the light is not at the right angle.

That being said, let's start assembling these things.

I don't own a hot air station, but I do have a digital controllable hot air gun. Soldering the PCM5242 was easier that expected and that kinda built up my confidence. But, like always, Murphy stuck out his head and had a say in the soldering of the TPA op-amp.

Because it only has 2 pads on 2 of its sides, it made it especially difficult to keep it on the pads. Every time I came closer that 10 cm with my hot air gun, it just blew it off my board.
It took me about 40 minutes of frustrating work to finally get the TPA to stick and reflow properly.

    My method consisted of applying some solder to the QFN package and a little to the pads on the PCB. Garnish everything with tons of rosin flux and voila!
 Just be careful, because if there's too much solder on a pin, the surface tension when the it reflows will keep the package from leveling out on the board or leak out and short to adjacent pads, if the part is slighly moved or pressed.
    After checking for shorts on the DAC and op-amp I went on to solder the rest of the components on the Pi hat

Next up, the PSU boards. These have fairly large components, so they were no trouble at all.


    No, this one isn't about an uninterruptible power supply... I just messed up. Some keen-eyed readers (you the few, the proud, the EEs) might have spotted in the schematic (or, if you haven't, you will now) that the DIN pin of the DAC is atually tied to the DIN of the Raspberry Pi. Yeah, that should have been the DOUT pin on the Pi.

    The Pi has DIN on pin 38 and DOUT on pin 40. My DAC is tied to pin 38....I can personally guarantee you that this set-up won't work.
Why did I mess up? inconsistent data on some Pi pinouts on the web. That and I was too much of an eager beaver to get the board done so I didn't bother  to check more than 2 photos online

    But, like always, I found a nice easy fix for it. I wasn't really  in the mood to cut the trace to pin 38, so I lifted and isolated the pad to R14 going to the Pi's DIN, then soldered a wire from the resistor, to pin 40. There. Problem solved.


     I've seen enough fancy DACs on Google's searches to instill in me the conviction that I needed to put everything in a nice anodized aluminium case.... minus the blue LEDs. I hate those, but they seem to be on everything these days.

    Ok, micro-rant over. So, I had to fit a Rasberry, its own PSU and two oversized linear PSUs.
Loca suppliers didn't have  the size or look of what I wanted, so I went shopping elsewhere. In France, actually. I mean, they make fancy everything there. Fancy cheese, fancy wine, horrible cider (interesting story here), fancy aluminium cases. Perfect!

    The case I got was from Audiophonics. I'm in no way affiliated with them, these guys seem to  have everything  audio and audio related.  My case was about 35 Euros and is 280 x 158 x 48 mm (L x W x H) which is just about the right size to get everything squeezed and allow for some cable management. Some might call this luck. I call it engineering.

Oh, the feet I also got from Audiophonics. They're just plastic, but they certainly look the part.

Testing, testing... Is this thing on?

    If a picture is worth a thousand words, then here's..... well, a few thousand words for you.

The cobbled stuff you see on that perf board is a single-ended to differential signal converter. It sounds fancy, but it's just 2 amps in an inverting and non-inverting configuration. This is to test the TPA6120 op-amp to see if everything got soldered on properly.

    In the scope pics, the yellow trace is the input signal (before the differential converter) and the blue and pink (or magenta? hell if I know) are the outputs of the TPA. The dark blue trace (the lowest trace) is the output of the op-amp. One channel only.

You might recognize the beast that is the  Interstate Electronics generator in the pics. I'm happy to say that it's running quite nice for its age. It has the occasional hiccup at power-on, but nothing a little hard rest can't cure.

Tying up loose ends

    I stuck a heatsink onto the TPA6120 op-amp because during my tests with an open case showed that the op-amp will heat up to 55 degrees C and stabilize at this point. I figured that once it'll be put in its enclosure, together with all the other heat sources, it might get a little too toasty for long term reliability, therefore, I give you the pic above.
  The grey square is a silicone pad. Even though the heatsink is anodized aluminiun, I just wanted to make sure it'll never touch the resistors next to the amp. I've laso added heatsinks to the Pi's chips as well. Those are underneath the DAC hat.

    Being  the paranoid guy that I am, even though the PSUs are mounted on 3.5mm nylon standoffs, I thought I'd play it extra safe and add some isolation between the case and the through-hole pins carrying live mains.

    Another important thing would be the DAC output filter.  The data sheet for the PCM mentioned using 1nF NP0/C0G caps.  Now, I'm no audio guru, but  an electric guitar mostly sounded as if it wanted to come at you and cut off you ears with a bread knife. The 3dB point of the filter with the original 1nF caps was 422 KHz, so I changed these to 2.2nF caps, decreasing the bandwidth to ~300 kHz.
  This is what LTSpice told me, so that's what I'm tellng you now.
    It made for a much cleaner sounding audio experience, especially on the highs. The issue was most likely caused by intermodullation products making thair way into the audio range. By reducing the filter's bandwidth, some of the haronics were attenuated, rendering a nicer, cleaner sound.
    I might consider going all the way up to 3.3nF caps just to see what happens....
 Oscillators, anyone? get your free oscillators here!!


    Well, if youre wondering about geeky stuff like THD and noise performance, you're not the only one. I lack the proper equipment, but I do plan to build me some  nice THD measurement unit.
  Quoting the THD figures from the DAC's datasheet isn't that relevant, but might I remind you that the supplies for the DAC and op-amp are linear ones and the DAC's channel outputs are differential, so the only significant part, susceptible to noise pick-up is the op-amp itself. But because it has a high PSRR and the ground loops are (I think) on the  small side, there is a fair chance that the distiortions on the audio output of the hat might be quite low.
    Untill I find the equipment to make real world measurements, I can only say that to my ears, the DAC hat is a success. A 196 KHz, 24 bit  song sounds prety impressive, so for now, this is where things stand

Volumio Set-up

    Well, there are lots of places online detailing how to get your Volumio up and running. So why not add another one the list?
    OK, so it's pretty easy. Just go to the Volumio download page and get the latest build. That will be in a .zip format and inside that there will be a .iso file.
After you've formatted you SD card  (I formatted mine as a FAT32) you plug it in and write the image to the card.
Hold on, it's coming.... For writing the image file, I used Win32 Disk Imager. It's basically "point and shoot", so there's no reason to go into further details.

....and here comes the fun part. Once you write your .iso file  (not the .zip, like I did...doh!) just plug the card into your Raspberry and you're on your way.
  Of course, once it boots up, you have to access it. I only access mine over LAN, so I don't know much about the wireless set-up, but I can assure you that once it's all booted up, you can go and write in your browser http://volumio.local/playback and you should be in like Flynn...
  On the off chance this doesn't work, you'll have to go into your router and see what devices are connected to it. The DAC should come up as "Volumio". Then just access it via its IP address.


    Let's say you want to share the folder "Music".
  If you have a NAS, just type in its IP address and the name of the file you want Volumio to play from. Do not leave the "Alias" field blank. You have to write something there or the sharing won't work. And, whaterver you do, please DO NOT share files with spaces in its name (e.g. My Music). It screws up the sharing somehow. I wasted an entire day with this crap. Just use underscores (e.g. My_Music) It'll save a lot of freakin' time.
    If you are just running a version of Linux on your NAS, select "nfs" from "File Share Type". However, if you're running Samba, then just leave the default "cifs"

    Ok, so you're no that fancy and  just have a PC. No problem.... just do the same procedure as mentioned and leave the default "cifs" in the "File Share Type". If by any chance you have a user and password for you PC, then just write these in the appropriate fields. But really, who does that? Who has a passworded PC at home? That's no security, that's just a waste of time. You want security?  Then run Linux on your PC. Everyone in the house will hate you.

Final thoughts

    I ended up building two almost identical DACs, one for me and one for a friend of mine. The only difference is that while I used a Raspbeery Pi 2 B+, his was a Raspberry Pi 3.
Our choice of web players was Volumio, which worked on both versions without a hitch.
Also, because the Pi 3 has built-in Wi-Fi, I added an antenna for it in the back of the case. If you need some more info about how to do this, you can check out this article. It has a lot of nice pictures regarding this mod. Also, if you're going to do this, u.FL connectors are a pain to solder, so if I were to do it all again, I'd go with just soldering a coax cable to the Pi's PCB and tack it in place.

    Like always, you can see the whole album of this build here. Hope you like what you see and if you want to comment, leave one below.

    Later edit:  The DAC has been so far running non-stop for about a week and everything looks OK. The op-amp did start heating up as soon as I gave it power, so that heatsink really helps. I want to do a thermal profile of the DAC to see how it behaves in the long term, therefore I'm searching for a way to do some temperature data logging. I'll  probably do a post on this as well, in the future,

Disclaimer: The stuff from TI I bought myself. I'm in no way affiliated with them. It just happened that they have the kind of parts I  needed


Post a Comment

google-site-verification: googlee8a41f51abde7545.html