Author Topic: Audio DAC output Low Pass Filter.  (Read 23510 times)

0 Members and 1 Guest are viewing this topic.

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #75 on: March 21, 2018, 10:46:02 am »
LOL.  Everytime I finish relaying out the board you throw a curve ball.

So I'm happy enough with the MLCCs but... I was just about to consider what resistors I need to add gain to the amps to get headphone level.  Then I seen the comment about the MLCC caps and headphones.

Of course it would only really need to be the two OUT coupling caps that are under any kind of load....
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #76 on: March 21, 2018, 11:05:26 am »
Don't worry, we are just bugging you to go to extremes not needed for your design.  You have a series 100 ohm resistor, so with a 1v signal, you are talking only 1ma ac max driving a short.  You will be safe, if not for the issue of very low frequency.  For headphones, you should be thinking something like 0 ohm (since your voltage is low) , and 220uf cap, not 10uf.  And still, you are still only going up to 30ma AC, unless you are using low impedance headphones.

I would use a through-hole 220uf, 6.3v since they are cheap, and put a 10uf ceramic in parallel for further lowering the ESR.
https://uk.rs-online.com/web/p/aluminium-capacitors/0569451/

Stay with the sub dollar for 25 caps 10uf 10v 1206 cap I listed.  It's ESR is around 0.3ohm while the aluminum caps it replaced were 2.2 ohm ESR.
« Last Edit: March 21, 2018, 11:10:27 am by BrianHG »
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #77 on: March 21, 2018, 11:16:11 am »
But, I don't think much will be effected in this project.

Sorry for the pedantry from someone who reads diyaudio often and designs high spec DACs on his own ;).

This is the tricky part with all electronics progression and forums, aspect pedantry and phoolery and working out when it is one or the other.

When someone comments on an aspect of your circuit, you have to work out do they mean:

* It will blow up
* It won't work!
* It will work poorly.
* It will work in an acceptible way for 99% of people.
* It will work fine, but I would do it differently.
* It is fine, but if you want special, trimming away at the 1%s and 0.1%s on functionality, you should...a, b, c.
* If you want a high-end, usually sold in $1000 professional versions and often completely and utterly pointless for domestic use... do x, y, z.

Audio is probably one of the worst areas for this.  I have yet to have someone explain to me why people bother with greater than 44k and 16bit DACs.  I can understand for "oversampling" filters etc, but not on the output.  Not for audio.  Definitely not for standard domestic audio.  Your scope might be able to tell you the difference, but not your ears, even if you could afford a pair of headphones or speakers capable of reproducing the defects in the signal your scope shows. 

For professional studio grade stuff, I can start to see reasons, to keep all the stages where digital must become analogue and vice versa as free from converter artefacts as possible.  Though in those areas, how often does a signal need to be converted back and forth these days?  If the signal is not digitally generated, guitars, mics, drums, vocals etc.,  Then probably once.  If they are digitally produced, EDM etc. then it might never be converted to analogue and the first time you hear it is the only time it has been reproduced in an analogue form since it's creation.

So probably the only market for botique, high end DACs is the middle ground.  People who want to produce professional grade digital recordings but have analogue equipment which require DAC-ADC or ADC-DAC chains.

EDIT:  A similar argument can be made for lossful formats.  TIF/BMP versus PNG, JPG.  Or, video, YUV12, raw, versus Mpeg2, Mpeg4.  For end of line user formats the compressed or even lossful versions are fine, but not so fine for intermediary stages.  Some pro-video is saved as individual frames in uncompressed 32bit colour.
« Last Edit: March 21, 2018, 11:21:24 am by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #78 on: March 21, 2018, 11:35:12 am »
Actually, remember those 22Khz & 24Khz samples I sent you which came out wobbly on your scope.  With the same file played through an up-sampling interpolated DAC, the output would be as clean and steady as your function generator output.

This means a 10Khz and 12Khz will just be half as wobbly on your scope compared to a up-sampling DAC, or, a proper analog reconstruction filter on the output of your 48Khz DAC.  That removal of wobbly does make an audible difference down at the 10-12Khz range.  And no, your output low pass filter which may remove the higher band of frequencies is not sophisticated enough to change those wobbles into a clean sine wave, unless TI has something in this PCM2904 device which is not mentioned in the data sheet..  The sound artifact you get from not straightening and smoothing out those wobbles is called antialiasing.

Example, 20Khz sine sampled at 44.1Khz, simple low pass filter output:

Exact same 20Khz sine sampled at 44.1Khz, digitally upsampled, interpolated filtered through a 192KHz DAC:

If I improved the low pass filter utilizing tuned inductors & caps in the first snapshot, and kept the 44.1Khz dac, then, the output would match the second digital equivalent scope shot.  Basically the faster dac receiving the slower sample rate performs a software version of the inductor, cap, (NOTE, this cuts down on op-amp stages, you can make a 7th order filter with many more sophisticated op-amp techniques, but, if you want a single stage, the right tune-able (must be tune-able to get it all in 1 shot) inductor simplifies a lot) resistor to an absurd degree of precision and fills in all the missing steps in the right place meaning you needed output filter only now needs a simple low pass resistor/cap filter to get rid of the really high frequency steps.

« Last Edit: March 21, 2018, 11:52:39 am by BrianHG »
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #79 on: March 21, 2018, 11:47:33 am »
Don't worry, we are just bugging you to go to extremes not needed for your design.  You have a series 100 ohm resistor, so with a 1v signal, you are talking only 1ma ac max driving a short.  You will be safe, if not for the issue of very low frequency.  For headphones, you should be thinking something like 0 ohm (since your voltage is low) , and 220uf cap, not 10uf.  And still, you are still only going up to 30ma AC, unless you are using low impedance headphones.

I can see the low end roll off in spice for the 10uF, but it's like -3dB at 1Hz, -1dB at 10Hz and 0db at 20Hz... something like that.  Though Spice doesn't, probably account for real world capacitors.

And why am I on the other side of the 220uF cap debate this time? LOL :)

I also have some room to lift the gain on the opamps.  I think I can take the signal voltage up considerably (relatively speaking) while still leaving headroom for the rails.  VCom is going to be around 3.5/2 = 1.75V, giving room for the rails, I can go a volt either way comfortably, 2Vpp.

So, 2Vpp through a 100R is +-10mA.  Will an MLCC handle that?
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #80 on: March 21, 2018, 11:53:40 am »
Yes. You will be safe beyond 200ma.  In fact, at 0.5 amp rms, the capacitor should only rise less than 5 degrees C for the 1206.  After all, the problem with current here is a temperature rise of such a tiny device.
« Last Edit: March 21, 2018, 12:07:36 pm by BrianHG »
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #81 on: March 21, 2018, 12:15:18 pm »
This 3 stage filter is even better, and the signal stays positive:
http://www.analogfilters.com/anti-aliasing-filter/

For your output, switch to an OPA4353 (quad version of your current opamp), and you can make it.

Use 3 amps for the filter, and 1 for the signal gain.
« Last Edit: March 21, 2018, 12:50:46 pm by BrianHG »
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #82 on: March 21, 2018, 01:17:28 pm »
That looked like neat software to have until I looked at the price!
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #83 on: March 21, 2018, 01:57:02 pm »
I've now checked all the footprints.  Sticking with the 0805 10uFs, due to not wanting to move things around again!

Final thoughts?



The PCB layout and schematic are in here:
https://imgur.com/gallery/5pu7K
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #84 on: March 22, 2018, 02:16:15 am »
I've now checked all the footprints.  Sticking with the 0805 10uFs, due to not wanting to move things around again!

Final thoughts?



The PCB layout and schematic are in here:
https://imgur.com/gallery/5pu7K

Step #1, rotate the PCM2904 by 180 degrees.
Swap the location of the USB and regulator.
Re-position small components.

Step #2, swap in and out jacks and opamps.
You have vias on your negative feedback inputs of your opamps when rotating 1 adjacent cap/resistor would eliminate them and shorten the route and clean up a mess at multiple times.

For the resistors and small caps, 0603 might suit this design better, but I understand how 0805 is easier to hand solder.
Man there is just too many vias out there...
Also, your 0805 in many circumstances can be closer together.

Take a look at my attached image.  Copy my 0805 footprint.  The trick here is that the Silkscreen superimposes perfectly when you placed the components as close as possible for safe hand assembly.  This makes it easy to group up 0805 as compact as possible visually while routing.
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #85 on: March 22, 2018, 07:47:50 am »
Thanks, but I sent it for manu already.  I figured if something is going to stop it working it will be something hugely stupid that we all overlooked rather than a fenickity detail.

Using AllPCB this time, 24 hour build time and 3-5 day free shipping, $22 (would have been $15, but I wanted blue solder mask).  We'll see how it turns out, but if that lead time is accurate I can afford to mess one or two up.

Already laid out the baxandall module, still need to do:

* PSU module with LRC filter or see if linear 12V regs will clean up the supply (needs an evening bread boarding with the scope).
* mixer/master volume module
* headphone amp module
* BT module
* potentially a bypass-able LP filter module

It will look like some 1970s modular synth, but if I can get it all working, the next step is to put it all together onto one 4 layer board.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #86 on: March 23, 2018, 03:16:19 pm »
Impressively the PCB is now already made, just waiting on shipping.  Fingers crossed.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #87 on: March 27, 2018, 08:38:32 pm »
So the board arrived a day early.  Now that's quick for free shipping from China.

And...  Tada!

Code: [Select]
[12043.564477] usb 3-2: new full-speed USB device number 3 using xhci_hcd
[12043.884067] usb 3-2: ep 0x85 - rounding interval to 64 microframes, ep desc says 80 microframes
[12044.021022] [b]input: Burr-Brown from TI               USB Audio CODEC [/b] as /devices/pci0000:00/0000:00:15.1/0000:06:00.0/usb3/3-2/3-2:1.3/0003:08BB:2904.0007/input/input23

Took me two hours to air solder it together, doing it in little blocks at a time.

I took the bold move to swap the input resistors on the opamps from 12k to 3.9k at the last minute.  Works a treat.  It drives headphones at a nice normal nanny state level and when put through my headphone amp it pushes it to it's limits.  Perfect.

Not a buzz, hiss, burp or fart from it and, allow I am it's creator, I'm sure it sounds better than my cheap £4 PCM2702 Chinese board.



Thanks everyone for the help on this one, as always! 

And yes... they did have to put their order serial number over my text in the lower left  :@
« Last Edit: March 27, 2018, 08:40:08 pm by paulca »
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 

Offline BrianHG

  • Super Contributor
  • ***
  • Posts: 7738
  • Country: ca
Re: Audio DAC output Low Pass Filter.
« Reply #88 on: March 28, 2018, 06:39:39 am »
Congratulations  :-+ Don't forget to add to the achievements thread.
 

Offline nihtila

  • Regular Contributor
  • *
  • Posts: 74
  • Country: scotland
  • A Finn in Scotland. Audio Apps Engineer and Maker.
    • nihtila.com DIY audio electronics
Re: Audio DAC output Low Pass Filter.
« Reply #89 on: March 28, 2018, 09:59:32 am »
Nice and neat little board, good job! I found this thread just now but recently finished similar project based on PCM2912A. I needed microphone input as well.

I am an audio guy myself and have done 120+ dB dynamic range stuff before, and regarding previous discussions I'd say there is a reason to go for 24-bit DACs instead of 16, it's not audiophoolery (like many other things) as with 16-bits the digital signal itself easily becomes the bottleneck of the system. Extra dynamic range gives some freedom in volume control etc. However, if you want to keep it simple, these USB codecs are handy and unfortunately only offer 16 bits. But with proper gain structure consideration 90 dB dynamic range is obviously plenty.

I made this wee board inside a Hammond box mostly for microphone to use when making videos etc. Basically it is a USB interface for headset, it has a 4-pole jack. It's based on TI reference design, no gimmicks here, just a quick project.







Measurements and more info can be found here http://nihtila.com/2018/03/26/usbhi-usb-interface-for-headset/
http://nihtila.com - Vegan DIY audio electronics, does not contain snake oil
 

Online paulcaTopic starter

  • Super Contributor
  • ***
  • Posts: 4053
  • Country: gb
Re: Audio DAC output Low Pass Filter.
« Reply #90 on: March 29, 2018, 06:42:53 pm »
I thought I'd share the source, it was after all a group effort.  People wanting to do the same may find this thread.

https://gitlab.com/paulcam/PCM2904_DAC

Hopefully the git repo works.
"What could possibly go wrong?"
Current Open Projects:  STM32F411RE+ESP32+TFT for home IoT (NoT) projects.  Child's advent xmas countdown toy.  Digital audio routing board.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf